fix: 增加创建对话的错误提示

This commit is contained in:
ikechan8370 2023-03-07 23:14:00 +08:00
parent da04370ff5
commit 88a97b6c92

View file

@ -103,7 +103,13 @@ export default class SydneyAIClient {
fetchOptions.agent = proxy(Config.proxy)
}
const response = await fetch(`${this.opts.host}/turing/conversation/create`, fetchOptions)
return response.json()
let text = await response.text()
try {
return JSON.parse(text)
} catch (err) {
logger.error('创建sydney对话失败', text)
throw new Error(text)
}
}
async createWebSocketConnection () {