Improve long product-data generation runs
This commit is contained in:
@@ -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))}…`;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user