🐞 fix: 解决网络错误带来的控制台报错

This commit is contained in:
zhiyu1998 2023-03-24 11:38:22 +08:00
parent 0155a5662e
commit 6fc36501e1

View File

@ -367,19 +367,19 @@ export class tools extends plugin {
// 如果有ck 并且 有openai的key // 如果有ck 并且 有openai的key
if (this.biliSessData && this.openaiApiKey) { if (this.biliSessData && this.openaiApiKey) {
let prompt;
try { try {
prompt = await getBiliGptInputText( const prompt = await getBiliGptInputText(
{ title, desc, dynamic, aid, cid }, { title, desc, dynamic, aid, cid },
this.biliSessData, this.biliSessData,
); );
const response = await this.chatGptClient.sendMessage(prompt);
// 暂时不设计上下文
e.reply(response.response);
} catch (err) { } catch (err) {
logger.error("总结失败,可能是没有弹幕或者网络问题!\n", err); logger.error("总结失败,可能是没有弹幕或者网络问题!\n", err);
return true; return true;
} }
const response = await this.chatGptClient.sendMessage(prompt);
// 暂时不设计上下文
e.reply(response.response);
} }
return true; return true;
} }