From aa82e381d11703bf2bc1f8aa8bff18c3aca3aa72 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Sun, 7 Jan 2024 02:14:17 -0800 Subject: [PATCH] feat: include files from previous prompts --- src/routes/(app)/+page.svelte | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index 193d6d147..9b05c6404 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -185,10 +185,10 @@ const sendPrompt = async (prompt, parentId) => { const _chatId = JSON.parse(JSON.stringify($chatId)); - // TODO: update below to include all ancestral files - - console.log(history.messages[parentId]); - const docs = history.messages[parentId]?.files?.filter((item) => item.type === 'doc') ?? []; + const docs = messages + .filter((message) => message?.files ?? null) + .map((message) => message.files.filter((item) => item.type === 'doc')) + .flat(1); console.log(docs); if (docs.length > 0) {