Skip to content

feat(frontend): add fetch-from-upstream button in model mapping - #7413

Open
Bliod-Cook wants to merge 1 commit into
QuantumNous:mainfrom
Bliod-Cook:feat/channel-mapping-upstream-models
Open

Bliod-Cook wants to merge 1 commit into
QuantumNous:mainfrom
Bliod-Cook:feat/channel-mapping-upstream-models

Conversation

@Bliod-Cook

@Bliod-Cook Bliod-Cook commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

⚠️ 提交说明 / PR Notice

English template: .github/PULL_REQUEST_TEMPLATE/en.md

Important

  • 描述可用 AI 辅助。提交前请审阅全文,并声明对其负责,避免未经核对的直接粘贴。
  • 请按本模板填写后再提交。

🔗 关联任务 / Related Issue

  • 新功能请填写下方 Issue 编号;若还没有对应 Issue,请先自行创建。功能讨论请放在 Issue 中进行。

  • 改动较大或方向性变更,请先在关联 Issue 中与维护者达成一致,再提交 PR。

  • Bug 修复请关联对应 Issue。设计取舍、理解偏差或预期不一致,更适合作为讨论或功能请求。

  • Closes 模型重定向时允许从上游拉取模型 #6101

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix)
  • ✨ 新功能 (New feature)
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

📝 变更描述 / Description

(简述做了什么、为什么生效。如果难以简述,建议先拆分范围,或在 Issue 中与维护者对齐。)

重新实现了旧版UI中在模型重定向设置中,从上游拉取模型填入的按钮

实现方式是为现有模型列表增加单选模式,因此自带结果缓存,可以保证操作的流畅性

附加更改:

  1. 修复弹窗操作时输入框抢占焦点的问题。
  2. 修复在从未配置模型重定向时,第一次添加模型映射不会成功的问题
  3. 移除原来的输入框的 datalist 候选提示,我认为这个功能对操作没有带来过多的便捷性

📸 运行证明 / Proof of Work

(请写明如何验证:实际步骤与观察结果。UI 变更请附截图或录屏;Bug 修复请说明复现过程与修复后结果。)

旧版UI的图片:
image
新版UI的图片:
image

✅ 提交前检查项 / Checklist

  • 人工确认: 无论描述是否由 AI 生成,我已审阅全部内容,并声明对其准确性与完整性负责。
  • 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • 新功能关联 Issue: 若此 PR 标记为 New feature,我已关联对应 Issue;若尚无 Issue,我已先自行创建。
  • 事前沟通: 若改动较大或涉及方向性变更,已在关联 Issue 中与维护者沟通并达成一致。
  • 功能范围: 本 PR 不是 Coding Plan、逆向渠道、第三方封装接口,也不是对 Codex 渠道类型的改动。
  • 范围聚焦: 本 PR 为一项聚焦改动,未包含无关代码。
  • 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核。
  • 安全合规: 代码中无敏感凭据,且符合项目代码规范。

Summary by CodeRabbit

  • New Features

    • Added a dialog-based model picker for supported channel configurations.
    • Fetch, refresh, and apply discovered upstream models from the channel setup interface.
    • Added single-model selection with search, keyboard navigation, and clear empty-state messaging.
    • Preserved manual model entry and supported mapping formats alongside discovered models.
  • Bug Fixes

    • Prevented clicks from portaled popups from incorrectly triggering input-group actions.

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 29f35c4b-b6de-4440-af2b-5cbb93dd5461

📥 Commits

Reviewing files that changed from the base of the PR and between 69a5002 and 4e3b889.

📒 Files selected for processing (8)
  • web/src/components/ui/input-group.tsx
  • web/src/features/channels/components/__tests__/channel-configuration.test.tsx
  • web/src/features/channels/components/__tests__/model-mapping-editor.test.tsx
  • web/src/features/channels/components/__tests__/upstream-model-selection.test.tsx
  • web/src/features/channels/components/drawers/channel-mutate-drawer.tsx
  • web/src/features/channels/components/model-mapping-editor.tsx
  • web/src/features/channels/components/upstream-model-picker.tsx
  • web/src/features/channels/components/upstream-model-selection.tsx

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


Walkthrough

The channel mapping editor now supports fetching upstream models through a dialog picker. Single-selection mode uses radios and preserves manual input. The drawer centralizes discovery controls and feedback. Tests cover discovery, permissions, cancellation, mapping updates, and unsupported channel types.

Changes

Upstream model mapping

Layer / File(s) Summary
Single-selection model UI
web/src/features/channels/components/upstream-model-selection.tsx, web/src/features/channels/components/__tests__/upstream-model-selection.test.tsx
UpstreamModelSelection supports single-selection radio controls and hides multiple-selection actions in that mode.
Mapping editor integration
web/src/features/channels/components/model-mapping-editor.tsx, web/src/features/channels/components/__tests__/model-mapping-editor.test.tsx
ModelMappingEditor accepts a rendered target picker, centralizes mapping updates, preserves local edits, and keeps manual fields editable.
Picker and drawer discovery flow
web/src/features/channels/components/upstream-model-picker.tsx, web/src/features/channels/components/drawers/channel-mutate-drawer.tsx, web/src/components/ui/input-group.tsx, web/src/features/channels/components/__tests__/channel-configuration.test.tsx
The drawer connects discovery state to the new picker. The picker supports fetch, refresh, cancel, and apply actions. Discovery feedback is shared across drawer locations, and portaled popup clicks no longer trigger unintended input focus handling. Tests cover discovery states, permissions, credentials, cancellation, late responses, mapping preservation, and unsupported channel types.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant ChannelMutateDrawer
  participant UpstreamModelPicker
  participant UpstreamModelSelection
  participant ModelMappingEditor
  ChannelMutateDrawer->>UpstreamModelPicker: provide discovery state and fetch callback
  UpstreamModelPicker->>ChannelMutateDrawer: request upstream models
  ChannelMutateDrawer->>UpstreamModelPicker: return models and status
  UpstreamModelPicker->>UpstreamModelSelection: display normalized models
  UpstreamModelSelection->>UpstreamModelPicker: return one selected model
  UpstreamModelPicker->>ModelMappingEditor: apply selected model
Loading

Suggested reviewers: calcium-ion

Merge Risk: ⚪ Minimal · up to 4e3b8

The new upstream-model picker handles successful discovery with the expected status, and no concrete merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: adding a frontend fetch-from-upstream button for model mapping.
Linked Issues check ✅ Passed The pull request implements the coding requirements in #6101. UpstreamModelPicker adds a button beside the upstream replacement-model input, fetches upstream models, and applies a selected model. Th…
Out of Scope Changes check ✅ Passed The changes stay within #6101. The input-focus fix, removal of datalist suggestions, mapping initialization fix, selection-mode support, shared discovery rendering, and related tests directly support …
  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

❤️ Share

I’m a rabbit with models to choose,
From upstream paths and picker views.
Radios click, mappings stay bright,
Fresh lists hop into place just right,
And drafts remain safe through the night.

Comment @coderabbitai help to get the list of available commands.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

模型重定向时允许从上游拉取模型

1 participant