Self-hosted AI workspace.
Python
fix(session): restore session URL hash writes (removed in cf4e240a) (#5872)
Samyf06a0a30a80e
diff --git a/static/app.js b/static/app.jsindex c9e3a567f..9d05d8991 100644--- a/static/app.js+++ b/static/app.js@@ -10,14 +10,14 @@ import modelsModule from './js/models.js?v=20260715startupcalm2';import ragModule from './js/rag.js';import presetsModule from './js/presets.js';import searchModule from './js/search.js';-import chatModule from './js/chat.js?v=20260722ctxheader4';+import chatModule from './js/chat.js?v=20260801fix1';import compareModule from './js/compare/index.js?v=20260723compareicon2';import documentModule from './js/document.js?v=20260722emailfastindex1';import searchChatModule from './js/search-chat.js';import { makeWindowDraggable } from './js/windowDrag.js';import markdownModule from './js/markdown.js';import chatRenderer from './js/chatRenderer.js?v=20260722emailfastindex1';-import sessionModule from './js/sessions.js?v=20260722ctxheader4';+import sessionModule from './js/sessions.js';import memoryModule from './js/memory.js?v=20260722memoryloading1';import voiceRecorderModule from './js/voiceRecorder.js';import censorModule from './js/censor.js';diff --git a/static/index.html b/static/index.htmlindex 0136f2316..0fea836ba 100644--- a/static/index.html+++ b/static/index.html@@ -250,9 +250,9 @@</script><link rel="stylesheet" href="/static/style.css?v=20260723tasksbulkfeedback1"><link rel="modulepreload" href="/static/app.js?v=20260723tasksbulkfeedback1">- <link rel="modulepreload" href="/static/js/chat.js?v=20260722ctxheader4">+ <link rel="modulepreload" href="/static/js/chat.js?v=20260801fix1"><link rel="modulepreload" href="/static/js/ui.js">- <link rel="modulepreload" href="/static/js/sessions.js?v=20260722ctxheader4">+ <link rel="modulepreload" href="/static/js/sessions.js"><link rel="modulepreload" href="/static/js/markdown.js"></head><body>@@ -2504,7 +2504,7 @@<script type="module" src="/static/js/ui.js"></script><script type="module" src="/static/js/markdown.js"></script><script type="module" src="/static/js/dragSort.js"></script>-<script type="module" src="/static/js/sessions.js?v=20260722ctxheader4"></script>+<script type="module" src="/static/js/sessions.js"></script><script type="module" src="/static/js/memory.js?v=20260722memoryloading1"></script><script type="module" src="/static/js/skills.js"></script><script type="module" src="/static/js/tourHints.js"></script>@@ -2522,7 +2522,7 @@<script type="module" src="/static/js/chatRenderer.js?v=20260722emailfastindex1"></script><script type="module" src="/static/js/codeRunner.js"></script><script type="module" src="/static/js/chatStream.js?v=20260722emailfastindex1"></script>- <script type="module" src="/static/js/chat.js?v=20260722ctxheader4"></script>+ <script type="module" src="/static/js/chat.js?v=20260801fix1"></script><script type="module" src="/static/js/cookbook.js"></script><script src="/static/js/cookbookSchedule.js"></script><script type="module" src="/static/js/search-chat.js"></script>diff --git a/static/js/chat.js b/static/js/chat.jsindex ca583c5fc..3c8bbe850 100644--- a/static/js/chat.js+++ b/static/js/chat.js@@ -349,6 +349,9 @@ import { wireArrowUpRecall, getUserMessagesFromChatHistory } from './composerArrasync function _adoptOpenedSessionBeforeAutoCreate() {if (!sessionModule || !sessionModule.getCurrentSessionId || sessionModule.getCurrentSessionId()) return true;+ // Don't adopt a stale session when the user explicitly started a New Chat+ // (pending state set) — the send path must materialize the pending session.+ if (sessionModule.hasPendingChat && sessionModule.hasPendingChat()) return false;const activeRowId = document.querySelector('.list-item.active-session[data-session-id], .session-item.active[data-session-id]')?.dataset?.sessionId || '';const hashId = _hashSessionCandidate();const lastSelectedId = String(window.__odysseusLastSelectedSessionId || '').trim();@@ -1403,6 +1406,8 @@ import { wireArrowUpRecall, getUserMessagesFromChatHistory } from './composerArrcurrentAccumulated = '';currentHolder = null;+ let abortCtrl = null;+ let streamingTTS = false;try {// Re-enable auto-scroll when user sends a messageuiModule.setAutoScroll(true);@@ -1716,7 +1721,7 @@ import { wireArrowUpRecall, getUserMessagesFromChatHistory } from './composerArr}- const abortCtrl = new AbortController();+ abortCtrl = new AbortController();abortCtrl._reason = '';currentAbort = abortCtrl;@@ -1897,7 +1902,7 @@ import { wireArrowUpRecall, getUserMessagesFromChatHistory } from './composerArrlet isThinking = false;let thinkingStartTime = null;// Streaming TTS: synthesize sentence-by-sentence during streaming- const streamingTTS = !!(window.aiTTSManager && window.aiTTSManager.autoPlay && window.aiTTSManager.available);+ streamingTTS = !!(window.aiTTSManager && window.aiTTSManager.autoPlay && window.aiTTSManager.available);if (streamingTTS) window.aiTTSManager.streamingStart();// Multi-bubble agent trackinglet roundHolder = holder; // Current AI text bubble (changes per round)diff --git a/static/js/sessions.js b/static/js/sessions.jsindex cf59d478c..edf83c8a4 100644--- a/static/js/sessions.js+++ b/static/js/sessions.js@@ -1847,6 +1847,10 @@ export async function selectSession(id, { keepSidebar = false, showLoading = truconst _isTransientChat = !!_meta && (_meta.folder === 'Assistant' || _meta.folder === 'Tasks');if (!_isTransientChat) {Storage.set('lastSessionId', id);+ // Update URL hash without triggering hashchange handler+ if (window.location.hash !== '#' + id) {+ history.replaceState(null, '', '#' + id);+ }}// Restore character preset for persistent chatstry {@@ -2313,6 +2317,7 @@ export async function materializePendingSession() {currentSessionId = payload.id;if (!isIncognito) {Storage.set('lastSessionId', payload.id);+ history.replaceState(null, '', '#' + payload.id);}// Reload the sidebar in the background. Awaiting this used to block the first