Skip to content

[feat] providers: reuse a BigModel account across model categories - #289

Open
PCcoding666 wants to merge 2 commits into
ThinkFlowLab:mainfrom
PCcoding666:feat/234-shared-bigmodel-connection
Open

PCcoding666 wants to merge 2 commits into
ThinkFlowLab:mainfrom
PCcoding666:feat/234-shared-bigmodel-connection

Conversation

@PCcoding666

@PCcoding666 PCcoding666 commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adding a BigModel model in another category currently requires entering the account key again. This change lets users select a saved mainland BigModel account across chat, image, video and audio. Account identifiers distinguish credentials on the same endpoint. Key rotation applies to the selected account, and editing or deleting models applies to the selected category.

Refs #234. The integrated branch includes the current GLM chat, GLM-Image, CogVideoX-3 and GLM-TTS presets. Each category retains its own protocol and proxy settings, including bigmodel_video for CogVideoX-3. Frontend and backend connection checks use the same explicit category allowlist.

Verification

At ed71facf, integrated with upstream 691135f, on Apple Silicon:

  • All 820 Node tests passed in serial. The preset tests exercise all 16 source/destination category pairs with the current upstream presets, two accounts, and incompatible connections.
  • All 70 model configuration and catalog tests passed. The API tests cover all 16 category pairs, persisted reload, destination protocol and proxy preservation, selected-account key rotation, and category-scoped deletion.
  • All 116 existing BigModel image, video and TTS adapter tests passed.
  • Production build, bilingual validation (3,015 keys), generated contracts, import boundaries and the full PR-diff static checks passed.

Settings evidence

Chromium exercised the current integrated app through an isolated local API. With two fixture image accounts, I selected account A in English and account B in Chinese, saving all four categories in each language without reentering a key (eight saves). The original image records stayed intact, saved video models kept the bigmodel_video protocol, and closing/reopening settings showed both distinct video accounts. The page reported no JavaScript errors.

Reusing account A in English Reusing account B in Chinese
English video account reuse Chinese video account reuse

Regression tests above use fixtures; the separate real-account acceptance below uses the production adapters.

Live BigModel acceptance (2026-11-16)

Ran the integrated ed71facf app on Apple Silicon against the official BigModel API, in a fresh isolated project. Saved one real account key once, then reused the saved account across all four categories. These calls used the production assistant HTTP route, bundled OpenCode runtime, project commands, background jobs and provider adapters.

Capability Real model Observed result
Streaming chat + tool use glm-5.3-flash One assistant turn completed without an error. The runtime checked CLI help, wrote bigmodel-check.md exactly once, received an applied receipt and confirmed it. Three upstream streaming requests returned HTTP 200; the 42-byte file matched the expected text.
Image glm-image One request produced a readable 1280 × 1280 PNG.
Video cogvideox-3 One text-to-video submission, with its remote task ID persisted, completed through normal asynchronous polling. Requested 5 seconds / 1280 × 720 / no audio; the returned H.264 file measured 5.193548 seconds at 1280 × 720, without audio.
Speech glm-tts, preset tongtong One short Chinese sentence produced a readable 24 kHz mono WAV, 4.588 seconds long.

All three media jobs succeeded, passed the app's file checks, and were explicitly adopted through result.select. Stopped and restarted the backend, opened a new session, and verified the exact bytes of all four assets, all three selected result IDs, the saved conversation and the shared account identity. Reused each media asset as a new material node after reopening; asset, job and result counts stayed unchanged. The reopened browser decoded the image and played both the video and audio to their ends with no decode errors.

The live run made six provider POST requests: three streaming chat requests and one each for image, video and speech. Reopen, reuse and browser playback made no additional model submissions. Native runtime counters reported 10,513 chat tokens; those counters are not an account billing statement.

Reopened project with generated and reused media and completed assistant tool call

All four model categories configured with the shared real account

Sanitized request, file, reopen, reuse and browser evidence. Credentials, raw model traces and signed provider media URLs are excluded.

Live scope: one account, text-to-video and a preset voice. Multiple-account isolation and category-scoped edits/deletions are covered by the fixture regressions above. Image-conditioned/first-and-last-frame video, voice cloning and fault recovery were not exercised against the real service in this run. This is functional/file/playback acceptance, not a creative-quality benchmark.

Prepared and tested with Codex assistance.

@Zhangbo-cn

Copy link
Copy Markdown
Contributor

Heads-up on an overlap with #276 (GLM-TTS, same parent RFC #234). Both PRs touch providerPresets.ts, tests/providerPresets.test.ts and the two user guides, and the zhipu preset is the specific collision.

I merged your branch (d08f51ce) against #276 locally to check rather than guess. Two conflicts, both small:

CONFLICT (content): src/canvas/providerPresets.ts
CONFLICT (content): tests/providerPresets.test.ts

The preset one is two lines - #276 widens the same entry to serve GLM-TTS:

<<<<<<< #276
    kinds: ["agent", "audio"],
    url: "https://open.bigmodel.cn/api/paas/v4",
=======
    kinds: ["agent"],
    url: BIGMODEL_URL,
>>>>>>> #289

Resolution is kinds: ["agent", "audio"] plus your BIGMODEL_URL constant - the two changes are complementary, not competing. The test conflict is only textual adjacency: both new cases should be kept as-is, neither needs editing.

I verified the resolved merge: tsc --noEmit clean and 772 Node tests pass with both test cases present. Your matchingConnections case already includes a kind: "audio" record and still passes once the preset carries audio.

Whichever lands second gets this conflict, so no action needed now - just flagging it early since it is a two-line fix if you know about it, and a confusing one if you don't. #276 is currently approved with checks green, so it will likely be first; happy to do the rebase on my side instead if you'd rather land #289 first.

One unrelated observation while reading the diff: isBigModelConnection gates on model.kind !== "vision" while is_bigmodel_connection uses an explicit {agent, image, video, audio} allowlist. Those agree today because ModelKind has exactly those five members, so this is not a defect - but the frontend would silently admit a sixth kind that the backend rejects. An allowlist on both sides would keep them in step.

@Zhangbo-cn Zhangbo-cn mentioned this pull request Nov 12, 2026
3 of 10 tasks
@PCcoding666
PCcoding666 marked this pull request as ready for review November 16, 2026 07:36
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T07:48:06.811020Z ed71fac Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added area:canvas Canvas, nodes and direct manipulation area:provider Model providers and generation protocols type:feat New capability or behaviour labels Nov 16, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ed71facfc4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +208 to +209
previous = [item for item in models if (item.get('providerId') == provider_id and item['kind'] == kind)
or (item['id'] == config_id and not cross_category)]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include legacy vision peers in the replacement set

When an existing multi-model vision service is managed from the Image or Video category, legacy_segmentation still allows the save, but this filter includes only the anchor because its peers still have kind == 'vision'. Saving a two-model service with both models therefore produces three records: the second old vision record survives and a duplicate is created with a new ID. Deselecting that model also fails to remove it. Include the legacy source-kind peers in previous during this supported conversion so the saved selection and model identities are preserved.

Useful? React with 👍 / 👎.

if cross_category:
# Promote an explicitly selected standalone record, preserving its model ID.
existing['providerId'] = provider_id
previous = [item for item in models if (item.get('providerId') == provider_id and item['kind'] == kind)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please include legacy vision peers in previous to avoid duplicate models on save, and cover retaining and deselecting peers in a regression test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:canvas Canvas, nodes and direct manipulation area:provider Model providers and generation protocols type:feat New capability or behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants