mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-28 08:44:41 +08:00
refactor(usage): fold claude-desktop into claude in the dashboard
The Desktop gateway's proxy traffic is still recorded under its own app_type for route-takeover billing audit (the request detail panel shows the real value), but the dashboard now folds it into `claude` for display. A standalone "Claude Desktop" bucket only ever showed a partial number: Desktop chat usage never passes through the proxy and has no scannable local source, while its Code-tab sessions are just the embedded Claude Code runtime writing into the shared ~/.claude/projects tree — so a separate bucket misled users into reading it as Desktop's full usage. Backend: new `folded_app_type_sql` helper wraps the app_type column in every dashboard read path (10 filter sites + the by-app projection) so `= 'claude'` also matches claude-desktop and GROUP BY merges the two, without changing bound-param counts. Dedup matching and provider-limit checks keep exact comparison; get_request_logs folds only the WHERE filter and keeps the raw app_type in its row projection. Frontend: drop claude-desktop from the dashboard AppType/KNOWN_APP_TYPES filter list, the UsageHero theme, and the now-dead appFilter locale key in all four languages (the managed-app apps.claude-desktop label stays). Adds test_claude_desktop_folds_into_claude_for_display.
This commit is contained in:
+11
-13
@@ -141,28 +141,26 @@ export interface UsageRangeSelection {
|
||||
}
|
||||
|
||||
/**
|
||||
* App types whose token usage is reliably collected by the proxy.
|
||||
* App types surfaced as dashboard filter buttons.
|
||||
*
|
||||
* `claude-desktop` was previously hidden because its rows looked like pure
|
||||
* failure noise — that was an accounting bug: streaming/transform usage of
|
||||
* the Desktop gateway was logged under app_type "claude", leaving only
|
||||
* edge-case rows under "claude-desktop". The backend now attributes all
|
||||
* Desktop traffic to "claude-desktop", so it is a first-class filter option.
|
||||
* `claude-desktop` is intentionally NOT listed: the Desktop gateway's proxy
|
||||
* traffic is still recorded under its own `app_type` (preserving route-takeover
|
||||
* billing audit — the request detail panel shows the real value), but the
|
||||
* dashboard folds it into `claude` for display. It is the embedded Claude Code
|
||||
* runtime running inside the Desktop shell, and Desktop *chat* usage never
|
||||
* passes through this app at all, so a separate "Claude Desktop" bucket would
|
||||
* only ever show a partial number and mislead users into reading it as the
|
||||
* Desktop's full usage. The backend collapses `claude-desktop → claude` in
|
||||
* every dashboard query (see `folded_app_type_sql`).
|
||||
* `opencode` / `openclaw` / `hermes` have no proxy handler at all — they
|
||||
* appear only as managed apps elsewhere.
|
||||
*/
|
||||
export type AppType =
|
||||
| "claude"
|
||||
| "claude-desktop"
|
||||
| "codex"
|
||||
| "gemini"
|
||||
| "opencode";
|
||||
export type AppType = "claude" | "codex" | "gemini" | "opencode";
|
||||
|
||||
export type AppTypeFilter = "all" | AppType;
|
||||
|
||||
export const KNOWN_APP_TYPES: ReadonlyArray<AppType> = [
|
||||
"claude",
|
||||
"claude-desktop",
|
||||
"codex",
|
||||
"gemini",
|
||||
"opencode",
|
||||
|
||||
Reference in New Issue
Block a user