4794de398ea8337d223a91e207181c56fcf4ad76
10
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
c05dd8b6fb |
provider: Tencent Cloud has Token Plan 企业版 as a region, Enterprise plan · China and · Global (#1574, undirectlookable)
#1574 asks for Tencent Cloud Token Plan's usage through TokenHub's DescribeTokenPlan API (api/1823/132270). That API covers Token Plan 企业版, the team plan, only. magpie's Tencent Cloud preset knew the personal plan (api.lkeap.cloud.tencent.com/plan) and TokenHub's pay as you go, not the enterprise plan, so a provider at it had nowhere to sit. The preset gains two regions, after the old three so imports and links are unchanged: - enterprise: https://tokenhub.tencentmaas.com/plan/v3 (chat completions and Responses) and /plan/anthropic, Guangzhou. - enterprise-intl: the same paths on tokenhub-intl.tencentmaas.com, Singapore. Both use the plan's docs (product/1823/130659, 131173 for the 轻享套餐, same endpoints) and the Token Plan console as the key page. Their model lists are the doc's tables for each site, with the three GLM models it says went away on 2026-10-09 left out, and without the deepseek/… ids. An entry imported at those endpoints, a magpie://import link with region=enterprise(-intl) and a provider moved there in the editor land on the region; TokenHub's pay as you go at the same hosts stays at its own. The site's import pages (en, zh, ja) list the two regions, and the region names are translated in zh, zh-TW, ja and de. Run: go test ./internal/provider (TestTencentCloud, TestTencentCloudEnterprisePlan, red before the regions), gofmt; GUI tencent-cloud.test.cjs in Chromium and WebKit, en and zh, 8/8. Not tried with a real enterprise plan key: we have no Tencent Cloud account. |
||
|
|
f04792f906 |
icon: remote icons are fetched through usemagpie.ai/api/icon, so their hosts never see the user's IP
A plugin's package.json icon, an import link's icon= and the library's market icons sit on hosts their authors pick. magpie fetched each straight from there, so an author could log the IP of everyone who opened Discover or the library. The owner asked for icons to keep showing without that. - site/worker.js: /api/icon?url=<https URL> fetches the picture from Cloudflare with only Accept: image/* and its own User-Agent, follows redirects, caps it at 1 MB (the app's MaxIcon), passes on only PNG, JPEG, GIF, WebP, ICO or SVG (by bytes, as StoreIcon), and counts and keeps nothing. It refuses http, userinfo, a non-443 port and usemagpie.ai itself; 404s are cached 5 minutes, 5xx not at all. - internal/iconproxy: URL(u) is the proxied address (MAGPIE_ICON_PROXY for tests); a picture already on usemagpie.ai is asked for as it is. - provider.FetchIcon (plugin, import link and partner icons) and library.fetchImage (market icons, avatars) fetch through it. The import link's checks (https, public host) still come first; there is no direct fallback. provider.FaviconFor still reads the user's own provider's site directly: they already send it their requests. - Privacy text in README en/zh, docs/reference.md and site docs start/import in en/zh/ja says so. Ran: - node --test site/*.test.mjs: 28 pass. The new test asks with Cookie, UA, X-Forwarded-For and CF-Connecting-IP and checks only accept and user-agent go upstream; 415/413/502/400 cases; its fetch stub throws instead of reaching the network. With the usemagpie.ai refusal removed by hand it goes red (27/1). - TestFetchIconGoesThroughTheProxy and TestIconGoesThroughTheProxy (author host is .invalid; an httptest server stands in for the proxy): with the proxy taken out by hand both go red (provider: lookup author.invalid; library: the proxy was never asked), green restored. - go test ./internal/iconproxy ./internal/provider ./internal/library ./internal/gui: ok. gofmt -l clean; go vet darwin (those four), linux (iconproxy, provider, library), windows (all four): clean. |
||
|
|
8d95ebc8c3 |
provider: Bailian Token Plan is a preset of its own, with its decision model for routing groups; the Qwen AI platform's decision model too, and Bailian's shows Bailian's icon (#1506, IamMiao)
Alibaba sells two Token Plans, both with sk-sp- keys, and a key works only on its own host. qwen-token-plan is the Qwen AI platform's (token-plan.maas.qianwenaiapi.com), but its website and keys links pointed at Bailian's console. Bailian's own plan (token-plan.cn-beijing.maas.aliyuncs.com) had no preset. What changed: - presets: new bailian-token-plan (chat /compatible-mode/v1, Anthropic /apps/anthropic, decide on /compatible-mode/v1/systemone, models from the docs' list, shared with qwen-token-plan as alibabaPlanModels). qwen-token-plan's links now point at the Qwen AI platform. New qwen-decision for Qwen's pay-as-you-go decision model at maas.qianwenaiapi.com/compatible-mode/v1/systemone. bailian-decision shows the Bailian icon instead of Qwen's. - decide: bailianDecides also matches the bare maas.qianwenaiapi.com host. A chat preset that also decides on a Bailian/Qwen host (bailianApart) lists decision-model-preview as its only decision model, so it is offered for routing groups and never given to an agent as a chat model. - gateway: dashScope() covers bailian-token-plan and maas.qianwenaiapi.com. - CLI help, docs/reference.md and the import docs (en, zh, ja) name the new preset. Usage: neither plan's docs give a usage or quota API; the remaining quota is only on the console (百炼控制台 Token Plan > 我的订阅, Qwen 工作台 token-plan/individual), which needs a browser session. So no usage card is added. An exhausted plan's 429 insufficient_quota is already read as out of credit. Not tried against the real API: no Bailian or Qwen key was available. The stand-in is an httptest server copying the docs' systemone curl (Bearer sk-sp-, model decision-model-preview) and its error table (401 on a wrong key, 422 on a bad body). qwen-decision sends "Authorization: Bearer <key>"; the Qwen doc's curl shows the bare key, which is untested. Run: - go test -tags nogui -count=1 ./... (temp HOME) - TestBailianTokenPlan, TestQwenDecisionPreset and TestDashScopeHosts fail with the old decide.go and gateway.go swapped in - gofmt -l; GOOS=linux and GOOS=windows go vet -tags nogui on . internal/provider, internal/gateway, internal/gui - GUI: system-one, add-sheet, gateway-decide-info, routing-kind tests in chromium and webkit (20 pass) |
||
|
|
d86a4e0568 |
site: the docs have Docker and Remote magpie pages in English, Chinese and Japanese, listed in every docs page's contents and footer and linked from the READMEs (HuanCheng Bai on Discord)
Until now, both were only in docs/reference.md. The new pages are at
/docs/docker, /docs/remote and their zh/ and ja/ versions.
- docker: the image, its tags, ports, the /config volume and the nonroot
user. How to run it with the browser UI (`web --addr 0.0.0.0:3430
--no-open`, MAGPIE_WEB_KEY, the ?k= cookie). Signing in through the
Callback URL paste or `docker exec ... magpie accounts add`. What
/config keeps, the env vars, sharing with gateway keys, and a Compose
file for a NAS. Healthcheck and updates.
- remote: sharing the main magpie, then adding it as a Remote magpie
from the app, the TUI (a/w/m) or `magpie provider add remote-magpie
<key> url=... id=office`. What comes over (models, groups, APIs,
images, System One, embeddings, prices, quotas) and the errors magpie
shows, quoted from remote_quotas.go and lan.go.
The facts were checked against the code, not reference.md:
- the Dockerfile ENV, VOLUME, HEALTHCHECK and EXPOSE;
- docker.yml's tags;
- web_cli.go;
- the lanGuard in internal/gateway/lan.go;
- the remote-magpie preset.
The Docker page's warning says a Docker gateway answers anyone until
sharing is on, because MAGPIE_ADDR is 0.0.0.0 there.
The new links in the top nav bar carry a toc-only class:
- docs.js still lists them in the contents;
- the bar keeps today's width, since nine links overflowed it at
1024-1280px.
`.steps li` gets min-width: 0, so a long inline code no longer widens
the grid past a phone's width, where `overflow: hidden` clipped the
text.
Run:
- Real containers from ghcr.io/yetone/magpie:latest (v0.1.1150):
- the documented `docker run ... web` came up healthy, and its log
output is what the page shows;
- with "lan": true, `Bearer magpie` got 401 and a gateway key got 200;
- a second container ran `provider add remote-magpie <key>
url=http://<a>:3425 id=office` and listed office/test-relay/... models.
- `node --test site/*.test.mjs`: 23 pass.
- Playwright, in Chromium and WebKit, at 1280, 1024 and 390, light and
dark:
- no horizontal scroll and no nav overflow on all 20 docs pages;
- every internal link and #anchor resolves. /zh/ and /ja/ are routed
by the worker and return 200 live.
|
||
|
|
df95ac6bc2 |
docs, site: Integrating your app or agent with magpie, at docs/integrating.md and usemagpie.ai/docs/integrate (#918, Magixyne)
A developer of an AI app asked how to work with magpie and whether an app can register itself after one confirmation. The page says what exists: the gateway (find it via /api/hello and settings.json's port, the OpenAI, Anthropic, Responses and Gemini endpoints, /v1/models' fields), how a key magpie-<id> or the User-Agent's first word names the app in Usage, a row on the Agents page by an adapter PR in internal/agent (config-edit, Cindy-style own import link confirmed in the app, or a local API) with what the PR needs, what plugins can and can't do, and what isn't there: no link or API registers an app or installs a plugin, and magpie://import adds providers only. English and Chinese pages, linked from every docs page's nav and footer. TestThirdPartyAppIsCountedAsItself pins the attribution the page promises. go vet and the gateway tests pass; site node tests pass; pages checked in headless Chromium (no errors, TOC, no horizontal scroll at 390px). |
||
|
|
1d404db710 | site: the Japanese docs show magpie in Japanese (the owner: 日文文档也要有日文截图) — the ja pages of Getting started, Intent routing and Import showed the English window. Each of their nine shots is taken again with the GUI in Japanese (v0.1.851): once in magpie's own dark and light look (/img/<name>-ja-dark|light.png, drawn by Chromium on the Mac like the en and zh ones) and once for every one of the 22 Omarchy themes (/img/omarchy/<theme>/<name>-ja.webp, lossless, in the VM's Omarchy). omarchy.js takes -ja as it takes -zh, with the sizes of the Japanese shots that differ. Alt texts name the tabs as the Japanese UI does. Locally, with the light look and three Omarchy themes, all nine images on the three pages are the Japanese ones, loaded, at their own ratio. | ||
|
|
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. | ||
|
|
8f385e113b | site: usemagpie.ai draws itself in Omarchy's look on Omarchy, in the theme Omarchy has on (owner: 整个官网和文档页面能否智能识别是不是 Omarchy 在访问,如果是 Omarchy 在访问,那么整个页面风格能否变成 Omarchy 风格?而且能够适配当前 Omarchy 就更牛逼了) — every page (home, /import, the docs in en/zh/ja) loads omarchy.js in a Linux desktop browser only; it tells Omarchy by its font (a page may load local("omarchy"), which Omarchy installs system-wide and nothing else has), remembers it, and from then on paints before the page shows: the theme's palette, the system monospace (Omarchy's font), square corners, no shadows or glass, a solid bar, buttons and what's chosen in the accent, images framed in it. Until magpie tells the theme it takes Omarchy's default (tokyo-night, or catppuccin-latte on a light desktop). magpie's gateway answers GET /v1/magpie/omarchy (name, mode, stamp and the CSS variables magpie's own windows use) to this machine only, readable only by usemagpie.ai (CORS + Private Network Access; MAGPIE_SITE_ORIGIN adds an origin to try the site locally), 404 off Omarchy. The page asks it by itself only once the browser allows it to reach this computer; a chip in the corner (Omarchy's logo and the theme) asks once on a click, lists the 22 built-in themes to pick one, and turns the look off; ?omarchy=1|0|<theme> sets it anywhere. Followed while the page shows: a theme set in Omarchy's menu comes through in about 3 s. Tried in the omarchy VM's Chromium 152 with this magpie (nogui serve): detection, the home page and zh docs in tokyo-night, the chip's menu, following the computer, and omarchy-theme-set catppuccin-latte repainting the open page light. TestOmarchyThemeForTheSite covers 404 off Omarchy, the theme and its CORS for usemagpie.ai only, LAN refused and the preflight. go vet, builds (darwin, GOOS=linux, GOOS=windows) and go test -tags nogui -count=1 ./... under a temp HOME pass. The permission prompt from the public site wasn't clicked through in a real browser. | ||
|
|
b41090f8fa | site: /docs/import's presets are the app's (owner: 需要, after the zh page's missing ones) — the link builder and the Presets chips in English, Chinese and Japanese were behind internal/provider/presets.go: kimi-code(-cn), stepfun(-cn), xiaomi, tencent-tokenhub(-cn), qwen-token-plan, bedrock, clinepass, kilo, commandcode, pipellm and cherryin were missing, and so were the plans of zhipu, zai, stepfun, xiaomi, baidu-qianfan, huaweicloud and bedrock. All 47 importable presets are now listed in the app's order, each with its regions (the first, the default, as no region=); azure and remote-magpie (an address of the user's own) and the Jev routers (no models) are left out. yylx loses its Default option, which was its first region, auto, again. Every preset and region link the three pages build parses with provider.ParseImport (70 links); WebKit at 320/390/1280: 47 options and chips, regions switch and land in the link, nothing scrolls sideways. | ||
|
|
3c79152eb4 | site: docs in Japanese (/docs/ja), and contents that work on a phone (owner: 文档也要支持日语,另外,文档要有友好的目录,在手机端也要有友好的目录) — /docs/ja/{start,intent,plugins,import} translate the English pages; every docs page gets the home page's language menu (English / 中文 / 日本語, the lang cookie) and a ja hreflang, /docs/ja opens the guide, and /ja/'s docs links go to the Japanese pages. docs.js (shared, replacing each page's inline scrollspy) builds the contents: every docs page, the current one's sections under it, the section being read marked with a pill (no left border); the list is sticky and scrolls on its own. Under 900px, where the contents were simply hidden (and under 600px the nav links too, so a phone had no way around the docs), a bar under the nav names the section being read and opens the contents as a menu that closes on a pick, a tap outside or Escape. The nav links give way to the contents under 1000px, long inline code wraps under 1100px, and .doc keeps .wrap's side padding (601-1168px ran the text to the screen's edge). node --test worker.test.mjs passes (/docs/ja redirect added); WebKit at 320-1280, light and dark, en/zh/ja: nothing scrolls sideways, the menu opens, jumps and closes, the bar follows the reading position. |