Commit Graph
8 Commits
Author SHA1 Message Date
yetoneandggbdpq 7660399a12 gui: a provider's Claude model chip says the number Claude Desktop's menu shows beside it (#2578)
jerrychoi (#2578) has two providers serving the same Claude models, and
Claude Desktop's menu tells them apart only by a 10-digit number. The
provider editor now shows that number on the model's chip.

From ggbdpq's patch (dcb00beb5), changed after reading desktop.go and
Desktop 2.7032's app.asar:
- Desktop renames a row to its own catalog's name ("Opus 5.5") only
  when the id resolves into that catalog, which is the
  magpie-<n>.anthropic.<model> form claudeLooking gives a Claude model
  with reasoning levels. Every other row is named by our display_name
  (which already says the provider) or by its own id, and its number
  never shows in the menu. The patch put a number on nearly every chip;
  DesktopNumber now returns one only for the .anthropic. form ("" for
  mythos-magpie-<n>, anthropic/magpie-<n>, own ids and groups).
- The number shows only while Claude Desktop is installed, and only for
  a model Desktop is shown (CatalogFor("claude-desktop"), not the whole
  catalog, so a model hidden from Desktop gets none).
- The numbers are worked out once per Providers page build, not once
  per provider.
- The GUI test runs en and zh at 900px and en at 420px in both engines
  and checks the badge sits inside its chip.
- docs/subsystems/agent-wiring.md says why the number is there.

The badge reuses the muted .badge.ctx pill beside the context size. Its
tooltip is in zh, zh-TW, ja and de (ggbdpq's strings).

Broken by hand, each watched red then restored:
- ggbdpq's DesktopNumber: TestDesktopNumber red for glm (mythos), glm
  (anthropic/magpie) and a group led by Claude; the GUI Go test red for
  m2.
- the installed check removed: red "without Claude Desktop,
  claude-opus-5-5 says desktop ...".
- provider.Catalog() in place of CatalogFor: red for the hidden haiku.
- j.Desktop dropped: red for claude-opus-5-5.
- app.js without the badge: model-desktop-number.test.cjs 0 passed.

Run (macOS arm64, sandbox HOME, pinned GOMODCACHE/GOCACHE):
- model-desktop-number.test.cjs 6/6 in chromium and webkit (en, zh at
  900px, en at 420px); screenshots checked: zh at 900px shows "Opus 5.5
  [number]" as a muted pill, Sonnet none.
- Go, this tree, as 1160f2e7d before the bodies were reworded (with the
  #2576 commit, on origin/main ebf3f48f7):
  gofmt -l clean; GOOS=darwin, linux and windows go vet -tags nogui
  ./... clean; go test -tags nogui -timeout 45m ./... under pipefail,
  exit 0, 66 packages ok. The same was green at 18828ea1a (on
  6f950653f) and d6881341d (on ed0335f75).
- rebased onto e085d6e92 (six commits, gateway.go and i18n.js among
  them, no conflict) after that run: gofmt and vet of internal/gateway and
  internal/gui clean, and their Models, Desktop, Science and
  ProviderModelsSayDesktopNumber tests ok; the full suite was not rerun
  there.
- GUI, both engines, on this tree: every file that reaches the model
  chips or failed in a whole-suite try, 54 files (349 tests per engine).
  Reds: Codex predictions at 420px (#2624, red on main alone);
  provider-advanced-fold's "Advanced grows open" (#2552, a sampling
  flake under load); and browser launches past 180s. Each of the others
  passed when its file was rerun alone (codex-accounts-via 4/4 in
  webkit; provider-draft-picks and provider-fetch-again in chromium).
- Not done: a whole GUI suite to the end in both engines. Two tries at
  load ~300 (14 cores) failed mostly on browser launches timing out at
  180s, and in one of them another session checked out origin/main in
  the worktree mid-run, so those results were set aside.
Not tried: a real Claude Desktop with two providers of one model, and
the [1m] rows.

Co-authored-by: ggbdpq <67929842+ggbdpq@users.noreply.github.com>
2026-10-17 13:11:43 +08:00
NineSu df29a511e6 gateway: Claude Desktop's model menu names a model as the agents' lists do, by the Provider in model names setting (#1746, marsxxl)
/v1/models for claude-desktop named every model by its own name alone,
with its provider's id in parentheses only where two read the same
(desktopNames, 03421f9f), so with the setting on Codex's list said
"Grok 4.7 @ 500k · Cursor" while Desktop's menu said "Grok 4.7 @ 500k",
and only same-name models got "(cursor)" (Gemini 3.8 Flash (cursor),
(antigravity)). The menu now names models as every agent's list does
(provider.Labels): on, the name with its provider's display name after
it; own, a name the user gave as they wrote it and a vendor's with its
provider's; off, plain names — and two of one name keep their provider's
so they stay apart, while where that still leaves two alike (one
provider's models named alike) the whole catalog id follows, for
Desktop's menu shows the name alone. 蓝猫's plain names (03421f9f) are
the setting's off; a user-given name that already says its provider is
left without it, as Label does everywhere.

Nothing changes for ids, routing, tiers, the 1M listing or the effort
picker. A model whose id reads as one of Desktop's own Claude models is
still renamed by Desktop's own catalog there ("Opus 5.5"), which no
gateway can reach; every other model's display_name is rendered, as the
reporter's "(cursor)" names show.

What was run: go test ./internal/gateway/ -count=1 (ok, 209s) with the
rewritten TestClaudeDesktopPickedModels and TestDesktopNames and the new
TestClaudeDesktopNamesFollowSuffixMode (on/own/off through /v1/models
with the claude-desktop key, red before the change); go test
./internal/provider/ ./internal/agent/ ./internal/codexcat/ -count=1
(ok); HOME=<temp> go test -tags nogui -count=1 ./... (ok, no FAIL);
gofmt -l clean; go vet on darwin, GOOS=linux and GOOS=windows. The
desktop GUI .cjs tests were not run (no playwright in this checkout):
they fake the backend and no GUI file changed. Not tried against a real
Claude Desktop: that it renders these display_name values is from the
reporter's screenshot, whose "(cursor)" names were this same field.
2026-10-13 05:48:39 +08:00
yetone 03421f9f42 agent: Claude Desktop's row picks which magpie models Desktop's own model menu lists, several at once, and the menu names them by the model's own name (蓝猫 on Discord: wanted to pick a few models and switch among them in Desktop, and Desktop showed "DeepSeek V4.1 Flash (opencode-go)" where they want "DeepSeek V4.1 Flash") — Desktop already read its menu from the gateway's /v1/models for claude-desktop (desktopModels over provider.CatalogFor, i.e. every visible model minus the agent's HiddenModels, each under a claudeLooking alias), but its row offered no way to pick them: the start button stood the opus tier there as 「上次的选择」, and display_name was "Name (provider/model)" with that id again in description. Now Desktop's row (MENU_FROM_LIST in app.js) puts a model button where another agent's start pick stands: it names the first two picked models (+N, or "No models"), its title says Desktop reads the list as it starts so it must be quit and reopened after a change, and it opens the existing per-agent model list (openAgentModels, the am-pop multi-select posting {hidden} to /api/agent-models/claude-desktop), which stays open while several are ticked; the button, the line under the name ("Connected · n models in Claude Desktop's model menu") and, in the tray panel, the row's summary are refilled on each save instead of the row being redrawn; the panel's opened row has the same button under the provider, the expand link says Details, and the opened row's "In Claude Desktop" says the menu lists the models picked here and that Desktop reads it as it starts. The provider switch (default vs magpie) and the tiers are as before. /api/state's model count carries the first three shown models' names (modelCountJSON.Names). desktopNames gives each model its own name and keeps a suffix only where two picked models share one, case-insensitively: the provider id, or the whole id if that still collides; the description is gone. Models added later still show by default, as for every agent's list. zh strings added (no ja). TestClaudeDesktopPickedModels (two providers' DeepSeek V4.1 Flash read "(opencode-go)"/"(relay)" while both are listed, and after relay's, glm-5 and the routing groups are hidden Desktop lists exactly the three left, the DeepSeek plain, while another agent still lists all) and TestDesktopNames are new; the effort and tier tests map Desktop's rows by DesktopCatalogID instead of the description. internal/gui/tests/desktop-model-menu.test.cjs (window and panel, en and zh: the button's names and title, no 「上次的选择」, the list's ticks, unticking GLM-5 posts the whole hidden list and updates button, line and summary while the list stays open, ticking Kimi K3 back, no scroll, no native select) passes in webkit, as do desktop-tiers, agent-models, agent-connect, agent-start-pick, agent-layout, agent-grip, click-scroll, agent-models-all-hidden, agent-model-groups, agent-models-loading, agent-expand-steady, agent-disconnect, agent-tweak-fold, show-unset-agent, tray-cell-click, library-desktop-skills and by-agent. go vet ./internal/..., builds (darwin, GOOS=linux -tags nogui, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. Not tried in real Claude Desktop: that its menu shows the plain names and only the picked models after a restart is from the /v1/models it is served, not seen in the app. 2026-10-04 05:01:12 +08:00
yetone fb1575730e gateway: Claude Desktop offers its thinking-effort picker for magpie's models that take reasoning levels (ARNO: 接入claude desktop后无法设置思考强度,不确定是哪里的问题) — in a gateway's mode Desktop reads no effort from /v1/models (IIt keeps id, display_name, description, supports_1m, anthropic_family_tier), and its model catalog must be Anthropic's signed file, so a model's levels come only from tIt in index.chunk-D3OyLXgG.js: let t=IC(e),n=HFt[t]??(UFt.test(t)?VFt:void 0). HFt is its own table (claude-sonnet-4-6, claude-sonnet-5, claude-opus-4-6/4-7/4-8, claude-opus-5), UFt /^(?:claude-)?(?:fable|mythos)(?:-|$)/ with VFt low…max, and IC the lowercased id with a "<label>.anthropic." prefix and a date taken off (qS). magpie's ids (provider/model, anthropic/magpie-<n>) were neither, so no model had the picker, not even a real Claude one. A model with reasoning levels is now listed as mythos-magpie-<n> (UFt matches; no haiku/sonnet/opus in it, so Desktop's small_fast pick is unchanged), or, for a real Claude model, as magpie-<n>.anthropic.<claude model> (IC reads it as that model, so HFt gives its own levels). One without levels is listed as before. aliased serves all three forms, with or without [1m]. Checked against Desktop's bundled Claude Code 2.1.280 in a sandbox HOME, pointed at a local logger: mythos-magpie-<n> goes out exactly as anthropic/magpie-<n> did (thinking adaptive, output_config.effort as picked, 32000 tokens); magpie-<n>.anthropic.claude-opus-4-8 goes out exactly as x/claude-opus-4-8 did, known as Opus 4.8 (no unrecognized_model warning, 64000 tokens). The effort then reaches the model fitted to its levels: Anthropic passthrough now fits output_config.effort as Chat's reasoning_effort and Responses' reasoning.effort already were (bodyEffort/withBodyEffort), so Desktop's max goes to a low/high model as high. VFt always thinks: Desktop offers no "off" for a non-Claude model with levels. A session saved on an old id must be moved once to the new entry in the picker; magpie still serves the old id. 2026-09-29 00:53:16 +08:00
yetone 63f9fa7465 agent: Claude Desktop runs on magpie in its third-party mode (#156: Claude Desktop 不会解锁 Claude Code 面板 — CC Switch 可以,咱这个支持吗?) — signed in with a Free account, Desktop's Code tab is only "Get Claude Code"; in its 3p deployment mode it needs no Anthropic sign-in and Code and Cowork run on the gateway. A Claude Desktop agent whose provider field switches it: on writes deploymentMode "3p" into Claude/ and Claude-3p/claude_desktop_config.json, a magpie profile in Claude-3p/configLibrary/<id>.json (inferenceProvider gateway, inferenceGatewayBaseUrl the gateway's address, inferenceGatewayApiKey magpie-claude-desktop, inferenceGatewayAuthScheme bearer; disableDeploymentModeChooser and coworkEgressAllowedHosts ["*"] only where unset) and its entry in _meta.json, applied — the keys and files CC Switch writes (claude_desktop_config.rs). No inferenceModels: Desktop lists /v1/models, which the gateway already gives it by ids it keeps. Off puts each deploymentMode back as it was (gone where there was none), the profile applied before applied again, magpie's profile and entry removed, and files and folders magpie made gone if nothing else went in; other keys and profiles are never touched. Folders as CC Switch finds them: ~/Library/Application Support, %LOCALAPPDATA% (a Claude… folder there if not Claude itself), $XDG_CONFIG_HOME. Desktop reads them at start-up, which the picker and notice say. The Library keeps giving Desktop's MCP servers to %APPDATA%'s file on Windows, listed once. Tested in a sandbox home: fresh, with the user's settings and 3p profiles (off restores every byte), on twice, on → off → on, drift, odd files refused, each system's folders; and against Claude Desktop 2.9939.2 on Windows 11 (winget): on, it started in 3P mode (provider gateway, apiHost the gateway) with the Code tab and no sign-in, and asked the gateway's /v1/models; off, it went back to claude.ai 2026-09-28 22:37:26 +08:00
yetone 35f43e6665 gateway: Claude Desktop keeps every magpie model (#148) — its gateway check drops any id naming another vendor's model (deepseek, kimi, gpt, codex, glm, qwen… anywhere in it, anthropic/ in front or not), so anthropic/deepseek/deepseek-flash was turned away and, asked without the magpie-claude-desktop key, /v1/models gave it bare ids it kept none of ("returned 0 usable models { rawCount: 13 }"). A model whose id doesn't already read as Claude's is listed to it as anthropic/magpie-<number>, a hash of its magpie id that magpie serves again (/v1/messages, count_tokens, /v1/models/{id}, with [1m] too), its name as display_name and its magpie id as description; Desktop is known by its Electron User-Agent (… Claude/<ver> Chrome/…) as well as by the key. Checked with Desktop's own checks cut out of its app.asar against a sandbox gateway: 4 of 4 kept, was 0 2026-09-28 18:50:11 +08:00
yetone b1fa0c5dfa gateway: to the key magpie-claude-desktop, /v1/models lists every model by an id Claude Desktop takes — anthropic/<id> for one that doesn't say claude, sonnet, opus, haiku or anthropic — so its Test connection passes and its models can be picked from the list 2026-09-28 10:24:56 +08:00
yetone e1f784430b gateway: Claude Desktop's third-party gateway reaches any of magpie's models — it takes only ids that say claude, sonnet, opus, haiku or anthropic, so a model asked for as anthropic/<its id> is served as <its id> when nothing answers to the id as it stands; count_tokens and /v1/models/<id> read it the same, an id with a slash in it is found at /v1/models/<id>, and GET/HEAD /api/hello answers the gateway's probe 2026-09-28 10:17:05 +08:00