This commit is contained in:
Timothy Jaeryang Baek committed 2026-07-15 23:32:17 -04:00
1 parent f67252b5e8
commit 2712103c59
2 files changed
+27 -43

No files matched your search

+14 -30
View File
@@ -348,13 +348,9 @@ async def get_note_chat_by_id(
changed = True changed = True
system = ( system = (
f'CONTEXT: f'CONTEXT:\nCurrent note id: {note.id}\n'
Current note id: {note.id} 'This chat is attached to the current note.\n'
' 'For edit requests like make this concise, rewrite, enhance, shorten, or update: call view_note then replace_note_content.\n'
'This chat is attached to the current note.
'
'For edit requests like make this concise, rewrite, enhance, shorten, or update: call view_note then replace_note_content.
'
'Do not say an edit is done unless replace_note_content succeeds.' 'Do not say an edit is done unless replace_note_content succeeds.'
) )
if params.get('system') != system: if params.get('system') != system:
@@ -383,14 +379,10 @@ Current note id: {note.id}
'models': [''], 'models': [''],
'params': { 'params': {
'system': ( 'system': (
f'CONTEXT: f'CONTEXT:\nCurrent note id: {note.id}\n'
Current note id: {note.id} 'This chat is attached to the current note.\n'
' 'For edit requests like make this concise, rewrite, enhance, shorten, or update: call view_note then replace_note_content.\n'
'This chat is attached to the current note. 'Do not say an edit is done unless replace_note_content succeeds.'
'
'For edit requests like make this concise, rewrite, enhance, shorten, or update: call view_note then replace_note_content.
'
'Do not say an edit is done unless replace_note_content succeeds.'
) )
}, },
'history': {'messages': {}, 'currentId': None}, 'history': {'messages': {}, 'currentId': None},
@@ -451,13 +443,9 @@ async def get_note_chats_by_id(
changed = True changed = True
system = ( system = (
f'CONTEXT: f'CONTEXT:\nCurrent note id: {note.id}\n'
Current note id: {note.id} 'This chat is attached to the current note.\n'
' 'For edit requests like make this concise, rewrite, enhance, shorten, or update: call view_note then replace_note_content.\n'
'This chat is attached to the current note.
'
'For edit requests like make this concise, rewrite, enhance, shorten, or update: call view_note then replace_note_content.
'
'Do not say an edit is done unless replace_note_content succeeds.' 'Do not say an edit is done unless replace_note_content succeeds.'
) )
if params.get('system') != system: if params.get('system') != system:
@@ -518,14 +506,10 @@ async def create_note_chat_by_id(
'models': [''], 'models': [''],
'params': { 'params': {
'system': ( 'system': (
f'CONTEXT: f'CONTEXT:\nCurrent note id: {note.id}\n'
Current note id: {note.id} 'This chat is attached to the current note.\n'
' 'For edit requests like make this concise, rewrite, enhance, shorten, or update: call view_note then replace_note_content.\n'
'This chat is attached to the current note. 'Do not say an edit is done unless replace_note_content succeeds.'
'
'For edit requests like make this concise, rewrite, enhance, shorten, or update: call view_note then replace_note_content.
'
'Do not say an edit is done unless replace_note_content succeeds.'
) )
}, },
'history': {'messages': {}, 'currentId': None}, 'history': {'messages': {}, 'currentId': None},
+13 -13
View File
@@ -2708,13 +2708,13 @@
} }
history = history; history = history;
// Empty embedded drafts create their backing chat only when the first message is sent. // Empty embedded drafts create their backing chat only when the first message is sent.
if (!_chatId) { if (!_chatId) {
if (embedded && onCreateEmbeddedChat) { if (embedded && onCreateEmbeddedChat) {
const createdChat = await onCreateEmbeddedChat(); const createdChat = await onCreateEmbeddedChat();
if (!createdChat?.id) { if (!createdChat?.id) {
toast.error($i18n.t('Failed to create chat')); toast.error($i18n.t('Failed to create chat'));
return; return;
} }
chat = createdChat; chat = createdChat;
@@ -2723,12 +2723,12 @@
await chatId.set(_chatId); await chatId.set(_chatId);
await chatTitle.set(createdChat?.chat?.title ?? createdChat?.title ?? $i18n.t('Chat')); await chatTitle.set(createdChat?.chat?.title ?? createdChat?.title ?? $i18n.t('Chat'));
params = structuredClone(createdChat?.chat?.params ?? {}); params = structuredClone(createdChat?.chat?.params ?? {});
delete params.note_id; delete params.note_id;
chatFiles = mergeFiles(chatFiles, createdChat?.chat?.files ?? []); chatFiles = mergeFiles(chatFiles, createdChat?.chat?.files ?? []);
applyInitialFiles(); applyInitialFiles();
await onSelectEmbeddedChat?.(_chatId); await onSelectEmbeddedChat?.(_chatId);
} else if ($temporaryChatEnabled) { } else if ($temporaryChatEnabled) {
_chatId = `local:${$socket?.id}`; _chatId = `local:${$socket?.id}`;
await chatId.set(_chatId); await chatId.set(_chatId);
} }