fix: 增加错误输出

This commit is contained in:
ikechan8370 2023-09-19 11:17:43 +08:00
parent c36a0f9c9c
commit 7c5e9ea434

View file

@ -156,6 +156,7 @@ export class ClaudeAIClient {
if (streamDataRes.status === 307) {
throw new Error('claude.ai目前不支持你所在的地区')
}
if (streamDataRes.status === 200) {
let streamData = streamDataRes.body
// console.log(streamData)
let responseText = ''
@ -182,6 +183,11 @@ export class ClaudeAIClient {
text: responseText.trim(),
conversationId
}
} else if (streamDataRes.status === 408) {
throw new Error('claude.ai响应超时可能是回复文本太多请调高超时时间重试')
} else {
throw new Error('unknown error')
}
}
}