[PR #15202] [CLOSED] Thinking mode feature #111064

Closed
opened 2026-05-18 10:48:56 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/15202
Author: @shua-ie
Created: 6/21/2025
Status: Closed

Base: devHead: thinking-mode-feature


📝 Commits (1)

  • 6bb677c Add thinking mode toggle for Ollama thinking models

📊 Changes

15 files changed (+126 additions, -26 deletions)

View changed files

📝 src/lib/apis/index.ts (+3 -3)
📝 src/lib/apis/ollama/index.ts (+1 -1)
📝 src/lib/apis/users/index.ts (+1 -1)
📝 src/lib/components/admin/Settings/Models.svelte (+2 -2)
📝 src/lib/components/chat/Chat.svelte (+22 -0)
📝 src/lib/components/chat/MessageInput.svelte (+75 -2)
📝 src/lib/components/chat/MessageInput/CallOverlay.svelte (+1 -1)
📝 src/lib/components/chat/Placeholder.svelte (+2 -0)
📝 src/lib/components/chat/Settings/Audio.svelte (+1 -1)
📝 src/lib/i18n/index.ts (+2 -2)
📝 src/lib/i18n/locales/en-US/translation.json (+3 -0)
📝 src/lib/utils/characters/index.ts (+5 -5)
📝 src/lib/utils/marked/katex-extension.ts (+6 -6)
📝 src/lib/workers/kokoro.worker.ts (+1 -1)
📝 src/lib/workers/pyodide.worker.ts (+1 -1)

📄 Description

Pull Request Checklist

Note to first-time contributors: Please open a discussion post in Discussions and describe your changes before submitting a pull request.

Before submitting, make sure you've checked the following:

  • [ x] Target branch: Please verify that the pull request targets the dev branch.
  • [ x] Description: Provide a concise description of the changes made in this pull request.
  • [ x] Changelog: Ensure a changelog entry following the format of Keep a Changelog is added at the bottom of the PR description.
  • Documentation: Have you updated relevant documentation Open WebUI Docs, or other documentation sources?
  • [ x] Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • [ x] Testing: Have you written and run sufficient tests to validate the changes?
  • [ x] Code review: Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards?
  • [x ] Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • feat: Introduces a new feature or enhancement to the codebase

Overview

This PR adds a thinking mode toggle for compatible Ollama models that support the thinking feature. The toggle appears only for thinking-capable models (deepseek-r1, qwen3, magistral) and sends the appropriate API payload to enable thinking mode.

Technical Implementation

  • Model Detection: Filters models by name to identify thinking-capable Ollama models
  • API Integration: Sends {"options": {"thinking": true}} payload only for compatible Ollama models
  • UI/UX: Consistent styling with existing toggles (web search, image generation, code interpreter)
  • Visual Feedback: Blue indicator banner with animated brain icon when thinking mode is active
  • State Management: Integrates with existing chat input persistence and resets appropriately

Changelog Entry

Description

Added a thinking mode toggle feature for Ollama models that support thinking capabilities. The toggle appears only for compatible models (deepseek-r1, qwen3, magistral) and sends the appropriate thinking option in the API payload when enabled. Includes visual feedback and proper state management integration.

Added

  • Thinking mode toggle button in MessageInput component for compatible Ollama models
  • Visual indicator banner when thinking mode is active with animated brain icon
  • Model compatibility detection for thinking-capable models (deepseek-r1, qwen3, magistral)
  • Internationalization support for thinking mode UI elements
  • State management integration for thinking mode persistence

Changed

  • Modified MessageInput.svelte to include thinking mode toggle and state management
  • Updated Chat.svelte to send thinking option in API payload for compatible Ollama models
  • Enhanced Placeholder.svelte to pass through thinking mode state
  • Added new translation strings to en-US/translation.json for thinking mode

Deprecated

  • None

Removed

  • None

Fixed

  • [List any fixes, corrections, or bug fixes]

Security

  • None

Breaking Changes

  • BREAKING CHANGE: None

Additional Information

  • Feature is currently only available for Ollama thinking-capable models as specified
  • Toggle gracefully hides for non-compatible models ensuring backward compatibility
  • No breaking changes to existing functionality or API endpoints
  • Implementation follows existing patterns for similar toggle features (web search, image generation)

Screenshots or Videos

Thinking Available model:
Screenshot-1
Thinking unavailable model:
Screenshot-3

Contributor License Agreement

By submitting this pull request, I confirm that I have read and fully agree to the Contributor License Agreement (CLA), and I am providing my contributions under its terms.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/open-webui/open-webui/pull/15202 **Author:** [@shua-ie](https://github.com/shua-ie) **Created:** 6/21/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `thinking-mode-feature` --- ### 📝 Commits (1) - [`6bb677c`](https://github.com/open-webui/open-webui/commit/6bb677c9b396c0ac1c0aa4f607509b1ec672800a) Add thinking mode toggle for Ollama thinking models ### 📊 Changes **15 files changed** (+126 additions, -26 deletions) <details> <summary>View changed files</summary> 📝 `src/lib/apis/index.ts` (+3 -3) 📝 `src/lib/apis/ollama/index.ts` (+1 -1) 📝 `src/lib/apis/users/index.ts` (+1 -1) 📝 `src/lib/components/admin/Settings/Models.svelte` (+2 -2) 📝 `src/lib/components/chat/Chat.svelte` (+22 -0) 📝 `src/lib/components/chat/MessageInput.svelte` (+75 -2) 📝 `src/lib/components/chat/MessageInput/CallOverlay.svelte` (+1 -1) 📝 `src/lib/components/chat/Placeholder.svelte` (+2 -0) 📝 `src/lib/components/chat/Settings/Audio.svelte` (+1 -1) 📝 `src/lib/i18n/index.ts` (+2 -2) 📝 `src/lib/i18n/locales/en-US/translation.json` (+3 -0) 📝 `src/lib/utils/characters/index.ts` (+5 -5) 📝 `src/lib/utils/marked/katex-extension.ts` (+6 -6) 📝 `src/lib/workers/kokoro.worker.ts` (+1 -1) 📝 `src/lib/workers/pyodide.worker.ts` (+1 -1) </details> ### 📄 Description # Pull Request Checklist ### Note to first-time contributors: Please open a discussion post in [Discussions](https://github.com/open-webui/open-webui/discussions) and describe your changes before submitting a pull request. - https://github.com/open-webui/open-webui/discussions/15201 **Before submitting, make sure you've checked the following:** - [ x] **Target branch:** Please verify that the pull request targets the `dev` branch. - [ x] **Description:** Provide a concise description of the changes made in this pull request. - [ x] **Changelog:** Ensure a changelog entry following the format of [Keep a Changelog](https://keepachangelog.com/) is added at the bottom of the PR description. - [ ] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [ x] **Dependencies:** Are there any new dependencies? Have you updated the dependency versions in the documentation? - [ x] **Testing:** Have you written and run sufficient tests to validate the changes? - [ x] **Code review:** Have you performed a self-review of your code, addressing any coding standard issues and ensuring adherence to the project's coding standards? - [x ] **Prefix:** To clearly categorize this pull request, prefix the pull request title using one of the following: - **feat**: Introduces a new feature or enhancement to the codebase ## Overview This PR adds a thinking mode toggle for compatible Ollama models that support the thinking feature. The toggle appears only for thinking-capable models (deepseek-r1, qwen3, magistral) and sends the appropriate API payload to enable thinking mode. ## Technical Implementation - **Model Detection**: Filters models by name to identify thinking-capable Ollama models - **API Integration**: Sends `{"options": {"thinking": true}}` payload only for compatible Ollama models - **UI/UX**: Consistent styling with existing toggles (web search, image generation, code interpreter) - **Visual Feedback**: Blue indicator banner with animated brain icon when thinking mode is active - **State Management**: Integrates with existing chat input persistence and resets appropriately # Changelog Entry ### Description Added a thinking mode toggle feature for Ollama models that support thinking capabilities. The toggle appears only for compatible models (deepseek-r1, qwen3, magistral) and sends the appropriate thinking option in the API payload when enabled. Includes visual feedback and proper state management integration. ### Added - Thinking mode toggle button in MessageInput component for compatible Ollama models - Visual indicator banner when thinking mode is active with animated brain icon - Model compatibility detection for thinking-capable models (deepseek-r1, qwen3, magistral) - Internationalization support for thinking mode UI elements - State management integration for thinking mode persistence ### Changed - Modified MessageInput.svelte to include thinking mode toggle and state management - Updated Chat.svelte to send thinking option in API payload for compatible Ollama models - Enhanced Placeholder.svelte to pass through thinking mode state - Added new translation strings to en-US/translation.json for thinking mode ### Deprecated - None ### Removed - None ### Fixed - [List any fixes, corrections, or bug fixes] ### Security - None ### Breaking Changes - **BREAKING CHANGE**: None --- ### Additional Information - Feature is currently only available for Ollama thinking-capable models as specified - Toggle gracefully hides for non-compatible models ensuring backward compatibility - No breaking changes to existing functionality or API endpoints - Implementation follows existing patterns for similar toggle features (web search, image generation) ### Screenshots or Videos Thinking Available model: ![Screenshot-1](https://github.com/user-attachments/assets/90ff4075-847e-4fa5-98fb-2e6d7f852fa5) Thinking unavailable model: ![Screenshot-3](https://github.com/user-attachments/assets/27d3ae68-a94c-41fc-9be1-cde9fabace47) ### Contributor License Agreement By submitting this pull request, I confirm that I have read and fully agree to the [Contributor License Agreement (CLA)](/CONTRIBUTOR_LICENSE_AGREEMENT), and I am providing my contributions under its terms. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-18 10:48:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#111064