diff --git a/src/lib/components/chat/Messages.svelte b/src/lib/components/chat/Messages.svelte index 2a388fd2..9f7fb7f6 100644 --- a/src/lib/components/chat/Messages.svelte +++ b/src/lib/components/chat/Messages.svelte @@ -10,11 +10,13 @@ import UserMessage from './Messages/UserMessage.svelte'; import ResponseMessage from './Messages/ResponseMessage.svelte'; import Placeholder from './Messages/Placeholder.svelte'; + import Spinner from '../common/Spinner.svelte'; export let chatId = ''; export let sendPrompt: Function; export let regenerateResponse: Function; + export let processing = ''; export let bottomPadding = false; export let autoScroll; export let selectedModels; @@ -218,7 +220,7 @@ {#key chatId} {#each messages as message, messageIdx}
-
+
{#if message.role === 'user'} + + {#if processing !== ''} +
+
+ +
+
+ {processing} +
+
+ {/if} {:else} 0) { + processing = 'Reading'; const query = history.messages[parentId].content; let relevantContexts = await Promise.all( @@ -215,6 +217,7 @@ history.messages[parentId].raContent = RAGTemplate(contextString, query); history.messages[parentId].contexts = relevantContexts; await tick(); + processing = ''; } await Promise.all( @@ -660,6 +663,7 @@ chatId={$chatId} {selectedModels} {selectedModelfiles} + {processing} bind:history bind:messages bind:autoScroll diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index c2677083..4305882f 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -21,8 +21,10 @@ import { RAGTemplate } from '$lib/utils/rag'; let loaded = false; + let stopResponseFlag = false; let autoScroll = true; + let processing = ''; // let chatId = $page.params.id; let selectedModels = ['']; @@ -210,6 +212,7 @@ console.log(docs); if (docs.length > 0) { + processing = 'Reading'; const query = history.messages[parentId].content; let relevantContexts = await Promise.all( @@ -233,6 +236,7 @@ history.messages[parentId].raContent = RAGTemplate(contextString, query); history.messages[parentId].contexts = relevantContexts; await tick(); + processing = ''; } await Promise.all( @@ -685,6 +689,7 @@ chatId={$chatId} {selectedModels} {selectedModelfiles} + {processing} bind:history bind:messages bind:autoScroll