refactor(llm): clarify request context immutability
This commit is contained in:
@@ -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)}`)
|
||||
|
||||
@@ -448,7 +448,7 @@ export class LlmService extends Service {
|
||||
const resolvedConfig = deepFreeze(structuredClone(resolved.config))
|
||||
const context = resolved.context === undefined
|
||||
? undefined
|
||||
: Object.freeze(structuredClone(resolved.context))
|
||||
: deepFreeze(structuredClone(resolved.context))
|
||||
let dispatched = false
|
||||
return Object.freeze({
|
||||
config: resolvedConfig,
|
||||
|
||||
Reference in New Issue
Block a user