feat(webui): visualize context usage by logical round (#5649)
* feat(webui): visualize per-request context reuse * refactor(webui): report usage by logical round * fix(webui): align context chart with logical rounds * refactor(webui): derive turn usage from logical rounds * fix(webui): polish context usage details
This commit is contained in:
1 parent
8fb7bc34ec
commit
6b82d642fc
35 files changed
+994
-274
No files matched your search
@@ -100,7 +100,10 @@ async def test_runtime_event_publisher_consumes_turn_metadata_on_complete() -> N
|
||||
bus.subscribe(seen.append)
|
||||
publisher.record_turn_runtime("cli:direct", "runtime")
|
||||
publisher.record_turn_latency("cli:direct", 123)
|
||||
publisher.record_turn_usage("cli:direct", LLMUsage.reported(input_tokens=40, output_tokens=2))
|
||||
first_round = LLMUsage.reported(input_tokens=40, output_tokens=2)
|
||||
second_round = LLMUsage.reported(input_tokens=60, output_tokens=3)
|
||||
publisher.record_turn_usage("cli:direct", [first_round])
|
||||
publisher.record_turn_usage("cli:direct", [second_round])
|
||||
|
||||
await publisher.turn_completed(
|
||||
channel="cli",
|
||||
@@ -121,7 +124,8 @@ async def test_runtime_event_publisher_consumes_turn_metadata_on_complete() -> N
|
||||
assert first.context.metadata == {"source": "test"}
|
||||
assert first.latency_ms == 123
|
||||
assert first.runtime == "runtime"
|
||||
assert first.usage == LLMUsage.reported(input_tokens=40, output_tokens=2)
|
||||
assert first.usage == first_round + second_round
|
||||
assert first.round_usages == (first_round, second_round)
|
||||
assert isinstance(second, TurnCompleted)
|
||||
assert second.latency_ms is None
|
||||
assert second.runtime is None
|
||||
|
||||
Reference in new issue
Block a user