Skip to content

feat(web): support multi-level thinking effort selection#1344

Open
wbxl2000 wants to merge 3 commits into
mainfrom
web/thinking-effort
Open

feat(web): support multi-level thinking effort selection#1344
wbxl2000 wants to merge 3 commits into
mainfrom
web/thinking-effort

Conversation

@wbxl2000

@wbxl2000 wbxl2000 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No related issue. This is the web-side follow-up to the thinking-effort work that already shipped in the TUI (plan/thinking-effort-switching.md, plan/thinking-model-overhaul.md).

Problem

The web composer collapsed thinking into a binary on/off toggle. Models that declare multiple reasoning efforts (support_efforts / default_effort, e.g. low / high / max) had no way to expose those levels in the web UI — the two fields were even dropped at the wire → app mapping layer, so the front end never saw them.

What changed

  • Carry support_efforts / default_effort from the model catalog through to the web app (WireModelAppModel mapper).
  • Widen ThinkingLevel to an open string ('off' | 'on' | (string & {})) and add lib/modelThinking.ts helpers (segmentsFor, defaultThinkingLevelFor, commitLevel, coerceThinkingForModel) that mirror the TUI semantics.
  • Replace the on/off toggle in the composer model dropdown with a segmented control (e.g. [Off] [Low] [High] [Max]), and show the concrete level in the model pill suffix.
  • Use the same segmented control in the mobile settings sheet, and make the /thinking slash command step through the active model's levels.
  • Add unit coverage for the normalization logic and a changeset.

The segmented-control UX was chosen to stay faithful to the TUI, so the two clients behave identically for every model capability (boolean / effort / always-on / unsupported).

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jul 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e65726f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jul 3, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@e65726f
npx https://pkg.pr.new/@moonshot-ai/kimi-code@e65726f

commit: e65726f

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4efe1ea5e6

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/kimi-web/src/composables/useKimiWebClient.ts
Surface each model's declared reasoning efforts (support_efforts /
default_effort) in the web model picker as a segmented control,
replacing the on/off toggle. ThinkingLevel is now an open string, the
model catalog carries the effort metadata to the web app, and the
mobile settings sheet and /thinking command cycle through the
available levels.
@wbxl2000 wbxl2000 force-pushed the web/thinking-effort branch from 4efe1ea to 1780a0b Compare July 3, 2026 06:18
@wbxl2000

wbxl2000 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

@codex

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1780a0b63f

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/kimi-web/src/lib/modelThinking.ts
coerceThinkingForModel returned 'on' for any non-'off' level when the
active model was still undefined (catalog not loaded yet), which
rewrote a persisted/default effort like 'high' to 'on' and silently
dropped the model's declared effort on later prompts. Keep the
requested level as-is until loadModels() re-runs coercion with the
real model.

Addresses Codex P1 review on modelThinking.ts.
@wbxl2000

wbxl2000 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 11a387423a

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread apps/kimi-web/src/components/chat/Composer.vue Outdated
When selecting another session, the persisted thinking level can be a
boolean 'on'/'off' carried over from a previous model. Deriving the
pill suffix and active segment from that raw value could show
"thinking: off" on an always-on model or hide the concrete effort
behind a bare "thinking" tag. Coerce the level against the current
model before deriving display state.

Addresses Codex P2 review on Composer.vue.
@wbxl2000

wbxl2000 commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e65726f435

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +608 to +610
const coercedThinkingLevel = computed(() =>
coerceThinkingForModel(currentModel.value, props.thinking ?? 'off'),
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Apply coerced thinking to submissions, not just display

This computed only normalizes stale thinking values for the composer UI. The send paths (submitPromptInternal / steerPrompt) still submit rawState.thinking, so after selecting an effort like max on one model and then opening a session whose active model only supports low/high, the pill highlights the coerced default here while the next prompt is still sent with thinking: 'max'. Providers then ignore or clamp that unsupported effort, so the first turn can run with a different level from what the UI shows; update the client state/session profile on active-model changes or submit the coerced value instead of only rendering it.

Useful? React with 👍 / 👎.

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