fix(workbench): seal terminal timing display seconds (#1998)
This commit is contained in:
@@ -91,7 +91,7 @@ function filterReadableRows(rows: TraceEventRow[], hideSealedFinalResponse: bool
|
||||
function traceRowDuplicatesSealedFinal(row: TraceEventRow): boolean {
|
||||
if (rowIsTool(row)) return false;
|
||||
if (row.rowId.startsWith("trace-final-response:")) return true;
|
||||
return row.terminal === true && /(?:助手最终消息|assistant\s+(?:final\s+)?message)/iu.test(String(row.header ?? ""));
|
||||
return /(?:助手(?:最终)?消息|assistant\s+(?:final\s+)?message)/iu.test(String(row.header ?? ""));
|
||||
}
|
||||
|
||||
function toolCommandPreview(row: TraceEventRow): string | null {
|
||||
|
||||
@@ -319,12 +319,17 @@ function messageTimingForDisplay(message: ChatMessage): ChatMessage["timing"] {
|
||||
|
||||
function terminalMessageDurationMs(message: ChatMessage, timing: ChatMessage["timing"]): number | null {
|
||||
const elapsed = elapsedTerminalDurationMs(message, timing);
|
||||
if (elapsed !== null && elapsed > 0) return elapsed;
|
||||
if (elapsed !== null && elapsed > 0) return ceilDisplayDurationSecond(elapsed);
|
||||
const recorded = sealedTerminalRecordedDurationMs(message, timing);
|
||||
if (recorded !== null) return recorded;
|
||||
if (recorded !== null) return ceilDisplayDurationSecond(recorded);
|
||||
return null;
|
||||
}
|
||||
|
||||
function ceilDisplayDurationSecond(ms: number): number {
|
||||
if (!Number.isFinite(ms) || ms <= 0) return ms;
|
||||
return Math.ceil(ms / 1000) * 1000;
|
||||
}
|
||||
|
||||
function sealedTerminalRecordedDurationMs(message: ChatMessage, timing: ChatMessage["timing"]): number | null {
|
||||
const messageRecord = message as Record<string, unknown>;
|
||||
const trace = message.runnerTrace as Record<string, unknown> | null | undefined;
|
||||
|
||||
Reference in New Issue
Block a user