diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 3280e75477..fd7b5e397e 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -123,7 +123,7 @@ export let embeddedTitle = ''; export let embeddedChats = []; export let embeddedDraftKey = ''; - export let initialFiles = []; + export let suggestedPrompts = []; export let selectedText = ''; export let onInsertToNote: ((content: string) => void) | null = null; export let onCloseEmbedded: (() => void) | null = null; @@ -137,12 +137,6 @@ let loading = true; $: chatContainerId = embedded ? 'note-chat-container' : 'chat-container'; $: messageInputDropzoneId = embedded ? 'note-chat-input-dropzone' : 'chat-pane'; - const embeddedSuggestedPrompts = [ - 'Enhance this note and update it.', - 'Summarize this note.', - 'Extract action items from this note.', - 'Rewrite the selected text.' - ]; const eventTarget = new EventTarget(); let controlPane: Pane | undefined; @@ -369,7 +363,6 @@ let chatFiles = []; let files = []; let params = {}; - let attachedFilesKey = ''; let loadedChatIdProp = ''; let currentDraftKey = ''; @@ -382,18 +375,6 @@ return true; }); }; - const applyInitialFiles = () => { - if (!embedded || !initialFiles?.length) return; - - const key = JSON.stringify( - initialFiles.map((file) => `${file?.type ?? ''}:${file?.id ?? file?.url ?? file?.name ?? ''}`) - ); - if (key === attachedFilesKey) return; - - files = mergeFiles(files, initialFiles); - chatFiles = mergeFiles(chatFiles, initialFiles); - attachedFilesKey = key; - }; const withSelectedText = (text: string) => embedded && selectedText?.trim() ? `${text}\n\nSelected note text for replace_note_content operations:\n${selectedText.trim()}` @@ -408,10 +389,6 @@ }); }; - $: if (embedded && !loading) { - applyInitialFiles(); - } - $: if (chatIdProp && chatIdProp !== loadedChatIdProp) { noteChatDebug('chatIdProp changed; loading linked chat', { previousChatIdProp: loadedChatIdProp @@ -549,7 +526,6 @@ await setDefaults(); loading = false; await tick(); - applyInitialFiles(); document.getElementById('chat-input')?.focus(); }; @@ -2727,7 +2703,6 @@ 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}`; @@ -3846,27 +3821,29 @@ {/if} {:else if embedded}