This commit is contained in:
Timothy Jaeryang Baek
2026-07-15 23:32:17 -04:00
parent f67252b5e8
commit 2712103c59
2 changed files with 27 additions and 43 deletions
+13 -13
View File
@@ -2708,13 +2708,13 @@
}
history = history;
// Empty embedded drafts create their backing chat only when the first message is sent.
if (!_chatId) {
if (embedded && onCreateEmbeddedChat) {
const createdChat = await onCreateEmbeddedChat();
if (!createdChat?.id) {
toast.error($i18n.t('Failed to create chat'));
return;
// Empty embedded drafts create their backing chat only when the first message is sent.
if (!_chatId) {
if (embedded && onCreateEmbeddedChat) {
const createdChat = await onCreateEmbeddedChat();
if (!createdChat?.id) {
toast.error($i18n.t('Failed to create chat'));
return;
}
chat = createdChat;
@@ -2723,12 +2723,12 @@
await chatId.set(_chatId);
await chatTitle.set(createdChat?.chat?.title ?? createdChat?.title ?? $i18n.t('Chat'));
params = structuredClone(createdChat?.chat?.params ?? {});
delete params.note_id;
chatFiles = mergeFiles(chatFiles, createdChat?.chat?.files ?? []);
applyInitialFiles();
await onSelectEmbeddedChat?.(_chatId);
} else if ($temporaryChatEnabled) {
params = structuredClone(createdChat?.chat?.params ?? {});
delete params.note_id;
chatFiles = mergeFiles(chatFiles, createdChat?.chat?.files ?? []);
applyInitialFiles();
await onSelectEmbeddedChat?.(_chatId);
} else if ($temporaryChatEnabled) {
_chatId = `local:${$socket?.id}`;
await chatId.set(_chatId);
}