diff options
Diffstat (limited to 'modules/core/module-aiassist.js')
| -rw-r--r-- | modules/core/module-aiassist.js | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/modules/core/module-aiassist.js b/modules/core/module-aiassist.js index cefff5d..c3ebe1f 100644 --- a/modules/core/module-aiassist.js +++ b/modules/core/module-aiassist.js @@ -2711,8 +2711,9 @@ buildSystemPrompt() { // runs every 30 s and advances the shared cursor, so a read that used it // returned nothing — the answer was printed for the human and the model // never saw it. Two readers, two cursors. First read is from 0. + const acKey = 'webx11_chat_agent_cursor_' + (st.thread || 'new'); let ac = 0; - try { ac = parseInt(localStorage.getItem('webx11_chat_agent_cursor') || '0', 10) || 0; } catch (e) { ac = 0; } + try { ac = parseInt(localStorage.getItem(acKey) || '0', 10) || 0; } catch (e) { ac = 0; } const resp = await fetch( '/spaces/newos4/api/chat/poll.php' + (ac ? '?since=' + ac : ''), { headers: { 'X-Chat-Token': st.token } }); @@ -2720,7 +2721,7 @@ buildSystemPrompt() { if (!resp.ok || !j || !j.success) { return JSON.stringify({ error: (j && j.error) || ('HTTP ' + resp.status) }); } - if (j.cursor) { try { localStorage.setItem('webx11_chat_agent_cursor', String(j.cursor)); } catch (e) {} } + if (j.cursor) { try { localStorage.setItem(acKey, String(j.cursor)); } catch (e) {} } const msgs = (j.messages || []).slice(-10).map(m => ({ author: m.author, ts: m.ts, text: m.text })); |