From d0662e251802e8e1422cf79f5615c39f42bb0950 Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Wed, 23 Oct 2024 20:33:08 -0700 Subject: [PATCH] refac: do not use arena model for tasks --- src/lib/components/chat/Chat.svelte | 40 ++++++++++++++++------------- 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/src/lib/components/chat/Chat.svelte b/src/lib/components/chat/Chat.svelte index 8940b5613..3158ccf88 100644 --- a/src/lib/components/chat/Chat.svelte +++ b/src/lib/components/chat/Chat.svelte @@ -1902,15 +1902,17 @@ const generateChatTitle = async (messages) => { if ($settings?.title?.auto ?? true) { - const title = await generateTitle( - localStorage.token, - selectedModels[0], - messages, - $chatId - ).catch((error) => { - console.error(error); - return 'New Chat'; - }); + const lastMessage = messages.at(-1); + const modelId = lastMessage + ? (lastMessage?.selectedModelId ?? lastMessage?.model) + : selectedModels[0]; + + const title = await generateTitle(localStorage.token, modelId, messages, $chatId).catch( + (error) => { + console.error(error); + return 'New Chat'; + } + ); return title; } else { @@ -1941,15 +1943,17 @@ } } - let generatedTags = await generateTags( - localStorage.token, - selectedModels[0], - messages, - $chatId - ).catch((error) => { - console.error(error); - return []; - }); + const lastMessage = messages.at(-1); + const modelId = lastMessage + ? (lastMessage?.selectedModelId ?? lastMessage?.model) + : selectedModels[0]; + + let generatedTags = await generateTags(localStorage.token, modelId, messages, $chatId).catch( + (error) => { + console.error(error); + return []; + } + ); generatedTags = generatedTags.filter( (tag) => !currentTags.find((t) => t.id === tag.replaceAll(' ', '_').toLowerCase())