mirror of
https://github.com/turnstonelabs/turnstone.git
synced 2026-08-12 23:12:23 -06:00
fix: populate model in _last_usage so usage-by-model records correctly (#273)
* fix: populate model in _last_usage so usage-by-model records correctly _last_usage was built purely from UsageInfo token counts, never including a "model" key. server.py's on_status() fell back to model="" for every record_usage_event call, so GROUP BY model collapsed all rows into a single empty-key bucket. * fix: inject model at emission time, preserve dict[str, int] typing Address Copilot review: keep _last_usage as dict[str, int] for type safety, inject "model" from self.model when passing to on_status(). This also fixes stale model after /model switch since the value is read fresh each time.
This commit is contained in:
@@ -2335,7 +2335,8 @@ class ChatSession:
|
||||
"""Emit status info via the UI."""
|
||||
if not self._last_usage:
|
||||
return
|
||||
self.ui.on_status(self._last_usage, self.context_window, self.reasoning_effort)
|
||||
usage: dict[str, Any] = {**self._last_usage, "model": self.model}
|
||||
self.ui.on_status(usage, self.context_window, self.reasoning_effort)
|
||||
|
||||
# -- Conversation compaction ------------------------------------------------
|
||||
|
||||
|
||||
Reference in New Issue
Block a user