Improve long product-data generation runs

This commit is contained in:
wuyang6
2026-05-11 20:26:06 +08:00
parent 4c29ce21f1
commit c4427bbd07
14 changed files with 57 additions and 6 deletions
@@ -1601,6 +1601,17 @@ function formatActivityDuration(ms: number) {
function compactActivityLabel(label: string, maxLength = 15) {
const normalized = label.replace(/\s+/g, " ").trim();
const progress = normalized.match(
/^进度[:]\s*批\s*(\d+)\s*\/\s*(\d+)(?:[,]\s*已生成\s*(\d+)\s*\/\s*(\d+))?/,
);
if (progress) {
const batch = `${progress[1]}/${progress[2]}`;
const count =
progress[3] && progress[4] ? `${progress[3]}/${progress[4]}` : "";
const compactProgress = `${batch}${count}`;
if (compactProgress.length <= maxLength) return compactProgress;
return batch;
}
if (normalized.length <= maxLength) return normalized;
return `${normalized.slice(0, Math.max(1, maxLength - 1))}`;
}