Repository navigation
feat(llm): binding management in 编辑渠道 + binding-aware 移除模型 - #396
Merged
Merged
Conversation
Multi-binding channels (OpenCode Zen/Go and anything created from the new presets) had no admin surface: bindings could only be fixed by editing SQLite, and 移除模型 deleted the first row matching a model name, which could remove the wrong binding's row. - 编辑渠道 gains option 7 (协议绑定): lists the channel bindings with protocol/auth/default marker, promotes a chosen binding to default (PromoteBinding mirrors channel Gateway/Provider) or walks through endpoint -> protocol -> auth to add a new binding via EnsureBinding - 移除模型 now lists rows through GetModelRowsByChannelId (same 'model [channel/binding/protocol]' display as 查看模型) and deletes by row id (RemoveModelRow), so duplicate model names across bindings cannot collide - new LLMConf states + handlers; helper/interface additions GetBindings, PromoteBinding, GetModelRowsByChannelId, RemoveModelRow - tests: preset/binding promote + add flows (state machine), promote/mirror, row display + row-id delete, bindings ordering; user guide updated
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ModerRAS
added a commit
that referenced
this pull request
Sep 17, 2026
* fix(llm): per-model protocol bindings for OpenCode Zen/Go presets The presets mapped both OpenCode gateways to LLMProvider.Anthropic with a single AnthropicMessages binding, but neither gateway is Anthropic-only: - Go serves /responses (grok-4.6, gpt-5.6-luna) and /chat/completions - Zen is per-model: claude-* -> messages, gpt-*/grok-* -> responses, gemini-* -> Google, everything else -> chat completions - LlmProviderPreset gains optional Bindings + ModelBindingRules (prefix -> binding) and CatalogIsEntitlement to mark subscription gateways - preset creation builds the extra bindings and assigns seeded models to the protocol matched by their name; Zen stays pay-per-token (no auto-seeded models) - Go seeds the official model list and refreshes its catalog add-only from /models, assigning discovered models through the same rules - AnthropicMessagesTransport applies x-opencode-session (per-chat when known), fixing Go's 400 MissingSessionID on the Anthropic-compatible path - IEditLLMConfHelper: EnsureBinding + AssignModelBinding helpers - Tests: LlmProviderCatalogTests, AnthropicTransportSessionTests, preset flow * feat(llm): load provider presets from data (providers.json) Preset data lived in C# and only changed with a release; model seeds went stale and adding a provider meant a code change. - Providers/providers.json becomes the built-in catalog (embedded, with generatedAt); LlmProviderCatalogLoader overlays %LOCALAPPDATA%/TelegramSearchBot/providers.json when present, falling back to the built-in copy with a warning when the override is missing or invalid - LlmProviderCatalog.Presets/GeneratedAt/Source now read that document - default model lists refreshed against current vendor docs: Anthropic claude-opus-5/sonnet-5/haiku-4-5, OpenAI gpt-6-astra/5.6-sol/5.6-terra, Gemini 3.8-flash/3.1-pro-preview/3.5-flash, MiniMax M3/M2.7 (gateway api.minimaxi.com), DeepSeek deepseek-flash/v4-pro, Moonshot kimi-k3/k2.7-code - GeneralBootstrap logs catalog source/version at startup - Tests: LlmProviderCatalogLoaderTests (override wins, invalid override falls back with warning, empty list rejected, built-in keeps all 11 presets and the OpenCode bindings/rules) - Docs: user guide documents the override file and OpenCode protocol routing * feat(llm): binding management in 编辑渠道 + binding-aware 移除模型 (#396) Multi-binding channels (OpenCode Zen/Go and anything created from the new presets) had no admin surface: bindings could only be fixed by editing SQLite, and 移除模型 deleted the first row matching a model name, which could remove the wrong binding's row. - 编辑渠道 gains option 7 (协议绑定): lists the channel bindings with protocol/auth/default marker, promotes a chosen binding to default (PromoteBinding mirrors channel Gateway/Provider) or walks through endpoint -> protocol -> auth to add a new binding via EnsureBinding - 移除模型 now lists rows through GetModelRowsByChannelId (same 'model [channel/binding/protocol]' display as 查看模型) and deletes by row id (RemoveModelRow), so duplicate model names across bindings cannot collide - new LLMConf states + handlers; helper/interface additions GetBindings, PromoteBinding, GetModelRowsByChannelId, RemoveModelRow - tests: preset/binding promote + add flows (state machine), promote/mirror, row display + row-id delete, bindings ordering; user guide updated
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Multi-binding channels (OpenCode Zen/Go, anything built by the new presets) had no admin surface — bindings could only be changed by editing SQLite — and
移除模型deleted the first row matching a model name, which in a multi-binding channel can remove the wrong protocol's row (while查看模型displaysmodel [channel/binding/protocol], so the two commands disagreed).What
编辑渠道→7. 协议绑定id. endpoint (Protocol/Auth) [默认]PromoteBinding(demotes the others and mirrorschannel.Gateway/channel.Provider, per blueprint §七)0starts the add-binding walk: endpoint → protocol (OpenAIChat/OpenAIResponses/AnthropicMessages/Ollama/Gemini) → auth (Bearer/AnthropicApiKey/None), thenEnsureBinding移除模型is binding-aware: rows come fromGetModelRowsByChannelId(same display as查看模型, duplicates becomeshared-model [chan/7/OpenAIResponses]) and are deleted by row id viaRemoveModelRow.GetBindings,PromoteBinding,GetModelRowsByChannelId,RemoveModelRow.Validation
dotnet build TelegramSearchBot.sln -c Release→ 0 errorsTelegramSearchBot.Test→ 452 passed, 1 skipped (6 new tests: promote flow, add-binding flow, promote/mirror, row display + row-id delete, bindings ordering, Go catalog sync add-only)TelegramSearchBot.LLM.Test→ 299/299Notes
RemoveModelFromChannel(name)stays for compatibility; the state machine no longer uses it.