Skip to content

Commit

Permalink
fix(core): 修复单选题答案回调内容不一致的BUG
Browse files Browse the repository at this point in the history
  • Loading branch information
ennnncy committed Mar 27, 2024
1 parent 3f04e21 commit 4265263
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/core/worker/question.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,18 @@ export function defaultQuestionResolve<E>(
/** 找出最相似的选项 */
let index = -1;
let max = 0;
let ans = '';
ratings.forEach((rating, i) => {
if (rating.rating > max) {
max = rating.rating;
index = i;
ans = rating.target;
}
});
// 存在选项,并且相似度超过 60 %
if (index !== -1 && max > 0.6) {
/** 经自定义的处理器进行处理 */
await handler('single', options[index].innerText, options[index], ctx);
await handler('single', ans, options[index], ctx);
await $.sleep(500);
return {
finish: true,
Expand Down

0 comments on commit 4265263

Please sign in to comment.