From 34d4827580c555911c4ddf7f8bad09018dbdcb54 Mon Sep 17 00:00:00 2001 From: heimoshuiyu Date: Thu, 16 Nov 2023 10:10:56 +0800 Subject: [PATCH] fix: undefind from template --- src/chatbox.tsx | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/src/chatbox.tsx b/src/chatbox.tsx index 5c13211..5eb3caa 100644 --- a/src/chatbox.tsx +++ b/src/chatbox.tsx @@ -570,7 +570,47 @@ export default function ChatBOX(props: { chatStore.apiKey ); } + if (!newChatStore.whisper_api) { + newChatStore.whisper_api = getDefaultParams( + "whisper-api", + chatStore.whisper_api + ); + } + if (!newChatStore.whisper_key) { + newChatStore.whisper_key = getDefaultParams( + "whisper-key", + chatStore.whisper_key + ); + } + if (!newChatStore.tts_api) { + newChatStore.tts_api = getDefaultParams( + "tts-api", + chatStore.tts_api + ); + } + if (!newChatStore.tts_key) { + newChatStore.tts_key = getDefaultParams( + "tts-key", + chatStore.tts_key + ); + } + if (!newChatStore.image_gen_api) { + newChatStore.image_gen_api = getDefaultParams( + "image-gen-api", + chatStore.image_gen_api + ); + } + if (!newChatStore.image_gen_key) { + newChatStore.image_gen_key = getDefaultParams( + "image-gen-key", + chatStore.image_gen_key + ); + } newChatStore.cost = 0; + + // manage undefined value because of version update + newChatStore.toolsString = newChatStore.toolsString || ""; + setChatStore({ ...newChatStore }); }} >