Skip to content

feat(web): share the chat composer's CLI/model picker across entries (#441) - #888

Open
AlexXPZhu wants to merge 2 commits into
Tencent:mainfrom
AlexXPZhu:feat/agent-picker-consistency-441
Open

AlexXPZhu wants to merge 2 commits into
Tencent:mainfrom
AlexXPZhu:feat/agent-picker-consistency-441

Conversation

@AlexXPZhu

Copy link
Copy Markdown
Contributor

Closes #441.

What changed

Picking a CLI or model worked differently depending on where you were (#441). The chat composer (chatbot/src/ModelPicker.jsx) had search, brand logos, a "family · credits" line and a fixed check mark. The role wizard and 新建需求 in the classic SPA used plain inline menus with no search. Whenever a model's catalog family was other, they showed a gray "AI" badge, so "GPT-6.1 Sol" lost its GPT logo. The role wizard's CLI was also a plain dropdown.

This PR adds AgentFlowAssistantModels.bindPicker in web/app/assistant-models.js. It is the classic-SPA twin of ModelPicker and follows design.md's model-menu spec:

  • It opens a menu attached to <body>, so dialogs and scrolling bodies no longer clip it. The menu is 240px wide, or the trigger's width up to 360px, with a 12px radius, at most 420px tall, and 6px from the trigger.
  • It has search over name, id and family, brand icons, the "family · credits" line, a fixed check slot and an empty-result message.
  • Keyboard: ArrowUp/ArrowDown, Home and End move through options, and Enter in the search box picks the first match. Escape closes only the menu, not the surrounding dialog, and returns focus to the trigger. Tab resumes the form's tab order from the trigger.
  • It is mutually exclusive with HuiPopover, so only one popover is open at a time. It respects prefers-reduced-motion.
  • Brand inference now matches modelProviderFor: family first, then id, then name. Unknown brands show the Harness brain glyph instead of a lettered badge, and each CLI gets its logo, as engineBrand does in the chat.

Entries moved onto it:

  • 角色定义: CLI, model and 思考强度. The CLI keeps a hidden select[name="executorId"] (data-native) for its value, the legacy-executor option and the change event, so form handling and saving are unchanged.
  • 新建需求 and the 澄清 tab: the clarification model picker. It still lists CodeBuddy models only ([Bug]: 选了 Codex 后,需求澄清等入口仍强制使用 CodeBuddy #228).

Inline-menu CSS that no longer applies was removed, and design.md documents the shared picker.

Not in this PR:

  • The 4th screenshot in the issue ("默认 Agent CLI") does not exist anywhere in this repository or its history, so it could not be changed here.
  • Schedules, Bots, run evals and the SOP assistant still use their inline menus; design.md notes they move to bindPicker later. They already pick up the new brand inference and the chevron caret.

Scope

  • Platform core / API / runner
  • Public adapter / deployment
  • Classic
  • Portable
  • Shared behavior contract
  • Installer / CLI
  • Documentation only

Compatibility

Frontend only (web/ and design.md). There are no API, database or migration changes. Saved role settings and the stored clarification model (agentflow.clarifyModel) are read and written exactly as before.

Validation

npm --prefix chatbot run build                        # needed so web/ can embed native-chat
go test ./web -count=1                                # ok
node web/assistant_models_test.js <bundle> web/app/assistant-models.js   # assistant models ok
npm --prefix webtest test                             # 189 passed
go vet ./web                                          # ok
python3 scripts/check-public.py                       # passed
bash scripts/scan-secrets.sh                          # no leaks found

web/assistant_models_test.js was rewritten on web/hui_fake_dom.js and covers the following:

  • Clarification picker: search by name, id and family; the empty result; arrow keys; Escape not reaching the dialog; Enter picking the first match; outside press closing the menu.
  • Role wizard: tested against the real index.html markup. Picking a CLI fires change once and the model and effort lists follow it. Only one menu is open at a time. The manual model-id field appears when chosen. Disabled triggers stay shut.

Browser check: Chromium via Playwright, with /api stubbed, opening the role wizard and 新建需求. I checked light and dark themes, a 1280px and a 420px viewport, the keyboard CLI switch, and Escape keeping the dialog open. This caught a dark-theme bug, now fixed: product-v3.css's generic input rule had been painting a filled box inside the menu's search field.

Not run: the full go test ./..., the local/ scripts, the e2e suite, and npm --prefix chatbot test. chatbot/ is unchanged.

Safety

  • I did not include credentials, internal endpoints, production data, or organization-specific infrastructure.
  • I preserved user files and unrelated changes.
  • I updated generated Classic host bundles when applicable. (Not applicable.)
  • I documented third-party content and licensing changes when applicable. (No new third-party content. The brand patterns are ported from the existing ModelProviderIcon.jsx, and the logos are the ones already under web/images/credentials.)

@AlexXPZhu

Copy link
Copy Markdown
Contributor Author

The four red checks come from the CI runner, not from this change.

  • validate (3.8) and e2e (ubuntu-latest, python 3.8, node 22): actions/setup-python fails before any step runs: The version '3.8' with architecture 'x64' was not found for Ubuntu 26.04. The ubuntu-latest image has moved to 26.04, which has no Python 3.8 build.
  • e2e-browser (dashboard in Chromium): the Install Playwright step fails, so no test runs (Render the observability dashboard is skipped).
  • e2e-required: this is the summary of the e2e jobs, so it fails because of the two above.

The jobs that test the code pass:

  • platform-required, with core, browser and first-run
  • all Python 3.12 e2e jobs (Ubuntu with Node 20 and 22, and macOS)
  • validate (3.12), tcmcp, secrets and curl-install

The last run on main for the same base commit (dd56585) was green, so the runner image probably changed since then. Fixing it needs a workflow change, for example dropping 3.8 from the matrix or pinning ubuntu-24.04, plus a look at the Playwright install step. I've left that out of this PR to keep it scoped to #441.

@Yanami-2K Yanami-2K left a comment

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.

对照 #441 读完了 11 个文件(assistant-models.js、agents.js、sync-schedule.js、index.html、CSS 等 patch 有截断,按可见部分和描述判断)。bindPicker 把角色定义的 CLI/模型/思考强度和新建需求/澄清的模型选择统一到与聊天框一致的菜单,覆盖了 issue 里前三张截图的入口;隐藏的 select[name="executorId"] 保留取值和 change 事件,表单保存逻辑不变;assistant_models_test.js 对搜索、键盘、Escape 不关外层弹窗、CLI 切换联动等都有断言。代码层面没有发现阻塞问题,阻塞项是 CI:

  1. CI 失败(checksState=failure):head b1e7c96 上 validate (3.8)、e2e (ubuntu-latest, python 3.8, node 22)、e2e-browser (dashboard in Chromium)、e2e-required 失败。这组失败和同期 #214/#902/#903 一致,是 ubuntu-latest 切到 26.04 导致的(#885,修复在 #886),和本 PR 的前端改动无关。建议等 #886 合入后 rebase 重跑,CI 全绿后重新请求审查。

非阻塞提醒:assistant-models.js 的 ENGINE_BRANDS 没有 deepseek 键,如果 #121 的 DeepSeek (via Codex) 执行器先合入,角色定义的 CLI 菜单会显示为未知品牌图标,可顺手补上。

…encent#441)

The chat composer, the role wizard and 新建需求 each drew a different CLI
and model picker: only the composer had search, brand logos and the
"family · credits" line, and the classic SPA fell back to a gray "AI"
badge whenever a model id did not start with a known prefix.

Add AgentFlowAssistantModels.bindPicker, the classic-SPA twin of
chatbot/src/ModelPicker.jsx: a body-level menu with search, brand icons,
a fixed check slot, the same keyboard handling and viewport placement,
and HuiPopover exclusivity. Brand inference now follows modelProviderFor
(family, then id, then name) and unknown brands use the Harness brain
glyph.

Move the role wizard's CLI, model and effort and the clarification model
picker onto it. The role CLI keeps a hidden select for its value, the
legacy-executor option and the change event, so form handling is
unchanged. Schedules, Bots, run evals and the SOP assistant keep their
inline menus for now.
Review follow-up on Tencent#888: map the `deepseek` executor (DeepSeek via Codex,
Tencent#121) to the DeepSeek logo so the role wizard's CLI menu does not fall back
to the unknown-brand glyph.
@AlexXPZhu
AlexXPZhu force-pushed the feat/agent-picker-consistency-441 branch from b1e7c96 to 0f73a18 Compare November 16, 2026 11:45
@AlexXPZhu

Copy link
Copy Markdown
Contributor Author

Thanks for the review. Both points are addressed:

  1. CI: fix(ci): keep Python 3.8 and Playwright working on Ubuntu 26.04 runners #948 landed on main with the same fix as ci(local): fix Python 3.8 and Playwright browser runs on Ubuntu 26.04 (#885) #886 (Python 3.8 on ubuntu-24.04, Playwright 1.64.1). ci(local): fix Python 3.8 and Playwright browser runs on Ubuntu 26.04 (#885) #886 now conflicts with main. I rebased onto main (777f16a), and all 15 checks pass, including validate (3.8), e2e (ubuntu-24.04, python 3.8, node 22), e2e-browser, e2e-required and platform-required.
  2. deepseek brand: in 0f73a18, ENGINE_BRANDS now maps deepseek (the executor ID used in feat(platform): support DeepSeek as an opt-in SOP executor via Codex #121) to the DeepSeek logo, and web/assistant_models_test.js asserts it. It is a separate commit, so you can review just that change.

Re-ran after the rebase: go test ./web, go vet ./web, the picker test, and npm --prefix webtest test (189/189).

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.

[Feature]: Agent选择交互一致性

2 participants