修复:编辑普通渠道时使用已保存凭据获取模型 - #6
Merged
Merged
Conversation
This was referenced Aug 5, 2026
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.
提交说明
Important
变更描述
修复编辑已有普通渠道时“获取模型列表”失败的问题。
复现条件:管理员打开普通渠道编辑抽屉并点击获取模型。由于密钥不会回显,前端原先只在高级自定义渠道编辑时发送
channel_id,普通渠道请求因此缺少保存密钥;上游对未认证请求返回 HTML,后端按 JSON 解析后出现invalid character '<' looking for beginning of value。核心修改:
channel_id。channel_id读取数据库中的已保存渠道配置,复用其密钥、Base URL、请求头和代理。变更类型
关联任务
AI 辅助披露
✅ 提交前检查项 / Checklist
验证结果
go test ./controller -run 'TestFetchModelsSavedOrdinaryChannel|TestFetchModelsAdvancedCustom|TestFetchModelsUsesSharedChannelFetchBehavior' -count=1:通过。go test ./controller -count=1:通过。go test ./...:通过。bun run typecheck:通过。bunx oxlint -c .oxlintrc.json src/features/channels/components/drawers/channel-mutate-drawer.tsx:通过。bun run format:check:通过。bun run build:通过。git diff --check:通过。风险与回滚
风险较低,影响管理员渠道编辑页的模型列表获取逻辑。后端只在请求携带已有普通渠道 ID 时改为读取保存配置,并校验渠道类型;不会修改渠道数据。
若出现回归,可回滚本 PR 的合并提交并重新部署对应品牌。