job51-gitlab-cr-node-jt-1 2.8.5 → 2.8.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/index.js +5 -7
  2. package/log +3364 -0
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -856,16 +856,15 @@ ${allReportsText}
856
856
  let targetLine = null;
857
857
  let skipReason = null;
858
858
 
859
- // 验证文件路径是否匹配当前 diff
859
+ // 验证文件路径是否匹配当前 diff 块(检测AI幻觉)
860
860
  if (problemInfo.new_path && diff_info.new_path &&
861
861
  problemInfo.new_path !== diff_info.new_path) {
862
- skipReason = `AI 返回的文件路径 ${problemInfo.new_path} 与当前 diff 块文件 ${diff_info.new_path} 不匹配,可能存在AI幻觉`;
863
- debugLog(`第 ${i + 1} 个问题 ${skipReason}`);
862
+ console.warn(`⚠️ 检测到AI幻觉:第 ${i + 1} 个问题的文件路径 ${problemInfo.new_path} 与当前 diff 块文件 ${diff_info.new_path} 不匹配,跳过该问题的评论发布`);
863
+ continue; // 直接跳过,不发布评论
864
864
  }
865
865
 
866
- // 只有文件路径匹配时,才继续验证行号
867
- if (!skipReason) {
868
- if (problemInfo.old_line && !problemInfo.new_line) {
866
+ // 验证行号是否在 diff 块范围内
867
+ if (problemInfo.old_line && !problemInfo.new_line) {
869
868
  // 删除代码,使用 old_line
870
869
  if (oldCount === 0) {
871
870
  skipReason = `删除文件的 diff 块 (old_count=${oldCount}),无法使用 old_line`;
@@ -902,7 +901,6 @@ ${allReportsText}
902
901
  };
903
902
  }
904
903
  }
905
- } // 文件路径验证条件块结束
906
904
 
907
905
  if (!targetLine) {
908
906
  // 无法解析行号或行号超出范围,使用一般讨论