refactor(llm): clarify request context immutability

This commit is contained in:
Hypatia May
2026-07-29 16:45:08 +08:00
parent 840e5eaa40
commit 872cdfc774
2 changed files with 3 additions and 1 deletions

View File

@@ -96,6 +96,8 @@ export const StatsLine = memo(function StatsLine({ useSession, useProjection }:
const cacheHit = cacheHitPercent(usage)
if (cacheHit !== null) parts.push(`cache hit ${cacheHit}%`)
}
// contextPercent validates both fields; repeat the capacity guard so that
// TypeScript carries the same refinement into the formatting branch.
parts.push(context === null || modelRequest?.contextWindow === undefined
? 'context unknown'
: `context ${context}% of ${formatMetricTokens(modelRequest.contextWindow)}`)