Skip to content

fix(wework): refine Codex usage and fast mode UI - #2349

Merged
qdaxb merged 1 commit into
wecode-ai:mainfrom
Twelveeee:fix/wework-codex-usage-model-icon
Jul 31, 2026
Merged

qdaxb merged 1 commit into
wecode-ai:mainfrom
Twelveeee:fix/wework-codex-usage-model-icon

Conversation

@Twelveeee

@Twelveeee Twelveeee commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

优化 Wework Codex 额度和模型选择体验

Summary

  • 当 Codex 的 5 小时额度不可用时隐藏该行,不再展示“无”;有效的 0% 仍会正常显示。
  • 始终保留 7 天额度信息,避免一个缺失的额度窗口影响其他有效数据。
  • 用 Codex 风格的单色实心闪电替换 Fast 模式 Emoji,并在模型选择按钮和高级设置中复用同一图标。
  • 收紧设置菜单和模型选择浮层的间距、圆角与阴影,使桌面端界面更简洁、统一。

Screenshots

Codex 剩余额度

5 小时额度不可用时,仅展示有效的 7 天额度。

codex-usage-menu

Fast 模式关闭态

模型选择按钮使用单色 Codex 风格图标,不再使用 Emoji。

model-fast-trigger

模型选择菜单

速度文案保持为纯文本“快速”,并统一浮层间距、圆角和阴影。

model-selector-menu

高级 Fast 模式

高级设置中的 Fast 模式复用相同图标语言。

model-advanced-fast

Test plan

  • 拉取并 rebase 最新 origin/main。
  • pnpm install --frozen-lockfile
  • pnpm --filter wework build
  • 使用仓库标准脚本构建未签名 macOS Tauri dev app:
    bash wework/scripts/build-mac-app.sh --profile dev --target aarch64-apple-darwin --bundles app --no-sign
  • 在隔离的真实 Tauri 应用中验证设置菜单和模型选择器。
  • 验证 5 小时额度缺失时不展示该行,7 天额度仍正常展示。
  • 验证 Standard 模式不展示 Fast 图标,Fast 模式展示新的单色图标。
  • 聚焦单元测试:3 个文件、121 项测试通过。
  • 变更文件 ESLint 检查通过。
  • 变更文件 Prettier 检查通过。
  • git diff --check

Summary by CodeRabbit

  • New Features

    • Added a fast-mode icon and improved fast-mode controls for supported models.
    • Updated model menus with clearer accessibility labels and streamlined spacing.
  • Bug Fixes

    • Fast mode now displays localized text without the lightning emoji.
    • Model labels no longer duplicate selected speed details.
    • Usage panels now hide unavailable data and handle loading or error states correctly.
  • Style

    • Refined settings and model menus with updated spacing, borders, sizing, and visual styling.

@coderabbitai

coderabbitai Bot commented Jul 31, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

The 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.

Changes

Fast-mode presentation

Layer / File(s) Summary
Fast-mode icon and label contract
wework/src/components/chat/composer/FastModeIcon.tsx, wework/src/lib/model-ui.ts, wework/src/i18n/locales/*/common.json
Adds the reusable FastModeIcon. Speed labels no longer include the emoji or selected speed value.
Fast-mode selector integration
wework/src/components/chat/composer/ModelSelectorTrigger.tsx, wework/src/components/chat/composer/ModelSelector.tsx, wework/src/components/chat/composer/ModelAdvancedHeader.tsx
Adds leading-icon support and displays the fast-mode icon with an updated accessible label.
Selector menu presentation and validation
wework/src/components/chat/composer/ModelSelector.tsx, wework/src/components/chat/ChatInput.test.tsx
Compacts desktop menu styling. Tests verify localized fast-mode text, icon presentation, and accessibility naming.

Desktop settings usage

Layer / File(s) Summary
Usage menu rendering
wework/src/components/layout/DesktopSettingsMenu.tsx
Uses Gauge, applies compact menu styling, suppresses usage content during loading or errors, and omits unavailable five-hour quota data.
Quota visibility validation
wework/src/components/layout/DesktopSettingsMenu.test.tsx
Tests unavailable and exhausted five-hour quota states with seven-day quota data.

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

Possibly related PRs

Suggested reviewers: feifei325

🚥 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%. 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 summarizes the two main changes: Codex usage handling and fast mode UI refinement.
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 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

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (1)
wework/src/components/chat/composer/ModelAdvancedHeader.tsx (1)

75-75: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Rename the fast-mode icon test ID.

model-advanced-intelligence-icon identifies a FastModeIcon. Rename it to model-advanced-fast-mode-icon and 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

📥 Commits

Reviewing files that changed from the base of the PR and between 7c5b4dd and 25f4bce.

📒 Files selected for processing (10)
  • wework/src/components/chat/ChatInput.test.tsx
  • wework/src/components/chat/composer/FastModeIcon.tsx
  • wework/src/components/chat/composer/ModelAdvancedHeader.tsx
  • wework/src/components/chat/composer/ModelSelector.tsx
  • wework/src/components/chat/composer/ModelSelectorTrigger.tsx
  • wework/src/components/layout/DesktopSettingsMenu.test.tsx
  • wework/src/components/layout/DesktopSettingsMenu.tsx
  • wework/src/i18n/locales/en/common.json
  • wework/src/i18n/locales/zh-CN/common.json
  • wework/src/lib/model-ui.ts

Comment on lines +1645 to +1688
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('⚡')
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 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/src

Repository: 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.tsx

Repository: 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.tsx

Repository: 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.

Comment on lines +1030 to +1037
leadingIcon={
fastModeState.enabled ? (
<FastModeIcon
data-testid="model-selector-fast-mode-icon"
className="h-3.5 w-3.5 shrink-0 text-text-primary"
/>
) : undefined
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 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: render FastModeIcon with h-4 w-4.
  • wework/src/components/chat/composer/ModelAdvancedHeader.tsx#L74-L76: render FastModeIcon with h-4 w-4.
  • wework/src/components/chat/composer/ModelSelectorTrigger.tsx#L16-L16: change LEADING_ICON_CHROME from 18 to 20.

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-L76
  • wework/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

@qdaxb qdaxb left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@qdaxb
qdaxb enabled auto-merge July 31, 2026 09:17
@qdaxb
qdaxb added this pull request to the merge queue Jul 31, 2026
Merged via the queue into wecode-ai:main with commit f256e51 Jul 31, 2026
35 checks passed
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.

2 participants