From b95027f182f26079dadaba9295138cc9f9ec9376 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Thu, 16 May 2024 11:47:53 +0800 Subject: [PATCH] feat: add searched urls to document --- .../chat/Messages/UserMessage.svelte | 32 ------------------- src/routes/(app)/+page.svelte | 7 ++-- src/routes/(app)/c/[id]/+page.svelte | 7 ++-- 3 files changed, 8 insertions(+), 38 deletions(-) diff --git a/src/lib/components/chat/Messages/UserMessage.svelte b/src/lib/components/chat/Messages/UserMessage.svelte index af902c908..681086ff1 100644 --- a/src/lib/components/chat/Messages/UserMessage.svelte +++ b/src/lib/components/chat/Messages/UserMessage.svelte @@ -165,38 +165,6 @@
{$i18n.t('Collection')}
- {:else if file.type === 'websearch'} - {/if} {/each} diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index df43fcb5c..7c607902d 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -321,7 +321,7 @@ responseMessage.progress = $i18n.t("Searching the web for '{{searchQuery}}'", { searchQuery }); messages = messages; const searchDocument = await runWebSearch(localStorage.token, searchQuery); - if (!searchDocument) { + if (searchDocument === undefined) { toast.warning($i18n.t('No search results found')); responseMessage.progress = undefined; messages = messages; @@ -331,11 +331,12 @@ responseMessage.files = []; } responseMessage.files.push({ - collection_name: searchDocument!.collection_name, + collection_name: searchDocument.collection_name, name: searchQuery, type: 'websearch', upload_status: true, - error: '' + error: '', + urls: searchDocument.filenames, }); responseMessage.progress = undefined; messages = messages; diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index f86aaa0c3..eb48157e7 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -326,7 +326,7 @@ responseMessage.progress = $i18n.t("Searching the web for '{{searchQuery}}'", { searchQuery }); messages = messages; const searchDocument = await runWebSearch(localStorage.token, searchQuery); - if (!searchDocument) { + if (searchDocument === undefined) { toast.warning($i18n.t('No search results found')); responseMessage.progress = undefined; messages = messages; @@ -336,11 +336,12 @@ responseMessage.files = []; } responseMessage.files.push({ - collection_name: searchDocument!.collection_name, + collection_name: searchDocument.collection_name, name: searchQuery, type: 'websearch', upload_status: true, - error: '' + error: '', + urls: searchDocument.filenames, }); responseMessage.progress = undefined; messages = messages;