This commit is contained in:
mike
2026-06-27 13:51:51 +02:00
parent 4e23374093
commit 08a8cc9b82
5 changed files with 34 additions and 53 deletions

View File

@@ -1857,10 +1857,6 @@
</svg>
Studio Monitor <span>AI</span>
</h1>
<div class="prompt-bar">
<input class="prompt-input" id="promptInput" type="text" placeholder="prompt..." onkeydown="if(event.key==='Enter')setPrompt()" />
<button class="btn primary" onclick="setPrompt()">Set Prompt</button>
</div>
<div class="controls">
<span class="count" id="count">0 images</span>
<button class="btn" onclick="setIntervalTime(30)">30s</button>
@@ -4610,14 +4606,11 @@
const files = eventOrFiles.target ? eventOrFiles.target.files : eventOrFiles;
if (!files || files.length === 0) return;
const prompt = document.getElementById('promptInput').value;
showToast(`Uploading ${files.length} items...`);
for (const file of files) {
const formData = new FormData();
formData.append('image', file);
if (prompt) formData.append('prompts', prompt);
// If it's a pasted file, it might not have a useful name
const fileName = file.name || 'clipboard.png';
@@ -5422,40 +5415,10 @@
} catch (e) { showToast('API not reachable', 'info'); }
}
async function loadCurrentPrompt() {
try {
const r = await fetch(`${API}/config`);
if (r.ok) {
const conf = await r.json();
document.getElementById('promptInput').value = conf.prompt || '';
}
} catch (e) {
// API not reachable yet
}
}
async function setPrompt() {
const prompt = document.getElementById('promptInput').value.trim();
if (!prompt) return;
try {
const r = await fetch(`${API}/config`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ prompt }),
});
if (r.ok) {
showToast('Prompt updated', 'success');
} else {
showToast('Failed to update prompt', 'info');
}
} catch (e) {
showToast('API not reachable', 'info');
}
}
// Initialize
document.addEventListener('DOMContentLoaded', () => {
loadCurrentPrompt();
loadPromptHistory();
loadImages();
autoRefreshTimer = setInterval(_timedRefresh, REFRESH_INTERVAL * 1000);