Commit Graph
10 Commits
Author SHA1 Message Date
Cursor AgentandSimon Shi 70fba627e6 fix(lint): clear biome errors breaking CI on main
CI was red at the lint step: an unused providerID parameter in
createQoderOAuth, an unused getCachedCredentials import in stream.ts,
plus unsorted imports and stale formatting in stream.ts and pat.ts.

Co-authored-by: Simon Shi <simonsmh@users.noreply.github.com>
2026-08-31 15:57:20 +00:00
Simon ShiandGitHub 6a0d08c04c Merge branch 'main' into fix/qoder-cn-login-windows-build 2026-08-31 23:43:40 +08:00
Loongphy b462207447 feat(cn): expose upstream display_name as model id, drop key mapping tables
The CN model picker used to translate Qoder's internal keys (qfmodel,
qmodel_latest, ...) into hardcoded "friendly" ids (qwen3.6-flash, ...) via a
manual mapping table, with the display label hardcoded alongside. Both
sides rotted independently of upstream: when Qoder upgraded qfmodel to
Qwen3.8-Flash the label stayed "Qwen 3.6 Flash", and new keys (qmodel_38max,
q37fmodel) had no entry so their raw key leaked into the picker as the id.

The catalog API already returns every key with its display_name, so the
mapping table duplicates data the server provides and can only ever be stale.

Rework: use the upstream display_name (whitespace-stripped) directly as the
pi-visible Model.id, and read the request-time upstream key back from the
cached model config at send time. No key<->friendlyId table is needed.

- cosy.ts: remove qoderCNFriendlyModels, getQoderCNDirectModel,
  getQoderCNFriendlyModelInfo, toQoderCNFriendlyModel, prettifyQoderCNModelName.
  Add toQoderCNModelId(display) = display with whitespace stripped.
- models.ts: updateQoderModelsCache now sets CN model id =
  toQoderCNModelId(display_name); the original key is still stored in configs
  (keyed by both key and id) and read back via getCachedModelConfig. Simplify
  the CN fallback in getCachedModelConfig (drop the stale reasoning set).
  staticCnModels ids/names rewritten to the display_name form.
- stream.ts: the upstream key comes from modelConfig.key (the cached entry)
  instead of a reverse-lookup table; falls back to model.id for the
  international site, which already uses the key as id.
- index.ts: modelsForProvider no longer re-maps CN models through a friendly
  transform — the cached/static ids are already the display name.

Trade-off: a renamed/upgraded model changes its id, so a previously saved
default model may no longer resolve after an upstream rename and the user
reselects. This is expected: users should learn about new models. This is
accepted.

Tests updated for the new contract; e2e against the live CN catalog confirms
id=Qwen3.8-Flash resolves to send key=qfmodel with no mapping table.
2026-08-28 08:16:36 +08:00
xing.huang 443e4ad6a7 fix: qoder-cn chat identity, content normalization, and Windows build
- Resolve the real Qoder identity (userID/email/name/machineID) from the
  job token at request time. OMP keeps login credentials in its own
  agent.db, not in ~/.pi/agent/auth.json, so a cache miss sent uid
  "qoder-user" and Qoder CN rejected it with "Login expired" (105).
- Normalize the system prompt to a plain string. OMP supplies it as a
  single-element content array which Qoder's MessagesInputDto#content
  (String) rejects with 400 "Execution failed: set property" on qwen models.
- Drop the modifyModels hook. OMP (Bun) structuredClones the whole model
  catalog before invoking it, and its bundled catalog is not cloneable,
  which removed qoder from `omp models`.
- Make the build script cross-platform: use esbuild on PATH instead of a
  Unix-style ./node_modules path that fails on Windows cmd.exe.
2026-08-18 12:22:47 +08:00
Simon Shi ef672a5461 fix: refresh Qoder models before startup 2026-07-22 19:54:46 +09:00
Simon Shi a98b9573f4 feat: auto-login from Qoder API key 2026-07-20 18:22:35 +08:00
温习江湖andGitHub 2b2f427628 Support Qoder CN (#4)
* feat(qoder-cn): add region endpoints and model catalog

* feat(qoder-cn): add separate provider auth and streaming

* docs: document Qoder CN provider
2026-06-26 14:42:36 +08:00
Simon Shi 26be3e0e17 refactor: optimize model cache updates by moving to session_start hook & bump to 0.2.1 2026-06-16 13:39:24 +08:00
Simon Shi bcaa66091e fix: route PAT login through pi LoginDialog callbacks
The custom ctx.ui.custom login menu stole focus from pi's built-in
LoginDialog, so onPrompt never received keystrokes and PAT login
silently failed with 'No API key found'. Drive login via the provided
onPrompt/onAuth/onProgress callbacks instead, and drop login-ui.ts and
the now-unused pi-tui dependency. Also clears remaining lint warnings
by removing any-casts in models/oauth/stream/transform.
2026-06-16 13:39:16 +08:00
Simon Shi dd8c313984 feat: init pi-provider-qoder plugin with oauth, signature and WAF bypass 2026-06-16 13:38:48 +08:00