diff --git a/app.py b/app.py index e8d8e407..2a8297ca 100644 --- a/app.py +++ b/app.py @@ -54,6 +54,7 @@ "channels": ["general"], "history_limit": "all", "contrast": "normal", + "show_msg_numbers": False, "custom_roles": [], } @@ -1251,6 +1252,8 @@ async def websocket_endpoint(websocket: WebSocket): pass if "contrast" in new and new["contrast"] in ("normal", "high"): room_settings["contrast"] = new["contrast"] + if "show_msg_numbers" in new: + room_settings["show_msg_numbers"] = bool(new["show_msg_numbers"]) if "rules_refresh_interval" in new: try: ri = int(new["rules_refresh_interval"]) diff --git a/static/chat.js b/static/chat.js index 94c5c373..b47342b5 100644 --- a/static/chat.js +++ b/static/chat.js @@ -810,7 +810,7 @@ function appendMessage(msg) { ).join('') + ''; } } - el.innerHTML = `
${isSelf ? '' : avatarHtml}
${replyHtml}
${escapeHtml(msg.sender)}${rolePillHtml}${msg.time || ''}
${textHtml}
${choicesHtml}${attachmentsHtml}
`; + el.innerHTML = `
${isSelf ? '' : avatarHtml}
${replyHtml}
${escapeHtml(msg.sender)}${rolePillHtml}${msg.time || ''}#${msg.id}
${textHtml}
${choicesHtml}${attachmentsHtml}
`; if (todoStatus) el.classList.add('msg-todo', `msg-todo-${todoStatus}`); if (msg.metadata?.session_output) el.classList.add('session-output'); @@ -1754,6 +1754,10 @@ function applySettings(data) { document.body.classList.toggle('high-contrast', data.contrast === 'high'); document.getElementById('setting-contrast').value = data.contrast; } + if (data.show_msg_numbers !== undefined) { + document.body.classList.toggle('show-msg-numbers', !!data.show_msg_numbers); + document.getElementById('setting-msg-numbers').value = data.show_msg_numbers ? 'show' : 'hide'; + } if (data.rules_refresh_interval !== undefined) { document.getElementById('setting-rules-refresh').value = String(data.rules_refresh_interval); } @@ -1862,6 +1866,7 @@ function saveSettings() { const histVal = document.getElementById('setting-history').value; const newHistory = histVal === 'all' ? 'all' : (parseInt(histVal) || 50); const newContrast = document.getElementById('setting-contrast').value; + const newMsgNumbers = document.getElementById('setting-msg-numbers').value === 'show'; const newRulesRefresh = document.getElementById('setting-rules-refresh').value; if (ws && ws.readyState === WebSocket.OPEN) { @@ -1873,6 +1878,7 @@ function saveSettings() { max_agent_hops: parseInt(newHops) || 4, history_limit: newHistory, contrast: newContrast, + show_msg_numbers: newMsgNumbers, rules_refresh_interval: parseInt(newRulesRefresh) || 0, } })); @@ -1896,13 +1902,17 @@ function setupSettingsKeys() { } // Auto-save on change for selects, escape to close - for (const id of ['setting-font', 'setting-history', 'setting-contrast', 'setting-rules-refresh']) { + for (const id of ['setting-font', 'setting-history', 'setting-contrast', 'setting-msg-numbers', 'setting-rules-refresh']) { const el = document.getElementById(id); el.addEventListener('change', () => { // Apply contrast immediately (don't wait for server round-trip) if (id === 'setting-contrast') { document.body.classList.toggle('high-contrast', el.value === 'high'); } + // Apply msg-numbers immediately too + if (id === 'setting-msg-numbers') { + document.body.classList.toggle('show-msg-numbers', el.value === 'show'); + } saveSettings(); }); el.addEventListener('keydown', (e) => { diff --git a/static/index.html b/static/index.html index 955feb87..2dea2fbc 100644 --- a/static/index.html +++ b/static/index.html @@ -98,6 +98,13 @@

agentchattr

+
+ + +