From 928bb6f6b94b83339c090cdcd4c0da0e9ecf55ef Mon Sep 17 00:00:00 2001 From: Archeb Date: Wed, 26 Jun 2024 19:15:48 +0800 Subject: [PATCH] update custom mode err handling --- provider.mjs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/provider.mjs b/provider.mjs index 51e4ff9..df13f8b 100644 --- a/provider.mjs +++ b/provider.mjs @@ -159,10 +159,14 @@ class YouProvider { proxyModel, uuidv4().substring(0, 4) ); - if (!userChatMode) console.log("Failed to create user chat mode, will use default mode instead."); - this.config.sessions[session.configIndex].user_chat_mode_id[proxyModel] = userChatMode.chat_mode_id; - // 写回config - fs.writeFileSync("./config.mjs", "export const config = " + JSON.stringify(this.config, null, 4)); + if(userChatMode.chat_mode_id){ + this.config.sessions[session.configIndex].user_chat_mode_id[proxyModel] = userChatMode.chat_mode_id; + // 写回config + 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]; } else {