1ccacad63281094de8a3372d5a507d38f9969e5c
4
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
9cd4ef6a19 |
sessions: an aliased range is named once per change, not on every 10 s read
While the Sessions page is open, the GUI reads the 7, 30 and all-days
ranges again every 10 s. Those ranges are kept (keptStats), so a read
with nothing changed costs almost nothing, except when a model is
counted under another name (a usage alias, or a shared group's spelled
name). Then aliasStats copied every day's usage and every session's
summary of each range on each read: ~5 MB a read for the owner's real
history, which was then thrown away because nothing had changed.
aliasKept keeps each range's aliased Stats with the kept Stats it came
from and the names (provider.UsageNamesKey). When the kept Stats are the
same slices and the names haven't changed, it returns the same answer.
Kept Stats are never written, and MergeExternalStats copies before it
writes, so the answer can be shared. The memo is dropped with the kept
ranges (forgetKeptStats), so it never outlives them. UsageAliasKeyed
reads settings once for both the alias and its key.
Run: TestAliasedRangeMadeOncePerNames (new) passes. With the memo
skipped it fails at "named again with nothing changed". With the key
and source check removed it fails at "the old names' range given after
the names changed". go test ./internal/sessions ./internal/provider
./internal/gui and GOOS=windows / GOOS=linux -tags nogui vet: ok at
|
||
|
|
d401c25951 |
usage: the found-group names hold the catalog, so a usage ask no longer builds it again (#5978)
|
||
|
|
4921bf5a97 |
usage, sessions: one model option for a found routing group's two ids (#5892, Norethcy on X)
A found routing group is called by its public id (auto/<model>) and is kept as group/auto-<slug>; calls recorded under either were counted as two models, so Usage › Sessions' model filter listed the same group twice and the ledger, summaries and session lists split its calls. Ported from NorethSea's 30d6261cd on their fork: UsageAlias names a found group by its public id before the user's alias (both spellings, old session files too), sessions' lists, the ledger keyer, the summary cache's key and Codex's model/effort read through it, and a cache keyed on the group names (UsageNamesKey) is read again when a group is renamed. A user's own provider named "auto" keeps auto/<model> (autoRefsOn). Changed in review: the patch's ledger filter compared every record with provider.SameRef, which reads the providers (customIDs, a stat of providers.json) for each record a filter passes over. FilterOf, the one place a Filter is made from a query, now canonicalizes the model once, and keepsRecord asks the providers only for an auto/ record under a group/ filter (sameGroupModel). Run (mote's sshd reset every connection all afternoon, so on the Linux box through wsl-run; the package run at base |
||
|
|
ea9454d2d8 |
usage: count two ids of one model as one, magpie model alias (SlouchyQuill507 on Discord)
A vendor names one model two ways (deepseek-v4.1-flash and deepseek-flash),
and Usage, Usage > Sessions and `magpie usage` showed two rows. Now:
magpie model alias deepseek-v4.1-flash deepseek-flash
magpie model alias deepseek-v4.1-flash (what it is counted as)
magpie model alias deepseek-v4.1-flash --reset
magpie model aliases
kept as settings.json "usageAliases" {from: to}. Off until one is written.
Ids match as routing groups match them (provider.sameModel: vendor/ prefix,
case, "_", snapshot date), at every provider; a chain is followed to its
end; an alias to itself, a loop, or a flag as an id is refused. A loop
written into the file by hand counts each model under its own id.
Display only: requests, agents' model lists, /v1/models, routing groups,
Same as and prices never read it. Each call is priced by the id it was
made under and only then counted under the alias; the alias's own price
is never put on the other id's calls, and a merged row is priced only
when every id in it is. Applied in usage summarize/direct (Models
groups), the gateway sessions projection (alias read before
gatewayCache's lock; the cache key hashes usageAliases), and
sessions.List/Get/Find/Stats (read before storeMu/mu, merged into new
slices so the memo is untouched; ModelEffort rows merged too). A failed
settings.json read keeps the last aliases read, and SetUsageAlias refuses
to write over an unreadable file (EditUsageAliases under fileMu). The GUI
settings save carries usageAliases. No GUI control.
Not aliased: the Requests ledger's per-request model and its model
filter, which show each call's own id.
Run (worktree at
|