mirror of
https://github.com/pewdiepie-archdaemon/odysseus.git
synced 2026-07-12 12:37:32 +00:00
Keep open editor drafts in chat context
This commit is contained in:
+7
-4
@@ -780,7 +780,10 @@ import { wireArrowUpRecall, getLastUserMessageFromChatHistory } from './composer
|
||||
}
|
||||
|
||||
// Auto-save document editor content before sending so the AI sees latest text
|
||||
if (documentModule && documentModule.isPanelOpen() && documentModule.getCurrentDocId()) {
|
||||
const activeDocIdForSend = documentModule && typeof documentModule.getCurrentDocId === 'function'
|
||||
? documentModule.getCurrentDocId()
|
||||
: null;
|
||||
if (documentModule && activeDocIdForSend) {
|
||||
try { await documentModule.saveDocument(); } catch(e) { console.warn('doc auto-save failed', e); }
|
||||
}
|
||||
|
||||
@@ -812,9 +815,9 @@ import { wireArrowUpRecall, getLastUserMessageFromChatHistory } from './composer
|
||||
fd.append('session', streamSessionId);
|
||||
if (ids.length) fd.append('attachments', JSON.stringify(ids));
|
||||
// Auto-save & send active doc ID so the backend sees latest content
|
||||
if (documentModule && documentModule.isPanelOpen() && documentModule.getCurrentDocId()) {
|
||||
if (documentModule && activeDocIdForSend) {
|
||||
try { await documentModule.saveDocument({ silent: true }); } catch (_e) { /* best-effort */ }
|
||||
fd.append('active_doc_id', documentModule.getCurrentDocId());
|
||||
fd.append('active_doc_id', activeDocIdForSend);
|
||||
}
|
||||
// Active email context — when an email reader is open, pass its
|
||||
// uid/folder/account so "reply", "summarize", "what does this say"
|
||||
@@ -836,7 +839,7 @@ import { wireArrowUpRecall, getLastUserMessageFromChatHistory } from './composer
|
||||
const isIncognito = !!(incognitoChk && incognitoChk.checked);
|
||||
// Auto-escalate to agent mode when a document is open — the user expects
|
||||
// the AI to see the document and have tools to edit it
|
||||
if (!isIncognito && !isAgentMode && documentModule && documentModule.isPanelOpen() && documentModule.getCurrentDocId()) {
|
||||
if (!isIncognito && !isAgentMode && documentModule && activeDocIdForSend) {
|
||||
isAgentMode = true;
|
||||
}
|
||||
if (isIncognito) isAgentMode = false;
|
||||
|
||||
Reference in New Issue
Block a user