feat(ai-review 使用量): 新增多平台 AI 助理使用量統計與剩餘可用百分比

This commit is contained in:
Jeffery
2026-06-23 12:58:43 +08:00
parent e6d1a17b78
commit 1151535161
4 changed files with 278 additions and 7 deletions
+7 -4
View File
@@ -84,12 +84,14 @@ export function formatFindingsStatsLine(findings) {
return `舊: ${row(oldFindings)};新: ${row(newFindings)}`;
}
function buildReviewSummary(findings) {
return [
function buildReviewSummary(findings, usageSection = '') {
const parts = [
'## AI Code Review 統計',
'',
formatFindingsStats(findings),
].join('\n');
];
if (usageSection) parts.push('', usageSection);
return parts.join('\n');
}
function toReviewComment(f) {
@@ -112,10 +114,11 @@ export async function postFindingsReview(findings, deps = {}) {
postReview = postPullReview,
summaryFindings = findings,
commentFindings = findings,
usageSection = '',
} = deps;
const sortedComments = [...commentFindings].sort(bySeverity);
const comments = sortedComments.map(toReviewComment).filter(Boolean);
const body = buildReviewSummary(summaryFindings);
const body = buildReviewSummary(summaryFindings, usageSection);
await postReview({ body, comments });
ok(`review 發布: summary=${summaryFindings.length} total=${sortedComments.length} commentable=${comments.length}`);
line(`review summary 統計: ${formatFindingsStatsLine(summaryFindings)}`);