diff --git a/web/image-to-text/app.js b/web/image-to-text/app.js
index 739c258..4953cf5 100644
--- a/web/image-to-text/app.js
+++ b/web/image-to-text/app.js
@@ -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 = ` Copied!`;
+ 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)));
diff --git a/web/image-to-text/index.html b/web/image-to-text/index.html
index b0dfc4d..9546236 100644
--- a/web/image-to-text/index.html
+++ b/web/image-to-text/index.html
@@ -268,15 +268,79 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+ Modifiers:
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/web/image-to-text/styles.css b/web/image-to-text/styles.css
index 1e19c73..038ed66 100644
--- a/web/image-to-text/styles.css
+++ b/web/image-to-text/styles.css
@@ -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;