Commit Graph
6 Commits
Author SHA1 Message Date
yetone 209dc69b59 providers: Tencent Cloud is one preset, its regions Plan · China, Pay as you go · China and Pay as you go · Global (Discord, Jorben: Tencent Cloud's Token Plan, TokenHub and TokenHub China were three tiles of one vendor) — tencent-token-plan, tencent-tokenhub-cn and tencent-tokenhub become tencent-cloud's regions plan, cn and intl, as Xiaomi MiMo's are, each made as its own preset made it: the plan's /plan endpoints with no Responses, its own models and no catalog; TokenHub's hosts with Responses, models.dev's tencent-tokenhub and its own keys page and docs. A region now carries its Website, Catalog and Models, and a saved provider's region is found by its endpoints (regionOf, by exact URL before path, since TokenHub China and global share their paths): normalize gives it that region's keys page, docs and catalog (a catalog the user picked is kept), and planModels its models. The old ids are aliases, as qianfan-token-plan is of baidu-qianfan: Preset and FromPreset take them, FromPreset builds at their region, normalize rewrites a saved provider's preset to tencent-cloud, and a provider's own id never changes, so its key, models, routing groups, usage and prices stay where they were; magpie://import links by an old id land at its region, and region= now also gives a region's docs and catalog. Imports from other apps match a region's endpoints. The editor's docs link follows the region picked with the segmented control, en and zh ("按量 · 中国", "按量 · 国际"); the add sheet has one Tencent Cloud tile; the site's import docs list tencent-cloud with its regions and import.html still names the old ids. TestTencentCloud (each region, old ids, FromPreset, imports, import links) and TestTencentCloudOldPresetsKeepWorking (a providers.json saved by an older magpie under all three old presets, with a routing group over them, read, re-saved as the editor saves and switched between regions) fail on the old code; TestTencentTokenHubRoutes routes through old ids and tencent-cloud alike. tencent-cloud.test.cjs (WebKit en and zh: one tile, the three regions, no select, the docs and Get a key links following the region, an old id's provider opening at its region and saved under its id) fails on the old app.js; add-sheet, zhipu-team, system-one, strip-scrollbar and click-scroll pass (Chromium doesn't launch in this sandbox). Not tried with a Tencent account. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. 2026-10-04 19:38:14 +08:00
yetone 4696d14726 gui: Add provider unrolls its sheet under the list again, and closing it leaves no blank (the owner: 点击「添加供应商」为啥是弹出 modal 而不是像以前一样的交互(展开滚动)· 在添加供应商时会有两层弹窗,很丑,不符合设计原则)
#433 made the add sheet a dialog over the list, to get rid of a blank left under the list once the sheet was closed; but a vendor picked in it opens its editor, a dialog of its own, over that dialog: two layers. The sheet is back under the list, unrolling as the view goes down to it, the button at the view's foot stepping aside while its head is in sight. The blank was the page holding on to the Close clicked: with the sheet gone it held the sheet's neighbours where they were and kept its height as empty room at the view's foot. Closing the sheet (Close or Escape) now lets that hold go and takes the room away, so the list ends at the view's foot as before the sheet opened, and the focus goes back to Add provider, which comes back at once rather than at the end of its fade (it couldn't take the focus while still hidden). Kept from #433: Duplicate and Add another open the new editor without the sheet, an editor opened from the sheet gives the focus back to its option on close, a reload keeps the search's focus and caret, and the search's Escape empties it, then closes the sheet, and never hides the tray.

add-button is pre-#433's again (one click at the end of a long list unrolls the sheet and takes the view to it; scrolled back up, the button takes it there again; logos kept across a dialog) and now closes the sheet by Close twice and by Escape, checking no room is left, the height and scroll are those before it opened, and the focus is on Add provider; with the hold left in place it fails "Close left a blank under the list" in Chromium and WebKit, English and Chinese. add-sheet drops #433's focus trap and checks the sheet, not a backdrop. The 25 tests touching the sheet, Add provider, Duplicate or Add another pass, as does old-webkit; click-scroll passes in WebKit, and in Chromium fails the same four routing/usage cases as unchanged main on this loaded machine. go vet, go build -tags nogui (darwin, GOOS=linux), GOOS=windows go build and go test -tags nogui ./internal/gui/ pass.
2026-10-02 11:03:29 +08:00
Fanbuzandfanpeng 1eb2640d7e fix: 添加供应商改用遮罩并保持列表位置 (#433)
* fix: 添加供应商改用遮罩并保持列表位置

* fix: 统一供应商浮层键盘导航并拦截搜索框退出

* fix: 保留供应商浮层滚动位置并恢复刷新焦点

---------

Co-authored-by: fanpeng <fanpeng@xintukj.com>
2026-10-02 10:15:35 +08:00
yetone 2364f8b5ff providers: the add sheet's rows carry no region tag, the logos stay put when a dialog opens or closes, and "Add provider" sits at the view's foot and reaches the sheet on the first click (Image #27: 国际中国还是有点像狗皮膏药; 每次打开或者关闭弹窗的时候,Provider的logo都会重新刷新一遍; Image #28: 添加供应商要固定在底栏底部…第一次点击的时候没有任何事情发生) — a vendor's merged global/China row lost its "Global · China" tag (design B1): the region is picked in the editor's Region switch and the row's title still lists each region's host. Every redraw of the Providers page made each logo anew, so each one faded in again whenever a dialog opened or closed; renderProviders now hands the logos it drew to icon() to reuse (the editor drawing its own), so they are moved, not remade. "Add provider" is sticky at the view's foot over a long list and steps aside while the sheet's head is in sight; the first click opened the sheet but WebKit clamped the scroll before it grew, and unrollSheet took that for the reader scrolling and gave up — it now starts from where the view really is, and a click with the sheet open eases the view to it. Tested with add-button.test.cjs (new: the bar at the foot at the top and the end, one click reaching the sheet, the bar away and back, a dialog opened and closed keeping every logo; fails on main) and add-sheet.test.cjs (no tag, the hosts in the title), Chromium and WebKit, en and zh; click-scroll passes; the full GUI suite passes but login-import, which fails on main under load. go vet, go build -tags nogui (and GOOS=linux, GOOS=windows) and go test -tags nogui ./... pass. 2026-09-30 02:26:28 +08:00
yetone f18d4e886b providers: the add sheet as A3 — a small green dot after an added name and a grey count past one account, short names with the full name, plans and host in the title, bolder section heads with more room, and a vendor's global and China presets one row marked Global · China whose editor picks the region (keeping the key typed); the editor now grows out of the row clicked on a spring and folds back into it on close, iOS-like, with reduced motion respected (A3; 点击这些供应商,弹出表单Modal以及关闭表单 Modal 的时候,要有一个极其优雅丝滑的动画,类似于iOS的动画) — the list's scroll is restored before the modal closes so the fold lands on the row. Tested with add-sheet.test.cjs in Chromium and WebKit, en and zh, recording the open and close keyframes, and the whole GUI suite (login-import flakes under load on main too). 2026-09-30 00:24:57 +08:00
yetone a4a9893969 providers: the add sheet is quiet rows under four headings, an added provider marked in green, and a custom provider one line at the foot (Image #24: 这个页面看起来有点乱糟糟的,能否变得特别简洁优雅? — design A of four) — the sheet was framed tiles of two lines each (name and host or plans), the added ones faded with a check, sections named "Relays · many vendors behind one key" and the like, and a dashed Custom tile among the local ones. Now each section is a bold name and a faint word on what it is (Subscriptions · sign in, no key; Vendors · the makers' own APIs; Relays · one key, many vendors; On this machine; Removed from magpie · still signed in, 订阅 · 登录即可,无需密钥 …), and under it rows three to a line, 36px, with no border: the icon and the name, the host, note or plans in the row's title. A provider already added is no longer faded: "✓ Added" (已添加) in green at the right, a subscription "✓ Signed in", "1 account" or "2 accounts" (2 个账号), its title saying a click switches or adds an account; a removed one "Add it back". The custom provider is "+ Custom provider · any OpenAI or Anthropic compatible URL" (自定义供应商 · 任意 OpenAI / Anthropic 兼容的 URL) under a hairline at the foot, hidden while searching as the "Nothing called…" line takes its place. Clicks do what they did (a preset's editor, an added one's page, a sign-in); the header, search and Import… are unchanged. Unused zh strings removed. No border stripes. Tested with a new internal/gui/tests/add-sheet.test.cjs in Chromium and WebKit, en and zh (fails on main): the headings and words in order, no row with a border, a second line, overflow or fading, three vendors on a line at 900px, Added in green on Anthropic and OpenRouter and none on OpenAI, "2 accounts" on Claude, the host in OpenAI's title, the foot line and its hint, searching "deep" leaving DeepSeek alone and no foot, and a click opening DeepSeek's editor. The whole GUI suite passes (four files flaked under the parallel run and pass serially), go build -tags nogui (and GOOS=linux, GOOS=windows) and go test -tags nogui ./... pass. The regions (Kimi and Kimi China …) are not merged into one row. 2026-09-29 22:24:05 +08:00