diff --git a/src/lib/components/chat/Messages/UserMessage.svelte b/src/lib/components/chat/Messages/UserMessage.svelte index f8746e1f2..d46043189 100644 --- a/src/lib/components/chat/Messages/UserMessage.svelte +++ b/src/lib/components/chat/Messages/UserMessage.svelte @@ -159,6 +159,38 @@
{$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 ee06b97b9..e85b6ee80 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -334,7 +334,7 @@ parentMessage.files.push({ collection_name: searchDocument!.collection_name, name: searchQuery, - type: 'doc', + type: 'websearch', upload_status: true, error: '' }); @@ -401,7 +401,7 @@ const docs = messages .filter((message) => message?.files ?? null) .map((message) => - message.files.filter((item) => item.type === 'doc' || item.type === 'collection') + message.files.filter((item) => ['doc', 'collection', 'websearch'].includes(item.type)) ) .flat(1); @@ -594,7 +594,7 @@ const docs = messages .filter((message) => message?.files ?? null) .map((message) => - message.files.filter((item) => item.type === 'doc' || item.type === 'collection') + message.files.filter((item) => ['doc', 'collection', 'websearch'].includes(item.type)) ) .flat(1); diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index 17a830741..c88b627a08 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -30,7 +30,11 @@ getTagsById, updateChatById } from '$lib/apis/chats'; - import { generateOpenAIChatCompletion, generateSearchQuery, generateTitle } from '$lib/apis/openai'; + import { + generateOpenAIChatCompletion, + generateSearchQuery, + generateTitle + } from '$lib/apis/openai'; import MessageInput from '$lib/components/chat/MessageInput.svelte'; import Messages from '$lib/components/chat/Messages.svelte'; @@ -321,10 +325,7 @@ } responseMessage.progress = $i18n.t("Searching the web for '{{searchQuery}}'", { searchQuery }); messages = messages; - const searchDocument = await runWebSearch( - localStorage.token, - searchQuery, - ); + const searchDocument = await runWebSearch(localStorage.token, searchQuery); if (!searchDocument) { toast.warning($i18n.t('No search results found')); responseMessage.progress = undefined; @@ -338,7 +339,7 @@ parentMessage.files.push({ collection_name: searchDocument!.collection_name, name: searchQuery, - type: 'doc', + type: 'websearch', upload_status: true, error: '' }); @@ -405,7 +406,7 @@ const docs = messages .filter((message) => message?.files ?? null) .map((message) => - message.files.filter((item) => item.type === 'doc' || item.type === 'collection') + message.files.filter((item) => ['doc', 'collection', 'websearch'].includes(item.type)) ) .flat(1); @@ -598,7 +599,7 @@ const docs = messages .filter((message) => message?.files ?? null) .map((message) => - message.files.filter((item) => item.type === 'doc' || item.type === 'collection') + message.files.filter((item) => ['doc', 'collection', 'websearch'].includes(item.type)) ) .flat(1);