update custom mode err handling

This commit is contained in:
Archeb
2024-06-26 19:15:48 +08:00
parent b7a7c77405
commit 928bb6f6b9
+8 -4
View File
@@ -159,10 +159,14 @@ class YouProvider {
proxyModel, proxyModel,
uuidv4().substring(0, 4) uuidv4().substring(0, 4)
); );
if (!userChatMode) console.log("Failed to create user chat mode, will use default mode instead."); if(userChatMode.chat_mode_id){
this.config.sessions[session.configIndex].user_chat_mode_id[proxyModel] = userChatMode.chat_mode_id; this.config.sessions[session.configIndex].user_chat_mode_id[proxyModel] = userChatMode.chat_mode_id;
// 写回config // 写回config
fs.writeFileSync("./config.mjs", "export const config = " + JSON.stringify(this.config, null, 4)); fs.writeFileSync("./config.mjs", "export const config = " + JSON.stringify(this.config, null, 4));
}else{
if(userChatMode.error) console.log(userChatMode.error)
console.log("Failed to create user chat mode, will use default mode instead.");
}
} }
userChatModeId = this.config.sessions[session.configIndex].user_chat_mode_id[proxyModel]; userChatModeId = this.config.sessions[session.configIndex].user_chat_mode_id[proxyModel];
} else { } else {