修正进行中工具调用耗时计算
Project CI / AI game creator shell Rust smoke (pull_request) Has been cancelled
Project CI / AI game creator shell Rust crates (pull_request) Has been cancelled
Project CI / Backend tests (pull_request) Has been cancelled
Project CI / Native shell tests (pull_request) Has been cancelled
Project CI / Frontend tests (pull_request) Has been cancelled
Project CI / Repository checks (pull_request) Has been cancelled
Project CI / AI game creator shell web tests (pull_request) Has been cancelled
Project CI / AI game creator shell Rust shard 1/4 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust shard 2/4 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust shard 3/4 (pull_request) Has been cancelled
Project CI / AI game creator shell Rust shard 4/4 (pull_request) Has been cancelled

优先使用运行快照的时间差,缺少更新时间时才回退到本地时钟。

同步执行过程测试使用当前回合标识。
This commit is contained in:
2026-09-16 06:35:15 +08:00
parent df415aff39
commit 9df73a200a
@@ -76,7 +76,17 @@ export function ToolCallGroup({
// min(startedAt) → max(updatedAt),不掺入本地时钟。
const totalDurationMs = running
? startedAt > 0
? Math.max(0, Date.now() - startedAt)
? (() => {
const latestUpdatedAt = Math.max(
...orderedCalls.map((call) => call.updatedAt || 0),
);
// A running snapshot can still carry a monotonic update time. Use
// that delta when available; fall back to wall-clock elapsed time
// for live events that have no update timestamp yet.
return latestUpdatedAt > startedAt
? latestUpdatedAt - startedAt
: Math.max(0, Date.now() - startedAt);
})()
: null
: turnToolCallDurationMs(orderedCalls);
const durationText = formatTurnDuration(totalDurationMs);