Skip to content

ui: Add Thinking mode toggle with reasoning effort levels + improvements for Chat Form Add Action UI#23434

Merged
allozaur merged 23 commits into
ggml-org:masterfrom
allozaur:allozaur/feat/thinking-mode-toggle
Jun 2, 2026
Merged

ui: Add Thinking mode toggle with reasoning effort levels + improvements for Chat Form Add Action UI#23434
allozaur merged 23 commits into
ggml-org:masterfrom
allozaur:allozaur/feat/thinking-mode-toggle

Conversation

@allozaur
Copy link
Copy Markdown
Contributor

@allozaur allozaur commented May 20, 2026

Overview

  • (wip) Adds Thinking capability detection by doing heuristic checks for thinking/reasoning tags in chat template
  • Adds Thinking controls with reasoning effort levels (Off/Low/Medium/High/Max)
  • Redesigns the "Add" button panel with collapsible sections and nested submenus
  • Thinking status icon next to the model name in Models Selector

Closes #23444
Closes #18405
Closes #22895
Closes #20557
Closes #20001
Supersedes #21657

Demo

Nagranie.z.Ekranu_converted.mp4

Additional information

Storage & Settings

  • New localStorage keys: thinkingEnabledDefault, reasoningEffortDefault
  • New settings: ENABLE_THINKING, SHOW_MODEL_QUANTIZATION, SHOW_MODEL_TAGS
  • Settings registry entries for display and developer sections

Backend API Integration (chat.service.ts)

  // Adds to request body:
  chat_template_kwargs: { enable_thinking: boolean }
  thinking_budget_tokens: number  // from effort level mapping

Database Schema Changes

New optional fields on DatabaseConversation:

  • thinkingEnabled?: boolean
  • reasoningEffort?: ReasoningEffort

UX Redesign of "Add" Panel

Desktop (Dropdown):

  • Reorganized into nested submenus
  • "Add files" grouped under a submenu
  • New "Thinking" submenu with effort levels
  • Better MCP tool and server toggles

Mobile (Sheet):

  • Collapsible sections: Files, MCP Servers, Tools, Thinking
  • Toggle switches instead of checkboxes
  • Visual feedback with enabled tool/server counters

Bug Fixes

Data Flow: Thinking Toggle → API Request

  User selects thinking setting (On/Off + Effort Level)
           ↓
  conversationsStore.setThinkingEnabled() / setReasoningEffort()
           ↓
  Per-conversation stored in DatabaseConversation
           ↓
  chat.svelte.ts → ChatService.sendMessage()
           ↓
  Sets: chat_template_kwargs.enable_thinking + thinking_budget_tokens
           ↓
  Server receives: POST /chat/completions

Requirements

Copilot AI review requested due to automatic review settings May 20, 2026 18:05
@allozaur allozaur requested a review from a team as a code owner May 20, 2026 18:05
@allozaur allozaur requested review from a team, ServeurpersoCom, ggerganov and julien-c May 20, 2026 18:05
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@coder543
Copy link
Copy Markdown

I have wanted a thinking toggle here for a long time, I'm just not sure how it can automatically detect the right kind of toggle to show. Some models only support one mode, some models support turning thinking on/off, some models support different reasoning efforts: low, medium, high (like GPT-OSS). How does this PR handle that?

@allozaur
Copy link
Copy Markdown
Contributor Author

I have wanted a thinking toggle here for a long time, I'm just not sure how it can automatically detect the right kind of toggle to show. Some models only support one mode, some models support turning thinking on/off, some models support different reasoning efforts: low, medium, high (like GPT-OSS). How does this PR handle that?

my assumption was to release this as is, in an experimental form as most popular models support reasoning and follow up with further implementation on the server-side with some kind of support for detecting the thinking support and passing it to /props endpoint.

@engrtipusultan
Copy link
Copy Markdown

Thank you for this. I requested it some time back. #18405 I think many people will be happy.

Can you kindly confirm what will be required on server end for it to work as of now. If server is either started with reasoning on or off.

@allozaur
Copy link
Copy Markdown
Contributor Author

