From 2d0e55e8f6c8b3567fcbffa44a52e255e71719bb Mon Sep 17 00:00:00 2001 From: Timothy Jaeryang Baek Date: Mon, 7 Jul 2025 21:52:46 +0400 Subject: [PATCH] refac --- .../components/notes/NoteEditor/Chat.svelte | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/lib/components/notes/NoteEditor/Chat.svelte b/src/lib/components/notes/NoteEditor/Chat.svelte index 6afaacfc78..a248ce2d9b 100644 --- a/src/lib/components/notes/NoteEditor/Chat.svelte +++ b/src/lib/components/notes/NoteEditor/Chat.svelte @@ -98,16 +98,20 @@ ...messages ].filter((message) => message), files: [ - { - id: `note:${note?.id ?? 'note'}`, - name: note?.name ?? 'Note', - file: { - data: { - content: note?.data?.content?.md ?? '' - } - }, - context: 'full' - }, // Include the note content as a file + ...(note?.data?.content?.md + ? [ + { + id: `note:${note?.id ?? 'note'}`, + name: note?.name ?? 'Note', + file: { + data: { + content: note?.data?.content?.md + } + }, + context: 'full' + } + ] + : []), // Include the note content as a file ...files ] },