Skip to content

fix(web): adapt model picker width and show catalog counts - #1290

Merged
iruriQ merged 2 commits into
BytePioneer-AI:mainfrom
zxd-666:fix/web-model-picker-width
Nov 27, 2026
Merged

iruriQ merged 2 commits into
BytePioneer-AI:mainfrom
zxd-666:fix/web-model-picker-width

Conversation

@zxd-666

@zxd-666 zxd-666 commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

Summary

The Web composer model list is fixed at 264px, which truncates similar model names even when the screen has enough room. Size the model card to its content, open it on the side with more available space, and wrap names when that space is exhausted. Keep the existing Thinking card and narrow-screen replacement/back behavior.

- Model card: fixed 264px; long names ellipsized
+ Model card: content width, bounded by available viewport space; long names wrap
- 模型
+ 模型 (13) / 模型 (4 / 13) while searching

The count covers the current model catalog, with matching / total counts during search. No catalog, selection protocol, or Host changes.

Evidence

Screenshots use the actual ModelSelect and shared primitives in an isolated browser preview with synthetic catalog data. No user conversations, credentials, or account data are included.

Before After
Fixed width truncates names Adaptive width and total count
Filtered count Narrow screen with an unbroken long name
Matching and total counts Wrapped name at 390px

Validation performed:

  • Reproduced the baseline: 9 of 13 sample names clipped at 264px; the same catalog has no clipped names after the change.
  • Exercised 768px and 1298px layouts, both left/right placement, short catalogs (264px minimum), and a 390px narrow layout with an unusually long name; no model-card horizontal overflow.
  • Checked total, filtered, and zero-match counts; search clearing, ArrowDown + Enter selection, favorite toggling, and narrow-screen Back.
  • Bundled the isolated preview successfully; staged-file Prettier hook and git diff --check passed.
  • No automated Web page tests added, per repository guidance. Full application/Host integration and full-repository checks were not run for this local UI change.

Merge Danger

Door: Two-way; revert this commit to restore the previous layout.

Blast Radius: Web model-picker presentation and placement only.

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Explain Change →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • 改进
    • 模型选择面板现在会根据视口空间调整显示位置和宽度,在较窄屏幕上更好地适配。
    • 模型名称支持换行,减少长名称对面板布局的影响。
    • 面板标题显示模型总数;搜索时显示匹配数量及总数。

模型选择面板现在根据视口宽度和锚点两侧的可用空间选择布局,并调整面板宽度。面板标题显示模型总数;搜索时还显示可见结果数。

Changes: 模型选择面板

Layer / File(s) Summary
面板位置与尺寸
apps/web-ui/packages/client/ui-model-selection/src/client/ModelSelect.tsx、apps/web-ui/packages/client/ui-model-selection/src/client/ModelSelect.module.css
视口宽度不超过 640px,或锚点两侧空间都小于 264px 时,使用替换布局。否则选择空间较大的一侧,并将该侧空间设为最大宽度。面板宽度改为内容自适应,并设置最小宽度和最大宽度。替换和移动端布局新增宽度约束。面板内的模型名称允许换行和任意位置断行。
模型数量显示
apps/web-ui/packages/client/ui-model-selection/src/client/ModelSelect.tsx、apps/web-ui/packages/client/ui-model-selection/src/client/ModelSelect.module.css
标题显示目录总数。搜索词非空时,同时显示可见结果数。计数样式使用等宽数字,并与前置内容留出间距。

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: bytepioneer-ai

Merge Risk: Minimal · up to d662a · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed 标题“fix(web): adapt model picker width and show catalog counts”概括了本 PR 的两个主要变更:模型面板宽度自适应,以及显示目录计数。raw_summary 中的 ModelSelect.module.css 与 ModelSelect.tsx 变更与此标题一致。标题为英文且符合 Conventional Commits 格式,表述具体。
Description check Passed 描述说明了问题(264px 固定宽度导致模型名截断)、解决方案(按内容自适应宽度、按空间较大一侧打开、长名称换行)、模型计数显示(总数与搜索时的匹配数/总数)以及验证过程。描述与变更集直接相关,内容充分。
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Fix failing CI checks

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 88b0eb7 and d662ac8.

