ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
9ce59b8340 |
routing: a request's row says the credits its reply said it cost (jiabubu)
jiabubu on Discord (#feedback): the Routing page's request list showed no credits for a request that spent them. The gateway already read a reply's usage.credit (#2512) into the usage ledger, which the Usage page shows, but the route trace's RouteUsage had no field for it. RouteUsage now carries Credits (the reply's, nil when it said none). The Routing page's request row shows "N credits" after its cost, or alone when the request has no known price (it read "—" before), with the Usage page's help text under the pointer; By session sums them in the session's cost, shown even when no request in it was priced. The help text "What it cost in its plan's credits, as the reply said" moves from the Usage plugin's i18n.js to the core's, since two plugins say it now. Tests: TestPluginPlanCreditsReachTheLedger also checks the route's usage carries 0.01 on every endpoint (red without the field: Credits <nil>). routing-credits.test.cjs: credits alone, priced plus credits, none, and a session's sum, in chromium and webkit, en zh zh-TW ja de, at 1100 and 420, with no overflow. Broken by hand: the old client.js makes routing-credits 10 of 10 red. Run at the pushed head on mote: gofmt -l clean; go test -run 'TestDailyCredits|TestPluginPlanCredits|Credits' ./internal/provider ./internal/gateway ok; GOOS=linux go vet -tags nogui and GOOS=windows go vet of provider, gateway, gui ok (rebased on origin/main |
||
|
|
c9824bb364 |
usage: each request's row says the credits its reply said
jiabubu (Discord, #feedback) saw a WorkBuddy request's credits shown before, and now nowhere. The gateway still keeps them: usage.Record.Credits from the chat usage's `credit` (#2512) reaches the ledger through the WorkBuddy plugin on every endpoint shape. The ranking, Overview, tiles and Sessions show them too. The Requests list's rows never did: a plan's model there reads "—" for a price, and its detail had no line for credits. Now the cost cell of a row whose reply said credits shows "N credits" (the same ledCredits words as the ranking) in place of the dash, or under the API price reference when the model also has a price. The expanded row has a Credits line. A reply that said none still shows "—". This applies to every credit-priced provider, since it reads the record's credits and not the provider. Tests: - internal/gateway/plugin_plan_credits_test.go: a moved workbuddy-ai plugin replies with WorkBuddy's credit usage. Chat, Messages and Responses, each streamed and whole, each land 0.01 credits in the ledger. - internal/gui/tests/plan-credits.test.cjs: a new test checks the row's cell, its title, a row with no credits, a priced row with credits and the detail, at 1400px and 420px. Run at this head (mote, via mote-run): - plan-credits.test.cjs: 36/36 in Chromium and WebKit, en, zh, zh-TW, ja, de, 1400px and 420px. - go test -run 'PlanCredits|TestCoreScriptBudget|I18n|Lang' over internal/gateway, gui, usage and usageapi: ok. - gofmt -l is clean. GOOS=linux and GOOS=windows go vet for gateway, gui and usage: ok. - The other Usage page files the change reaches, alone, fail the same on the base as with it: - usage-agents-hide: 22 (#3414, #2276). - usage-fold: 4 (#3415). - usage-ledger: 6, "newest live route needs no return-to-live button" (#4078, #3104). usage-curve-zoom-back passes alone. - Rebased from |