From 2294ad9f3f0097f4b04a138291ff54c85582e702 Mon Sep 17 00:00:00 2001 From: shanmite Date: Mon, 1 Jun 2026 14:07:13 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20ai=E8=BF=94=E5=9B=9E=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/core/monitor.js | 28 ++++++++++++++++++++++------ lib/utils.js | 2 +- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/lib/core/monitor.js b/lib/core/monitor.js index eac3706..7fb338d 100644 --- a/lib/core/monitor.js +++ b/lib/core/monitor.js @@ -365,7 +365,7 @@ class Monitor extends Searcher { log.debug('正在筛选的动态信息', lottery_info); if (des === '') { - log.info('筛选动态', `获取动态内容为空(https://t.bilibili.com/${dyid})风控`); + log.info('筛选动态', `获取动态内容为空(https://t.bilibili.com/${dyid})风控或是视频动态`); return false; } @@ -472,11 +472,27 @@ class Monitor extends Searcher { ); try { let msg_json = JSON.parse(msg); - has_key_words = msg_json.has_key_words; - needAt = msg_json.needAt; - needTopic = msg_json.needTopic; - drawtime = msg_json.drawtime; - isLottery = has_key_words; + if (typeof msg_json.has_key_words == 'boolean') { + has_key_words = msg_json.has_key_words; + isLottery = has_key_words; + } else { + log.warn('ai判断抽奖', 'no has_key_words'); + } + if (typeof msg_json.needAt == 'boolean') { + needAt = msg_json.needAt; + } else { + log.warn('ai判断抽奖', 'no needAt'); + } + if (typeof msg_json.needTopic == 'string') { + needTopic = msg_json.needTopic; + } else { + log.warn('ai判断抽奖', 'no needTopic'); + } + if (typeof msg_json.drawtime == 'number') { + drawtime = msg_json.drawtime; + } else { + log.warn('ai判断抽奖', 'no drawtime'); + } log.info('ai判断抽奖', msg_json.more); } catch (_) { log.error('ai判断抽奖', `未返回JSON格式${msg}`); diff --git a/lib/utils.js b/lib/utils.js index a222ba9..58847b6 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -550,7 +550,7 @@ const utils = { }, success: res => { const data = utils.strToJson(res.body); - resolve(data?.choices?.[0]?.message?.content || null); + resolve(utils.log.debug_return(content, data?.choices?.[0]?.message?.content) || null); }, failure: () => { resolve(null);