From 5bcbb7810e55c4f4c486f8d3b14a579b14f0a690 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 16 Feb 2024 13:56:50 -0800 Subject: [PATCH] feat: stop continue regeneration --- src/lib/components/chat/Messages/ResponseMessage.svelte | 2 +- src/routes/(app)/+page.svelte | 3 +++ src/routes/(app)/c/[id]/+page.svelte | 5 ++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/lib/components/chat/Messages/ResponseMessage.svelte b/src/lib/components/chat/Messages/ResponseMessage.svelte index ab6f66a12..a0ffc83cf 100644 --- a/src/lib/components/chat/Messages/ResponseMessage.svelte +++ b/src/lib/components/chat/Messages/ResponseMessage.svelte @@ -65,7 +65,7 @@ await tick(); if (tooltipInstance) { - tooltipInstance[0].destroy(); + tooltipInstance[0]?.destroy(); } renderLatex(); diff --git a/src/routes/(app)/+page.svelte b/src/routes/(app)/+page.svelte index 0840300b8..604cb544d 100644 --- a/src/routes/(app)/+page.svelte +++ b/src/routes/(app)/+page.svelte @@ -709,6 +709,9 @@ if (messages.length != 0 && messages.at(-1).done == true) { const responseMessage = history.messages[history.currentId]; + responseMessage.done = false; + await tick(); + const modelTag = $models.filter((m) => m.name === responseMessage.model).at(0); if (modelTag?.external) { diff --git a/src/routes/(app)/c/[id]/+page.svelte b/src/routes/(app)/c/[id]/+page.svelte index a358e14cb..aab03d74f 100644 --- a/src/routes/(app)/c/[id]/+page.svelte +++ b/src/routes/(app)/c/[id]/+page.svelte @@ -18,7 +18,7 @@ } from '$lib/stores'; import { copyToClipboard, splitStream, convertMessagesToHistory } from '$lib/utils'; - import { generateChatCompletion, generateTitle } from '$lib/apis/ollama'; + import { generateChatCompletion, generateTitle, cancelChatCompletion } from '$lib/apis/ollama'; import { addTagById, createNewChat, @@ -711,6 +711,9 @@ if (messages.length != 0 && messages.at(-1).done == true) { const responseMessage = history.messages[history.currentId]; + responseMessage.done = false; + await tick(); + const modelTag = $models.filter((m) => m.name === responseMessage.model).at(0); if (modelTag?.external) {