Timothy Jaeryang Baek 3 months ago
parent
commit
2d0e55e8f6
1 changed files with 14 additions and 10 deletions
  1. 14 10
      src/lib/components/notes/NoteEditor/Chat.svelte

+ 14 - 10
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
 				]
 			},