From 88a97b6c9202828c380fe8fa3175afd73387e4e8 Mon Sep 17 00:00:00 2001 From: ikechan8370 Date: Tue, 7 Mar 2023 23:14:00 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=A2=9E=E5=8A=A0=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E5=AF=B9=E8=AF=9D=E7=9A=84=E9=94=99=E8=AF=AF=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/SydneyAIClient.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/utils/SydneyAIClient.js b/utils/SydneyAIClient.js index 3b2780c..314f4a0 100644 --- a/utils/SydneyAIClient.js +++ b/utils/SydneyAIClient.js @@ -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 () {