Repository navigation
fix(wework): refine Codex usage and fast mode UI - #2349
Conversation
📝 WalkthroughWalkthroughThe pull request adds a reusable fast-mode icon, removes emoji from speed labels, updates model-selector presentation and accessibility, and changes desktop settings usage rendering for Codex quotas. Tests cover fast-mode labels and quota visibility. ChangesFast-mode presentation
Desktop settings usage
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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 |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
wework/src/components/chat/composer/ModelAdvancedHeader.tsx (1)
75-75: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winRename the fast-mode icon test ID.
model-advanced-intelligence-iconidentifies aFastModeIcon. Rename it tomodel-advanced-fast-mode-iconand update its references.As per coding guidelines, names must be clear.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@wework/src/components/chat/composer/ModelAdvancedHeader.tsx` at line 75, Rename the FastModeIcon test ID from model-advanced-intelligence-icon to model-advanced-fast-mode-icon in ModelAdvancedHeader, and update every reference to the old test ID consistently.Source: Coding guidelines
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@wework/src/components/chat/ChatInput.test.tsx`:
- Around line 1645-1688: Reset the model selector power-view preference to the
closed state in the test setup before rendering ChatInput, so ModelSelector does
not initialize powerViewOpen as true. Update the setup for the test “uses a
Codex-style monochrome fast indicator instead of an emoji” or its surrounding
suite setup, using the existing preference helper or storage-clearing mechanism,
and preserve the expectation that model-control-menu-speed is visible after
opening the menu.
In `@wework/src/components/chat/composer/ModelSelector.tsx`:
- Around line 1030-1037: Use 16px sizing for FastModeIcon in ModelSelector.tsx
lines 1030-1037 and ModelAdvancedHeader.tsx lines 74-76 by updating both
dimensions to h-4 w-4; in ModelSelectorTrigger.tsx line 16, increase
LEADING_ICON_CHROME from 18 to 20 so measured trigger width matches the icon
size.
---
Nitpick comments:
In `@wework/src/components/chat/composer/ModelAdvancedHeader.tsx`:
- Line 75: Rename the FastModeIcon test ID from model-advanced-intelligence-icon
to model-advanced-fast-mode-icon in ModelAdvancedHeader, and update every
reference to the old test ID consistently.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: f48c8fba-bffc-4624-8890-8a588bbbe133
📒 Files selected for processing (10)
wework/src/components/chat/ChatInput.test.tsxwework/src/components/chat/composer/FastModeIcon.tsxwework/src/components/chat/composer/ModelAdvancedHeader.tsxwework/src/components/chat/composer/ModelSelector.tsxwework/src/components/chat/composer/ModelSelectorTrigger.tsxwework/src/components/layout/DesktopSettingsMenu.test.tsxwework/src/components/layout/DesktopSettingsMenu.tsxwework/src/i18n/locales/en/common.jsonwework/src/i18n/locales/zh-CN/common.jsonwework/src/lib/model-ui.ts
| test('uses a Codex-style monochrome fast indicator instead of an emoji', async () => { | ||
| const model: UnifiedModel = { | ||
| name: 'gpt-5.6-sol', | ||
| type: 'runtime', | ||
| displayName: 'GPT 5.6 Sol', | ||
| config: { | ||
| ui: { | ||
| family: 'codex-official', | ||
| modelLabel: 'GPT 5.6 Sol', | ||
| reasoningEfforts: ['low', 'medium', 'high', 'xhigh'], | ||
| defaultReasoningEffort: 'medium', | ||
| controls: ['speed'], | ||
| }, | ||
| }, | ||
| } | ||
|
|
||
| render( | ||
| <ChatInput | ||
| value="" | ||
| onChange={vi.fn()} | ||
| onSubmit={vi.fn()} | ||
| disabled={false} | ||
| variant="desktop" | ||
| projectChat={projectChatControls({ | ||
| models: [model], | ||
| selectedModel: model, | ||
| selectedModelOptions: { reasoning: 'high', speed: 'fast' }, | ||
| })} | ||
| /> | ||
| ) | ||
|
|
||
| const trigger = screen.getByTestId('model-selector-button') | ||
| expect(trigger).toHaveTextContent('GPT 5.6 Sol High') | ||
| expect(trigger).not.toHaveTextContent('⚡') | ||
| expect(trigger).not.toHaveTextContent('快速') | ||
| expect(screen.getByTestId('model-selector-fast-mode-icon')).toHaveClass('text-text-primary') | ||
| expect(trigger).toHaveAccessibleName(/快速/) | ||
|
|
||
| await userEvent.click(trigger) | ||
|
|
||
| expect(screen.getByTestId('model-control-menu-speed')).toHaveTextContent('快速') | ||
| expect(screen.getByTestId('model-control-menu-speed')).not.toHaveTextContent('⚡') | ||
| }) | ||
|
|
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
rg -n -C 4 \
'readModelSelectorPowerViewPreference|writeModelSelectorPowerViewPreference|model-control-menu-speed|beforeEach|localStorage|sessionStorage' \
wework/srcRepository: wecode-ai/Wegent
Length of output: 50373
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Locate and inspect the relevant test and preference source without relying on broad output.
printf '--- files ---\n'
fd -a 'ChatInput\.test\.tsx|ModelSelector|codex|model' wework/src | sed 's#^\./##' | head -200
printf '\n--- exact references ---\n'
rg -n "readModelSelectorPowerViewPreference|writeModelSelectorPowerViewPreference|powerViewOpen|model-control-menu-speed|wework:model-selector-power-view|modelSelectorPowerView" wework/src --glob '!node_modules'
printf '\n--- ChatInput.test outline/import region ---\n'
wc -l wework/src/components/chat/ChatInput.test.tsx
sed -n '1,80p' wework/src/components/chat/ChatInput.test.tsx
sed -n '1610,1705p' wework/src/components/chat/ChatInput.test.tsxRepository: wecode-ai/Wegent
Length of output: 245
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf '%s\n' '--- files ---'
fd -a 'ChatInput\.test\.tsx|ModelSelector|codex|model' wework/src | sed 's#^\./##' | head -200
printf '%s\n' ''
printf '%s\n' '--- exact references ---'
rg -n "readModelSelectorPowerViewPreference|writeModelSelectorPowerViewPreference|powerViewOpen|model-control-menu-speed|wework:model-selector-power-view|modelSelectorPowerView" wework/src --glob '!node_modules'
printf '%s\n' ''
printf '%s\n' '--- ChatInput.test outline/import region ---'
wc -l wework/src/components/chat/ChatInput.test.tsx
sed -n '1,80p' wework/src/components/chat/ChatInput.test.tsx
sed -n '1610,1705p' wework/src/components/chat/ChatInput.test.tsxRepository: wecode-ai/Wegent
Length of output: 11390
Reset the model selector power-view preference in this test.
ModelSelector hides model-control-menu-speed when powerViewOpen is true, and powerViewOpen is initialized from readModelSelectorPowerViewPreference(). This test expects the speed row after opening the menu, so set the preference closed or clear the stored value in setup before rendering.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@wework/src/components/chat/ChatInput.test.tsx` around lines 1645 - 1688,
Reset the model selector power-view preference to the closed state in the test
setup before rendering ChatInput, so ModelSelector does not initialize
powerViewOpen as true. Update the setup for the test “uses a Codex-style
monochrome fast indicator instead of an emoji” or its surrounding suite setup,
using the existing preference helper or storage-clearing mechanism, and preserve
the expectation that model-control-menu-speed is visible after opening the menu.
| leadingIcon={ | ||
| fastModeState.enabled ? ( | ||
| <FastModeIcon | ||
| data-testid="model-selector-fast-mode-icon" | ||
| className="h-3.5 w-3.5 shrink-0 text-text-primary" | ||
| /> | ||
| ) : undefined | ||
| } |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Keep the fast-mode icon size and width calculation consistent.
The icon is rendered at 14px in both selector locations, while the Wework density rule requires 16px desktop icons. Use h-4 w-4 at both call sites and set the measured chrome to 20; otherwise the trigger can under-measure and clip its label.
wework/src/components/chat/composer/ModelSelector.tsx#L1030-L1037: renderFastModeIconwithh-4 w-4.wework/src/components/chat/composer/ModelAdvancedHeader.tsx#L74-L76: renderFastModeIconwithh-4 w-4.wework/src/components/chat/composer/ModelSelectorTrigger.tsx#L16-L16: changeLEADING_ICON_CHROMEfrom18to20.
As per coding guidelines, standard desktop icons must use 16px sizing.
📍 Affects 3 files
wework/src/components/chat/composer/ModelSelector.tsx#L1030-L1037(this comment)wework/src/components/chat/composer/ModelAdvancedHeader.tsx#L74-L76wework/src/components/chat/composer/ModelSelectorTrigger.tsx#L16-L16
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@wework/src/components/chat/composer/ModelSelector.tsx` around lines 1030 -
1037, Use 16px sizing for FastModeIcon in ModelSelector.tsx lines 1030-1037 and
ModelAdvancedHeader.tsx lines 74-76 by updating both dimensions to h-4 w-4; in
ModelSelectorTrigger.tsx line 16, increase LEADING_ICON_CHROME from 18 to 20 so
measured trigger width matches the icon size.
Source: Coding guidelines
优化 Wework Codex 额度和模型选择体验
Summary
0%仍会正常显示。Screenshots
Codex 剩余额度
5 小时额度不可用时,仅展示有效的 7 天额度。
Fast 模式关闭态
模型选择按钮使用单色 Codex 风格图标,不再使用 Emoji。
模型选择菜单
速度文案保持为纯文本“快速”,并统一浮层间距、圆角和阴影。
高级 Fast 模式
高级设置中的 Fast 模式复用相同图标语言。
Test plan
origin/main。pnpm install --frozen-lockfilepnpm --filter wework buildbash wework/scripts/build-mac-app.sh --profile dev --target aarch64-apple-darwin --bundles app --no-signgit diff --checkSummary by CodeRabbit
New Features
Bug Fixes
Style