mirror of
https://github.com/ikechan8370/chatgpt-plugin.git
synced 2025-12-14 12:27:10 +00:00
Fix initialization crash on cloud authentication failure (#821)
* Initial plan * Fix cloud authentication failure handling to prevent initialization crash Co-authored-by: ikechan8370 <21212372+ikechan8370@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: ikechan8370 <21212372+ikechan8370@users.noreply.github.com>
This commit is contained in:
parent
4b1a66b6bf
commit
00b24914dd
1 changed files with 6 additions and 1 deletions
|
|
@ -46,6 +46,7 @@ export async function authCloud (apiKey = ChatGPTConfig.chaite.cloudApiKey) {
|
|||
return Chaite.getInstance().getToolsManager().cloudService.getUser()
|
||||
} catch (err) {
|
||||
logger.error(err)
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -133,7 +134,11 @@ export async function initChaite () {
|
|||
await migrateDatabase()
|
||||
if (ChatGPTConfig.chaite.cloudApiKey) {
|
||||
const user = await authCloud(ChatGPTConfig.chaite.cloudApiKey)
|
||||
logger.info(`Chaite.Cloud 认证成功, 当前用户${user.username || user.email} (${user.user_id})`)
|
||||
if (user) {
|
||||
logger.info(`Chaite.Cloud 认证成功, 当前用户${user.username || user.email} (${user.user_id})`)
|
||||
} else {
|
||||
logger.warn('Chaite.Cloud 认证失败,将继续使用本地功能')
|
||||
}
|
||||
}
|
||||
await initRagManager(ChatGPTConfig.llm.embeddingModel, ChatGPTConfig.llm.dimensions)
|
||||
if (!ChatGPTConfig.chaite.authKey) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue