-
Notifications
You must be signed in to change notification settings - Fork 0
cnb: token + model section in board daily report (#153) #232
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| 0.5.70-dev | ||
| 0.5.74-dev |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -169,6 +169,27 @@ def model_state_alerts(sessions: list[dict]) -> list[str]: | |
| return alerts | ||
|
|
||
|
|
||
| def tongxue_token_summary( | ||
| project_root: Path, | ||
| name: str, | ||
| *, | ||
| recent_hours: float | None = 24.0, | ||
| ) -> dict | None: | ||
| """Return aggregated usage for a single tongxue, or None if no data. | ||
|
|
||
| The default 24h window matches a typical shift; pass `None` for full history. | ||
| """ | ||
| sessions = _load_project_sessions(project_root, recent_hours=recent_hours) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Because this new daily summary relies on Useful? React with 👍 / 👎. |
||
| if not sessions: | ||
| return None | ||
| needle = name.lower() | ||
| sessions = [s for s in sessions if (s.get("name") or "").lower() == needle] | ||
| if not sessions: | ||
| return None | ||
| agg = aggregate_by_name(sessions) | ||
| return agg[0] if agg else None | ||
|
Comment on lines
+189
to
+190
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This filters JSONLs with a case-insensitive name match, but then hands them to Useful? React with 👍 / 👎. |
||
|
|
||
|
|
||
| def _parse_usage_args(args: list[str]) -> dict[str, Any]: | ||
| parsed: dict[str, Any] = {"detail": False, "budget": 0.0, "warn_pct": DEFAULT_BUDGET_WARN_PCT} | ||
| i = 0 | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When a retained session has switched models, the report displays
latest_modelbut this call prices the aggregated tokens withestimate_cost, which looks only atusage["model"](the first model seen). For example, an Opus→Sonnet session will show Sonnet as current while charging all later Sonnet tokens at Opus rates, so the new daily cost estimate can be materially wrong whenever model changes occur during the reporting window.Useful? React with 👍 / 👎.