From 7a8a8fd64eca73c65bb3f1695fcc4aaa8f83cec6 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Thu, 25 Jan 2024 15:35:43 +0800 Subject: [PATCH] fix: params on starting to create chaStore --- src/app.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app.tsx b/src/app.tsx index e991d5d..d0e1bfc 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -292,12 +292,14 @@ export function App() { // if there are any params in URL, create a new chatStore useEffect(() => { const run = async () => { + const chatStore = await getChatStoreByIndex(selectedChatIndex); const api = getDefaultParams("api", ""); const key = getDefaultParams("key", ""); const sys = getDefaultParams("sys", ""); const mode = getDefaultParams("mode", ""); const model = getDefaultParams("model", ""); const max = getDefaultParams("max", 0); + console.log('max is', max, 'chatStore.max is', chatStore.maxTokens) // only create new chatStore if the params in URL are NOT // equal to the current selected chatStore if ( @@ -306,8 +308,9 @@ export function App() { (sys && sys !== chatStore.systemMessageContent) || (mode && mode !== (chatStore.streamMode ? "stream" : "fetch")) || (model && model !== chatStore.model) || - (max && max !== chatStore.maxTokens) + (max !== 0 && max !== chatStore.maxTokens) ) { + console.log('create new chatStore because of params in URL') handleNewChatStore(); } await db;