Files ignored due to path filters: 4

  • docs/imgs/model-picker/after.png is excluded by !**/*.png
  • docs/imgs/model-picker/before.png is excluded by !**/*.png
  • docs/imgs/model-picker/mobile.png is excluded by !**/*.png
  • docs/imgs/model-picker/search.png is excluded by !**/*.png
Files selected for processing: 2

  • apps/web-ui/packages/client/ui-model-selection/src/client/ModelSelect.module.css
  • apps/web-ui/packages/client/ui-model-selection/src/client/ModelSelect.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Recent review details

Context from checks skipped due to timeout: 7

  • GitHub Check: CodeRabbit
  • GitHub Check: Check macos-26
  • GitHub Check: Check windows-latest
  • GitHub Check: Check ubuntu-22.04
  • GitHub Check: Check Linux ARM64
  • GitHub Check: Vitest
  • GitHub Check: Web Host tests
Additional context used

Code guidelines: 2

docs/product/standalone-web.md — auto-discovered
AGENTS.md — auto-discovered
Path-based instructions: 2

Applicability reference: AGENTS.md: # Repository Guidelines `npm start` / `npm start web` rebuild and relaunch the user's Desktop / Web and may restart the shared Host; `npm stop` stops all local codexhost services across worktrees.

CodeRabbit inference engine (docs/product/standalone-web.md)

Files:

  • apps/web-ui/packages/client/ui-model-selection/src/client/ModelSelect.module.css
  • apps/web-ui/packages/client/ui-model-selection/src/client/ModelSelect.tsx
Source excerpt: Do not write browser, e2e, or component tests for Web pages (`apps/web-ui`); the user checks page changes directly.

CodeRabbit inference engine (AGENTS.md)

Files:

  • apps/web-ui/packages/client/ui-model-selection/src/client/ModelSelect.module.css
  • apps/web-ui/packages/client/ui-model-selection/src/client/ModelSelect.tsx
Additional comments: 1

apps/web-ui/packages/client/ui-model-selection/src/client/ModelSelect.tsx: 1

350-352: Functional Correctness

该问题不成立。在 640px 断点、264px 侧栏最小宽度以及左右切换条件下,面板未发现突破 12px 视口边距的组合。左侧分支满足 panelWidth ≤ leftSpace,右侧分支满足 panelWidth ≤ rightSpace,替换模式使用已受视口约束的菜单宽度。该结论仅针对 CSS 与建模公式;place 回调中的 JavaScript 公式未在本次证据中重新核对。评论提出的是核对问题,未指出可执行的缺陷,因此不应发布为审查意见。

zxd-666 commented Nov 27, 2026

Copy link
Copy Markdown
Contributor Author

@iruriQ 核查了当前 head d662ac8f80d6c7189980666ebe9da26d1b4e04a4 的失败检查;目前两项已定位的阻塞来自主干文件,本 PR 只修改模型选择器的两个 UI 文件和演示图片:

  1. Static checks 报告 22 个 ESLint 错误,分布于 desktop-mcp-bridge.test.ts、renderer-handoff-control.test.ts、ch-thread-view.ts、peer-pairing.ts、peer-host-manager.test.ts、remote-peer-attachments.test.ts、remote-sessions.test.ts、tool-output-rpc.test.ts。类型包括 inline import type、非空断言、prefer-const 和 no-invalid-void-type。
  2. Ubuntu check 停在 cargo fmt --all --check,差异位于 crates/launcher/tests/cli.rs:312,364。

已用 PR base 88b0eb7147c1b19215ec6c95dc020a9a40dfaa44 对照确认,上述文件均不在本 PR 的改动中。请协助在主干修正这些检查问题;保留此 PR 的 UI 范围,避免混入 unrelated cleanup。其余仍在运行的检查没有据此认定成功或失败。

@iruriQ
iruriQ merged commit 80efc6a into BytePioneer-AI:main Nov 27, 2026
@iruriQ

iruriQ commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

感谢贡献!已完成 Chromium + WebKit 双引擎(桌面 1280×800 与手机 390×844)隔离实测(自适应宽度、向宽侧展开、长模型名无截断、目录计数 (n) / (m / n) 全部通过,0 页面错误);已顺手移除仓库中未被引用的 4 张临时演示图后合入 main。

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.

3 participants