diff --git a/bot/static/js/status.js b/bot/static/js/status.js index 13258fa..0b33550 100644 --- a/bot/static/js/status.js +++ b/bot/static/js/status.js @@ -162,6 +162,14 @@ function renderPromptEntry(entry) { // Parse full_prompt into sections const sections = parsePromptSections(entry.full_prompt || ''); + // Snapshot which subsections are currently collapsed (before re-render) + const sectionIds = ['system', 'context', 'conversation', 'response']; + const collapsedState = {}; + sectionIds.forEach(id => { + const el = document.getElementById(`prompt-section-${id}`); + collapsedState[id] = el && el.classList.contains('collapsed'); + }); + // Build display HTML with collapsible subsections let displayHtml = ''; @@ -192,6 +200,16 @@ function renderPromptEntry(entry) { const displayEl = document.getElementById('prompt-display'); displayEl.innerHTML = displayHtml; + // Restore collapsed state from snapshot + sectionIds.forEach(id => { + const el = document.getElementById(`prompt-section-${id}`); + if (el && collapsedState[id]) { + el.classList.add('collapsed'); + const header = el.previousElementSibling; + if (header) header.innerHTML = header.innerHTML.replace('▼', '▶'); + } + }); + // Also set the raw text into the
 for copy functionality
   let rawText = entry.full_prompt || '';
   if (entry.response) {
@@ -244,12 +262,12 @@ function parsePromptSections(fullPrompt) {
 }
 
 function buildCollapsibleSection(title, content, sectionId) {
-  const uniqueId = `prompt-section-${sectionId}-${Date.now()}`;
+  const id = `prompt-section-${sectionId}`;
   return `
-    
+
▼ ${escapeHtml(title)}
-
+
${escapeHtml(content)}
`; }