job51-gitlab-cr-node-jt-1 1.3.0 → 1.3.1
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.
- package/index.js +12 -12
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -57,7 +57,7 @@ class GitLabCodeReviewer {
|
|
|
57
57
|
|
|
58
58
|
const prompt = '/simple-code-review' + ' ' + `${diff.diff}`;
|
|
59
59
|
|
|
60
|
-
// 最多重试3次,直到结果包含"🤖 AI
|
|
60
|
+
// 最多重试3次,直到结果包含"🤖 AI代码审查结果"或达到最大重试次数
|
|
61
61
|
let attempts = 0;
|
|
62
62
|
const maxAttempts = 5;
|
|
63
63
|
|
|
@@ -71,15 +71,15 @@ class GitLabCodeReviewer {
|
|
|
71
71
|
|
|
72
72
|
debugLog(`本地AI命令审核完成,AI审核结果: ${claudeResult}`);
|
|
73
73
|
|
|
74
|
-
// 检查结果是否包含"🤖 AI
|
|
75
|
-
if (claudeResult && claudeResult.includes('🤖 AI
|
|
76
|
-
debugLog(`AI审核成功,包含"🤖 AI
|
|
74
|
+
// 检查结果是否包含"🤖 AI代码审查结果",如果包含则返回结果
|
|
75
|
+
if (claudeResult && claudeResult.includes('🤖 AI代码审查结果')) {
|
|
76
|
+
debugLog(`AI审核成功,包含"🤖 AI代码审查结果" (尝试 ${attempts})`);
|
|
77
77
|
|
|
78
78
|
|
|
79
79
|
// 提取REPORT标签内容并返回
|
|
80
80
|
return extractReportContent(claudeResult);
|
|
81
81
|
} else {
|
|
82
|
-
debugLog(`AI审核结果不包含"🤖 AI
|
|
82
|
+
debugLog(`AI审核结果不包含"🤖 AI代码审查结果" (尝试 ${attempts}),将重试...`);
|
|
83
83
|
if (attempts >= maxAttempts) {
|
|
84
84
|
debugLog(`已达到最大重试次数 ${maxAttempts},返回最后一次结果,${claudeResult}`);
|
|
85
85
|
|
|
@@ -129,7 +129,7 @@ class GitLabCodeReviewer {
|
|
|
129
129
|
const blockObj = { ...diffObject, review_result, temp_file_path: tmpFileName };
|
|
130
130
|
|
|
131
131
|
// 立即发布评论
|
|
132
|
-
debugLog(`🤖 AI
|
|
132
|
+
debugLog(`🤖 AI代码审查结果: ${blockObj.review_result}`);
|
|
133
133
|
await this.postSingleCommentToGitLab(projectId, mergeRequestIid, {
|
|
134
134
|
diff_info: blockObj,
|
|
135
135
|
block_index: blockObj.block_index,
|
|
@@ -138,7 +138,7 @@ class GitLabCodeReviewer {
|
|
|
138
138
|
// 检查审查结果中是否包含严重问题,只有包含严重问题才发布评论
|
|
139
139
|
/*if (blockObj.review_result && blockObj.review_result.includes('🔴 严重问题')) {
|
|
140
140
|
// 立即发布评论
|
|
141
|
-
console.log(`🤖 AI
|
|
141
|
+
console.log(`🤖 AI代码审查结果: ${blockObj.review_result}`);
|
|
142
142
|
await this.postSingleCommentToGitLab(projectId, mergeRequestIid, {
|
|
143
143
|
diff_info: blockObj,
|
|
144
144
|
block_index: blockObj.block_index,
|
|
@@ -198,7 +198,7 @@ class GitLabCodeReviewer {
|
|
|
198
198
|
|
|
199
199
|
const prompt = `/simple-code-review 文件路径:${filePath}`;
|
|
200
200
|
|
|
201
|
-
// 最多重试5次,直到结果包含"🤖 AI
|
|
201
|
+
// 最多重试5次,直到结果包含"🤖 AI代码审查结果"或达到最大重试次数
|
|
202
202
|
let attempts = 0;
|
|
203
203
|
const maxAttempts = 5;
|
|
204
204
|
|
|
@@ -214,14 +214,14 @@ class GitLabCodeReviewer {
|
|
|
214
214
|
debugLog(`本地AI命令审核结果为空`);
|
|
215
215
|
}
|
|
216
216
|
debugLog(`本地AI命令审核完成,审核结果为:${claudeResult}`);
|
|
217
|
-
// 检查结果是否包含"🤖 AI
|
|
218
|
-
if (claudeResult && claudeResult.includes('🤖 AI
|
|
219
|
-
debugLog(`AI审核成功,包含"🤖 AI
|
|
217
|
+
// 检查结果是否包含"🤖 AI代码审查结果",如果包含则返回结果
|
|
218
|
+
if (claudeResult && claudeResult.includes('🤖 AI代码审查结果')) {
|
|
219
|
+
debugLog(`AI审核成功,包含"🤖 AI代码审查结果" (尝试 ${attempts})`);
|
|
220
220
|
|
|
221
221
|
// 提取REPORT标签内容并返回
|
|
222
222
|
return extractReportContent(claudeResult);
|
|
223
223
|
} else {
|
|
224
|
-
debugLog(`AI审核结果不包含"🤖 AI
|
|
224
|
+
debugLog(`AI审核结果不包含"🤖 AI代码审查结果" (尝试 ${attempts}),将重试...`);
|
|
225
225
|
if (attempts >= maxAttempts) {
|
|
226
226
|
debugLog(`已达到最大重试次数 ${maxAttempts},返回最后一次结果,${claudeResult}`);
|
|
227
227
|
|