feat(image-to-text): refine and expand model instruction console with obsidian liquid glass framing, modifiers, and stats
This commit is contained in:
@@ -111,8 +111,15 @@
|
||||
// Analysis Configuration
|
||||
const modeBtns = document.querySelectorAll(".mode-btn");
|
||||
const selectedModeBadge = $("selectedModeBadge");
|
||||
const instructionModeName = $("instructionModeName");
|
||||
const promptInput = $("promptInput");
|
||||
const resetPromptBtn = $("resetPromptBtn");
|
||||
const copyPromptBtn = $("copyPromptBtn");
|
||||
const clearPromptBtn = $("clearPromptBtn");
|
||||
const togglePromptSizeBtn = $("togglePromptSizeBtn");
|
||||
const togglePromptIcon = $("togglePromptIcon");
|
||||
const promptStatsBadge = $("promptStatsBadge");
|
||||
const directiveChips = document.querySelectorAll(".directive-chip");
|
||||
const saveSidecarCb = $("saveSidecarCb");
|
||||
const skipExistingCb = $("skipExistingCb");
|
||||
const accordionToggle = $("accordionToggle");
|
||||
@@ -663,21 +670,104 @@
|
||||
});
|
||||
|
||||
// ── Mode & Parameter Tuning ──
|
||||
function updatePromptStats() {
|
||||
if (!promptStatsBadge || !promptInput) return;
|
||||
const text = promptInput.value || "";
|
||||
const charCount = text.length;
|
||||
// Approximation: ~4 characters per token
|
||||
const tokenEst = Math.ceil(charCount / 4);
|
||||
promptStatsBadge.textContent = `${charCount.toLocaleString()} chars • ~${tokenEst.toLocaleString()} tokens`;
|
||||
}
|
||||
|
||||
function setMode(modeKey) {
|
||||
state.selectedMode = modeKey;
|
||||
modeBtns.forEach((btn) => btn.classList.toggle("active", btn.dataset.mode === modeKey));
|
||||
|
||||
const meta = PRESET_METAS[modeKey];
|
||||
if (meta) selectedModeBadge.textContent = meta.title;
|
||||
if (PROMPT_PRESETS[modeKey]) promptInput.value = PROMPT_PRESETS[modeKey];
|
||||
if (meta) {
|
||||
if (selectedModeBadge) selectedModeBadge.textContent = meta.title;
|
||||
if (instructionModeName) instructionModeName.textContent = meta.title;
|
||||
}
|
||||
if (PROMPT_PRESETS[modeKey]) {
|
||||
promptInput.value = PROMPT_PRESETS[modeKey];
|
||||
}
|
||||
updatePromptStats();
|
||||
}
|
||||
|
||||
modeBtns.forEach((btn) => btn.addEventListener("click", () => setMode(btn.dataset.mode)));
|
||||
|
||||
resetPromptBtn.addEventListener("click", () => {
|
||||
promptInput.value = PROMPT_PRESETS[state.selectedMode] || "";
|
||||
showToast("Prompt reset to default", "info");
|
||||
});
|
||||
if (promptInput) {
|
||||
promptInput.addEventListener("input", updatePromptStats);
|
||||
}
|
||||
|
||||
if (resetPromptBtn) {
|
||||
resetPromptBtn.addEventListener("click", () => {
|
||||
promptInput.value = PROMPT_PRESETS[state.selectedMode] || "";
|
||||
updatePromptStats();
|
||||
showToast("Prompt reset to default", "info");
|
||||
});
|
||||
}
|
||||
|
||||
if (copyPromptBtn) {
|
||||
copyPromptBtn.addEventListener("click", () => {
|
||||
const val = promptInput ? promptInput.value.trim() : "";
|
||||
if (!val) {
|
||||
showToast("Instruction box is empty", "warning");
|
||||
return;
|
||||
}
|
||||
navigator.clipboard.writeText(val).then(() => {
|
||||
showToast("Instruction copied to clipboard", "success");
|
||||
const origHtml = copyPromptBtn.innerHTML;
|
||||
copyPromptBtn.innerHTML = `<i class="fa-solid fa-check" style="color:var(--accent-green)"></i> <span>Copied!</span>`;
|
||||
setTimeout(() => {
|
||||
copyPromptBtn.innerHTML = origHtml;
|
||||
}, 1800);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (clearPromptBtn) {
|
||||
clearPromptBtn.addEventListener("click", () => {
|
||||
if (promptInput) {
|
||||
promptInput.value = "";
|
||||
promptInput.focus();
|
||||
updatePromptStats();
|
||||
showToast("Instruction cleared", "info");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (togglePromptSizeBtn && promptInput) {
|
||||
togglePromptSizeBtn.addEventListener("click", () => {
|
||||
promptInput.classList.toggle("expanded");
|
||||
const isExp = promptInput.classList.contains("expanded");
|
||||
if (togglePromptIcon) {
|
||||
togglePromptIcon.className = isExp
|
||||
? "fa-solid fa-down-left-and-up-right-to-center"
|
||||
: "fa-solid fa-up-right-and-down-left-from-center";
|
||||
}
|
||||
togglePromptSizeBtn.title = isExp ? "Compact editor height" : "Expand editor height";
|
||||
});
|
||||
}
|
||||
|
||||
if (directiveChips && directiveChips.length > 0) {
|
||||
directiveChips.forEach((chip) => {
|
||||
chip.addEventListener("click", () => {
|
||||
const directive = chip.dataset.directive;
|
||||
if (!directive || !promptInput) return;
|
||||
const current = promptInput.value.trim();
|
||||
if (!current) {
|
||||
promptInput.value = directive;
|
||||
} else if (!current.includes(directive)) {
|
||||
const sep = /[.?!]$/.test(current) ? " " : ". ";
|
||||
promptInput.value = current + sep + directive;
|
||||
}
|
||||
promptInput.focus();
|
||||
updatePromptStats();
|
||||
showToast("Modifier added to directives", "success");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
maxTokensRange.addEventListener("input", (e) => (maxTokensVal.textContent = e.target.value));
|
||||
tempRange.addEventListener("input", (e) => (tempVal.textContent = parseFloat(e.target.value).toFixed(2)));
|
||||
|
||||
@@ -268,15 +268,79 @@
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Prompt Instruction Box -->
|
||||
<div class="prompt-box-wrap">
|
||||
<label for="promptInput" class="field-label">
|
||||
<span>Model Instruction / Prompt</span>
|
||||
<button class="reset-prompt-btn" id="resetPromptBtn" title="Reset to mode default">
|
||||
<i class="fa-solid fa-rotate-left"></i> Reset
|
||||
</button>
|
||||
</label>
|
||||
<textarea id="promptInput" class="glass-textarea" rows="3" placeholder="Enter instructions or query for the Vision model..."></textarea>
|
||||
<!-- Refined Liquid Glass Model Instruction Console -->
|
||||
<div class="instruction-console" id="instructionConsole">
|
||||
<div class="instruction-console-header">
|
||||
<div class="instruction-header-left">
|
||||
<div class="instruction-icon-glow">
|
||||
<i class="fa-solid fa-terminal"></i>
|
||||
</div>
|
||||
<div class="instruction-title-group">
|
||||
<span class="instruction-title">Model Directives & Prompt</span>
|
||||
<span class="instruction-mode-badge" id="instructionModeTag">
|
||||
<i class="fa-solid fa-circle-dot"></i> <span id="instructionModeName">Prompt (Flux / MJ)</span>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="instruction-header-actions">
|
||||
<button type="button" class="console-action-btn" id="copyPromptBtn" title="Copy prompt to clipboard">
|
||||
<i class="fa-regular fa-copy"></i>
|
||||
<span>Copy</span>
|
||||
</button>
|
||||
<button type="button" class="console-action-btn" id="clearPromptBtn" title="Clear instructions">
|
||||
<i class="fa-solid fa-xmark"></i>
|
||||
<span>Clear</span>
|
||||
</button>
|
||||
<button type="button" class="console-action-btn console-action-reset" id="resetPromptBtn" title="Reset to preset default">
|
||||
<i class="fa-solid fa-rotate-left"></i>
|
||||
<span>Reset</span>
|
||||
</button>
|
||||
<button type="button" class="console-action-btn console-action-expand" id="togglePromptSizeBtn" title="Expand / Collapse editor height">
|
||||
<i class="fa-solid fa-up-right-and-down-left-from-center" id="togglePromptIcon"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="instruction-textarea-wrapper">
|
||||
<textarea id="promptInput" class="refined-prompt-textarea" rows="5" spellcheck="false" placeholder="Enter instructions, visual query, or formatting guidelines for the Vision model..."></textarea>
|
||||
</div>
|
||||
|
||||
<!-- Quick Directive Modifiers -->
|
||||
<div class="instruction-directives-bar">
|
||||
<div class="directives-bar-title">
|
||||
<i class="fa-solid fa-bolt"></i>
|
||||
<span>Modifiers:</span>
|
||||
</div>
|
||||
<div class="directive-chips-list">
|
||||
<button type="button" class="directive-chip" data-directive="Describe the lighting setup, color palette, highlights, and shadows in detail.">
|
||||
<i class="fa-solid fa-sun"></i> Lighting & Color
|
||||
</button>
|
||||
<button type="button" class="directive-chip" data-directive="Specify the camera angle, lens focal length, depth of field, and shot composition.">
|
||||
<i class="fa-solid fa-camera"></i> Camera & Framing
|
||||
</button>
|
||||
<button type="button" class="directive-chip" data-directive="Extract and transcribe all visible text verbatim, preserving line breaks.">
|
||||
<i class="fa-solid fa-file-lines"></i> Strict OCR
|
||||
</button>
|
||||
<button type="button" class="directive-chip" data-directive="Format as comma-separated descriptive Danbooru/LoRA training tags.">
|
||||
<i class="fa-solid fa-tags"></i> LoRA Tags
|
||||
</button>
|
||||
<button type="button" class="directive-chip" data-directive="Format the output strictly as a clean, valid JSON object.">
|
||||
<i class="fa-solid fa-code"></i> JSON Output
|
||||
</button>
|
||||
<button type="button" class="directive-chip" data-directive="Keep the response ultra-concise, strictly under 30 words.">
|
||||
<i class="fa-solid fa-compress"></i> Under 30 words
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="instruction-console-footer">
|
||||
<div class="console-footer-tip">
|
||||
<i class="fa-regular fa-lightbulb"></i> Custom edits apply across single & batch generation
|
||||
</div>
|
||||
<div class="console-footer-counter">
|
||||
<span class="char-token-pill" id="promptStatsBadge">0 chars • ~0 tokens</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Dataset / Batch Checkboxes -->
|
||||
|
||||
@@ -947,7 +947,306 @@ kbd {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
/* ── Instruction Textarea ── */
|
||||
/* ── Refined Liquid Glass Instruction Console ── */
|
||||
.instruction-console {
|
||||
background: linear-gradient(165deg, rgba(16, 21, 38, 0.7) 0%, rgba(8, 11, 22, 0.9) 100%);
|
||||
border: 1px solid rgba(255, 255, 255, 0.09);
|
||||
border-radius: 16px;
|
||||
padding: 16px 18px;
|
||||
margin-bottom: 20px;
|
||||
box-shadow: 0 12px 36px -8px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.08);
|
||||
backdrop-filter: blur(18px);
|
||||
transition: border-color 0.25s var(--ease-out), box-shadow 0.25s var(--ease-out);
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.instruction-console::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
right: 0;
|
||||
height: 1px;
|
||||
background: linear-gradient(90deg, transparent 0%, rgba(0, 229, 255, 0.45) 30%, rgba(124, 77, 255, 0.45) 70%, transparent 100%);
|
||||
opacity: 0.7;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
.instruction-console:focus-within {
|
||||
border-color: rgba(0, 229, 255, 0.4);
|
||||
box-shadow: 0 14px 40px -5px rgba(0, 0, 0, 0.65), 0 0 24px rgba(0, 229, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.12);
|
||||
}
|
||||
|
||||
.instruction-console-header {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 12px;
|
||||
margin-bottom: 12px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.instruction-header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
.instruction-icon-glow {
|
||||
width: 30px;
|
||||
height: 30px;
|
||||
border-radius: 8px;
|
||||
background: linear-gradient(135deg, rgba(0, 229, 255, 0.2), rgba(124, 77, 255, 0.15));
|
||||
border: 1px solid rgba(0, 229, 255, 0.35);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 13px;
|
||||
color: var(--accent);
|
||||
box-shadow: 0 0 14px rgba(0, 229, 255, 0.25);
|
||||
}
|
||||
|
||||
.instruction-title-group {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.instruction-title {
|
||||
font-size: 12.5px;
|
||||
font-weight: 700;
|
||||
letter-spacing: 0.04em;
|
||||
text-transform: uppercase;
|
||||
color: var(--text-primary);
|
||||
}
|
||||
|
||||
.instruction-mode-badge {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 3px 10px;
|
||||
border-radius: 12px;
|
||||
background: rgba(0, 229, 255, 0.09);
|
||||
border: 1px solid rgba(0, 229, 255, 0.24);
|
||||
font-size: 11px;
|
||||
font-weight: 600;
|
||||
color: var(--accent);
|
||||
box-shadow: 0 2px 8px rgba(0, 229, 255, 0.1);
|
||||
}
|
||||
|
||||
.instruction-mode-badge i {
|
||||
font-size: 7px;
|
||||
color: var(--accent-green);
|
||||
}
|
||||
|
||||
.instruction-header-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
}
|
||||
|
||||
.console-action-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 5px 11px;
|
||||
border-radius: 8px;
|
||||
background: rgba(255, 255, 255, 0.045);
|
||||
border: 1px solid rgba(255, 255, 255, 0.09);
|
||||
color: var(--text-secondary);
|
||||
font-size: 11.5px;
|
||||
font-weight: 500;
|
||||
cursor: pointer;
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.console-action-btn:hover {
|
||||
background: rgba(255, 255, 255, 0.09);
|
||||
border-color: rgba(255, 255, 255, 0.2);
|
||||
color: var(--text-primary);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.console-action-btn:active {
|
||||
transform: translateY(0);
|
||||
}
|
||||
|
||||
.console-action-reset:hover {
|
||||
color: var(--accent-amber);
|
||||
border-color: rgba(255, 171, 0, 0.35);
|
||||
background: rgba(255, 171, 0, 0.09);
|
||||
}
|
||||
|
||||
.console-action-expand:hover {
|
||||
color: var(--accent);
|
||||
border-color: rgba(0, 229, 255, 0.35);
|
||||
background: rgba(0, 229, 255, 0.08);
|
||||
}
|
||||
|
||||
.instruction-textarea-wrapper {
|
||||
position: relative;
|
||||
border-radius: 12px;
|
||||
background: rgba(4, 6, 12, 0.88);
|
||||
border: 1px solid rgba(255, 255, 255, 0.07);
|
||||
transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
.instruction-textarea-wrapper:focus-within {
|
||||
border-color: rgba(0, 229, 255, 0.45);
|
||||
background: rgba(3, 4, 10, 0.96);
|
||||
box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
|
||||
}
|
||||
|
||||
.refined-prompt-textarea {
|
||||
width: 100%;
|
||||
min-height: 140px;
|
||||
max-height: 480px;
|
||||
padding: 14px 16px;
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: none;
|
||||
color: #edf2f7;
|
||||
font-family: 'JetBrains Mono', 'Fira Code', 'Courier New', monospace;
|
||||
font-size: 13.5px;
|
||||
line-height: 1.62;
|
||||
letter-spacing: -0.01em;
|
||||
resize: vertical;
|
||||
transition: height 0.25s var(--ease-out);
|
||||
}
|
||||
|
||||
.refined-prompt-textarea.expanded {
|
||||
min-height: 260px;
|
||||
height: 290px;
|
||||
}
|
||||
|
||||
.refined-prompt-textarea::placeholder {
|
||||
color: var(--text-muted);
|
||||
font-family: var(--font-ui);
|
||||
font-size: 13px;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
/* ── Modifiers Directive Bar ── */
|
||||
.instruction-directives-bar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 8px;
|
||||
margin-top: 12px;
|
||||
padding-top: 10px;
|
||||
border-top: 1px dashed rgba(255, 255, 255, 0.07);
|
||||
overflow-x: auto;
|
||||
scrollbar-width: thin;
|
||||
scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
|
||||
}
|
||||
|
||||
.instruction-directives-bar::-webkit-scrollbar {
|
||||
height: 4px;
|
||||
}
|
||||
|
||||
.instruction-directives-bar::-webkit-scrollbar-thumb {
|
||||
background: rgba(255, 255, 255, 0.1);
|
||||
border-radius: 4px;
|
||||
}
|
||||
|
||||
.directives-bar-title {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
font-size: 11px;
|
||||
font-weight: 700;
|
||||
color: var(--accent-purple);
|
||||
text-transform: uppercase;
|
||||
letter-spacing: 0.05em;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.directives-bar-title i {
|
||||
color: var(--accent);
|
||||
font-size: 10px;
|
||||
}
|
||||
|
||||
.directive-chips-list {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 6px;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.directive-chip {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 4px 11px;
|
||||
border-radius: 20px;
|
||||
background: rgba(255, 255, 255, 0.038);
|
||||
border: 1px solid rgba(255, 255, 255, 0.08);
|
||||
color: var(--text-secondary);
|
||||
font-size: 11px;
|
||||
font-weight: 500;
|
||||
white-space: nowrap;
|
||||
cursor: pointer;
|
||||
transition: var(--transition);
|
||||
}
|
||||
|
||||
.directive-chip i {
|
||||
font-size: 10px;
|
||||
color: var(--text-tertiary);
|
||||
transition: color 0.2s;
|
||||
}
|
||||
|
||||
.directive-chip:hover {
|
||||
background: rgba(0, 229, 255, 0.12);
|
||||
border-color: rgba(0, 229, 255, 0.35);
|
||||
color: var(--text-primary);
|
||||
transform: translateY(-1px);
|
||||
}
|
||||
|
||||
.directive-chip:hover i {
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.directive-chip:active {
|
||||
transform: scale(0.97);
|
||||
}
|
||||
|
||||
/* ── Console Footer ── */
|
||||
.instruction-console-footer {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
margin-top: 10px;
|
||||
padding-top: 8px;
|
||||
font-size: 11.5px;
|
||||
}
|
||||
|
||||
.console-footer-tip {
|
||||
color: var(--text-tertiary);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.console-footer-tip i {
|
||||
color: var(--accent-amber);
|
||||
}
|
||||
|
||||
.char-token-pill {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
padding: 3px 9px;
|
||||
border-radius: 6px;
|
||||
background: rgba(0, 0, 0, 0.45);
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
color: var(--text-tertiary);
|
||||
font-family: var(--font-mono);
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
/* Fallback legacy classes */
|
||||
.prompt-box-wrap {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
||||
Reference in New Issue
Block a user