Fix conversation edit failed & Mixin login (#236)
* fix redundant toast error * fix Mixin login failed on occasions * fix conversation form default values
This commit is contained in:
@@ -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<z.infer<typeof conversationFormSchema>>({
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user