Thank you for this. I requested it some time back. #18405 I think many people will be happy.

Can you kindly confirm what will be required on server end for it to work as of now. If server is either started with reasoning on or off.

Yes, actually I might devote a bit more time to this PR to also address #18405

@allozaur allozaur marked this pull request as draft May 20, 2026 21:29
@allozaur
Copy link
Copy Markdown
Contributor Author

allozaur commented May 20, 2026

Okay, so after seeing multiple feature requests I've updated the description of the PR and changed it back to draft as I'd like to do a bit more in-depth implementation of Thinking controls feature from the start.

I've created a parent issue ##23444

@allozaur allozaur force-pushed the allozaur/feat/thinking-mode-toggle branch 9 times, most recently from 292193c to 55709fa Compare May 30, 2026 09:16
@allozaur allozaur changed the title ui: Add Thinking mode toggle + improve Chat Form Add Action UI ui: Add Thinking mode toggle with reasoning effort levels + improvements for Chat Form Add Action UI May 30, 2026
@allozaur allozaur force-pushed the allozaur/feat/thinking-mode-toggle branch from 55709fa to 50d9548 Compare May 30, 2026 13:15
@shredderique
Copy link
Copy Markdown

shredderique commented Jun 1, 2026

Hi, despite being late to the party....
I've vibecoded a simple toggle button into svelte-ui.
I suggest to have an easily accessible toggle button in favor or in addition to the fine-grained settings. This avoids complicated navigation through the menu.
Our customers love it so far.

Can't wait to see thinking mode toggle in main one way or another!

image

@allozaur allozaur force-pushed the allozaur/feat/thinking-mode-toggle branch from 98f9e68 to 3ca2987 Compare June 1, 2026 17:05
@allozaur
Copy link
Copy Markdown
Contributor Author

allozaur commented Jun 1, 2026

@shredderique here's a refined toggle with dropdown choice :)

Zrzut ekranu 2026-06-1 o 20 12 54 Zrzut ekranu 2026-06-1 o 20 12 51

Comment thread tools/ui/src/lib/components/app/chat/index.ts Outdated
Comment thread tools/ui/src/lib/components/app/models/ModelId.svelte
Comment thread tools/ui/src/lib/components/app/models/ModelsSelectorMessageThinkingIcon.svelte Outdated
Comment thread tools/ui/src/lib/components/app/models/ModelsSelectorThinkingIcon.svelte Outdated
Comment thread tools/ui/src/lib/constants/storage.ts Outdated
Co-authored-by: Aleksander Grygier <aleksander.grygier@gmail.com>
@allozaur allozaur force-pushed the allozaur/feat/thinking-mode-toggle branch from 8dc7a05 to 6505c46 Compare June 2, 2026 06:30
@allozaur allozaur marked this pull request as ready for review June 2, 2026 07:20
@allozaur allozaur requested a review from a team as a code owner June 2, 2026 07:20
@allozaur
Copy link
Copy Markdown
Contributor Author

allozaur commented Jun 2, 2026

@ggerganov @julien-c please review/test and lemme know :)

Copy link
Copy Markdown
Contributor Author

@allozaur allozaur left a comment

Choose a reason for hiding this comment

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

Last tweaks

Comment thread tools/ui/src/lib/components/app/models/ModelsSelectorThinkingIcon.svelte Outdated
Comment thread tools/ui/src/lib/constants/reasoning-effort.ts Outdated
Copy link
Copy Markdown
Member

@ggerganov ggerganov left a comment

Choose a reason for hiding this comment

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

Very useful.

Note that this is compatible with the CLI argument --reasoning-budget-message. For example:

llama serve ... --reasoning-budget-message " ... I am thinking too long. Will proceed with the final answer now."

@allozaur allozaur merged commit f8e67fc into ggml-org:master Jun 2, 2026
27 of 28 checks passed
@allozaur allozaur deleted the allozaur/feat/thinking-mode-toggle branch June 2, 2026 08:37
@julien-c
Copy link
Copy Markdown
Contributor

julien-c commented Jun 2, 2026

just tried it, very cool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

8 participants