From 2d3e306067dbc686734175586fa72798c1e2fb29 Mon Sep 17 00:00:00 2001 From: wonder Date: Sun, 21 Jun 2026 15:22:49 +0800 Subject: [PATCH] =?UTF-8?q?refactor:=20=E4=BC=98=E5=8C=96=E5=AE=A1?= =?UTF-8?q?=E6=9F=A5=E8=BF=9B=E5=BA=A6=E6=9D=A1=E4=BA=A4=E4=BA=92=EF=BC=8C?= =?UTF-8?q?file=5Fstart=20=E5=92=8C=20file=5Fend=20=E5=9D=87=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E8=BF=9B=E5=BA=A6=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - file_start: 显示当前正在审查的文件名和已开始数量 - file_end: 更新进度条百分比和已完成数量 - 进度条仅在 file_end 时推进,文本在两个事件都更新,兼顾准确性和即时反馈 --- templates/pages/review.html | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/templates/pages/review.html b/templates/pages/review.html index 231447e..0e2da7d 100644 --- a/templates/pages/review.html +++ b/templates/pages/review.html @@ -351,8 +351,14 @@ // Progress tracking let totalFiles = 0; let completedFiles = 0; + let startedFiles = 0; let currentFile = ''; + function updateProgress() { + const pct = totalFiles > 0 ? Math.round((completedFiles / totalFiles) * 80 + 10) : 50; + document.getElementById('progress-bar').style.width = pct + '%'; + } + const concurrency = document.getElementById('concurrency').value; currentSSE = SSE.post(`/api/repos/${repoId}/review`, { @@ -367,8 +373,9 @@ document.getElementById('progress-bar').style.width = '5%'; }, file_start(data) { + startedFiles++; currentFile = data.file || ''; - document.getElementById('progress-text').textContent = `正在审查: ${currentFile} (${completedFiles}/${totalFiles})`; + document.getElementById('progress-text').textContent = `正在审查: ${currentFile} (${startedFiles}/${totalFiles})`; // Initialize file review entry if (!fileReviews[currentFile]) { @@ -387,8 +394,7 @@ }, file_end(data) { completedFiles++; - const pct = totalFiles > 0 ? Math.round((completedFiles / totalFiles) * 80 + 10) : 50; - document.getElementById('progress-bar').style.width = pct + '%'; + updateProgress(); document.getElementById('progress-text').textContent = `已完成 ${completedFiles}/${totalFiles} 个文件`; }, file_summary(data) {