mirror of
https://github.com/shanmiteko/LotteryAutoScript.git
synced 2026-06-04 21:01:17 +08:00
fix: ai返回增加类型检查
This commit is contained in:
parent
fe0258a84a
commit
2294ad9f3f
@ -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}`);
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user