diff --git a/enjoy/src/renderer/components/conversations/conversation-form.tsx b/enjoy/src/renderer/components/conversations/conversation-form.tsx index 5b587ed5..7bffe8c0 100644 --- a/enjoy/src/renderer/components/conversations/conversation-form.tsx +++ b/enjoy/src/renderer/components/conversations/conversation-form.tsx @@ -100,14 +100,22 @@ export const ConversationForm = (props: { refreshProviders(); }, []); - const defaultConfig = conversation || {}; - + const defaultConfig = JSON.parse(JSON.stringify(conversation || {})); if (defaultConfig.engine === "openai" && openai) { - defaultConfig.configuration.model = openai.model; - defaultConfig.configuration.baseUrl = openai.baseUrl; + if (!defaultConfig.configuration) { + defaultConfig.configuration = {}; + } + if (!defaultConfig.configuration.model) { + defaultConfig.configuration.model = openai.model; + } + if (!defaultConfig.configuration.baseUrl) { + defaultConfig.configuration.baseUrl = openai.baseUrl; + } } - if (defaultConfig.configuration?.tts?.engine === "openai" && openai) { - defaultConfig.configuration.tts.baseUrl = openai.baseUrl; + if (defaultConfig.configuration.tts.engine === "openai" && openai) { + if (!defaultConfig.configuration.tts.baseUrl) { + defaultConfig.configuration.tts.baseUrl = openai.baseUrl; + } } const form = useForm>({ diff --git a/enjoy/src/renderer/components/login-form.tsx b/enjoy/src/renderer/components/login-form.tsx index 2bafa422..aa260799 100644 --- a/enjoy/src/renderer/components/login-form.tsx +++ b/enjoy/src/renderer/components/login-form.tsx @@ -67,6 +67,7 @@ export const LoginForm = () => { const code = new URL(url).searchParams.get("code"); if (provider && code) { + setWebviewVisible(false); webApi .auth({ provider, code }) .then((user) => { @@ -74,13 +75,7 @@ export const LoginForm = () => { }) .catch((err) => { toast.error(err.message); - }) - .finally(() => { - setWebviewVisible(false); }); - } else { - toast.error(t("failedToLogin")); - setWebviewVisible(false); } } };