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

@allozaur allozaur commented May 20, 2026

Copy link
Copy Markdown
Contributor

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

Copilot AI 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.

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
Contributor

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

allozaur commented May 20, 2026

Copy link
Copy Markdown
Contributor Author

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

shredderique commented Jun 1, 2026

Copy link
Copy Markdown

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

allozaur commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

@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

allozaur commented Jun 2, 2026

Copy link
Copy Markdown
Contributor Author

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

@allozaur allozaur left a comment

Copy link
Copy Markdown
Contributor Author

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

@ggerganov ggerganov left a comment

Copy link
Copy Markdown
Member

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

julien-c commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

just tried it, very cool!

@bickelj

bickelj commented Jun 11, 2026

Copy link
Copy Markdown

Wow, very nice. I was trying to figure out why thinking seemed to be suddenly disabled, I saw this in the requests:

{
	"chat_template_kwargs": {
		"enable_thinking": false
	},
}

It was upsetting until I found this PR and the little button. Now I am so glad that thinking was auto-disabled so I could find this per-request control on the thinking budget. 🥂

zbrad pushed a commit to zbrad/llama.cpp that referenced this pull request Jul 3, 2026
…nts for Chat Form Add Action UI (ggml-org#23434)

* feat: Add "Thinking" toggle and status icon + redesign Chat Form Actions Add panel

* test: Update test reference

* fix: Icon

* fix: E2E test command

* fix: wait for greeting h1 to be visible in e2e test

* fix: remove duplicate PDF option in attachment dropdown

* fix: use label-based group toggle to avoid stale references

* refactor: inline MCP server and tool toggles in mobile sheet

* fix: serve correct build directory in e2e playwright config

* feat: add reasoning effort levels selector in model dropdown

* feat: Reasoning effort

* refactor: Make server origin configurable via environment variable

* feat: Add chat template thinking detector utility

* feat: Add thinking support detection to models store

* refactor: Update model selector components with thinking detection and message-specific indicators

* feat: Update chat form components for model selection and thinking support

* feat: Improve Reasoning controls UI

* refactor: Apply suggestions from code review

Co-authored-by: Aleksander Grygier <aleksander.grygier@gmail.com>

* fix: Model tags

* refactor: Cleanup

* refactor: Remove unneeded components

* refactor: Cleanup
adrianhoehne pushed a commit to adrianhoehne/llama.cpp that referenced this pull request Jul 5, 2026
…nts for Chat Form Add Action UI (ggml-org#23434)

* feat: Add "Thinking" toggle and status icon + redesign Chat Form Actions Add panel

* test: Update test reference

* fix: Icon

* fix: E2E test command

* fix: wait for greeting h1 to be visible in e2e test

* fix: remove duplicate PDF option in attachment dropdown

* fix: use label-based group toggle to avoid stale references

* refactor: inline MCP server and tool toggles in mobile sheet

* fix: serve correct build directory in e2e playwright config

* feat: add reasoning effort levels selector in model dropdown

* feat: Reasoning effort

* refactor: Make server origin configurable via environment variable

* feat: Add chat template thinking detector utility

* feat: Add thinking support detection to models store

* refactor: Update model selector components with thinking detection and message-specific indicators

* feat: Update chat form components for model selection and thinking support

* feat: Improve Reasoning controls UI

* refactor: Apply suggestions from code review

Co-authored-by: Aleksander Grygier <aleksander.grygier@gmail.com>

* fix: Model tags

* refactor: Cleanup

* refactor: Remove unneeded components

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

Projects

None yet

9 participants