[PR #16879] [CLOSED] feat: Human in the loop #127925

Closed
opened 2026-05-21 10:13:16 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/16879
Author: @leoperleo
Created: 8/24/2025
Status: Closed

Base: devHead: human-in-the-loop-dev


📝 Commits (6)

  • cb8840d feat: implement backend tool approval system
  • 6d579a1 feat: implement WebSocket communication layer for tool approval
  • 55bcdea feat: implement frontend tool approval interface
  • 4476e3f feat: add global tool approval toggle in admin settings
  • e9e042c feat: add internationalization support for tool approval
  • ef899c0 minor fix and refinement

📊 Changes

71 files changed (+3052 additions, -7945 deletions)

View changed files

📝 backend/open_webui/config.py (+8 -26)
📝 backend/open_webui/main.py (+65 -87)
📝 backend/open_webui/routers/auths.py (+9 -13)
📝 backend/open_webui/socket/main.py (+111 -4)
📝 backend/open_webui/utils/middleware.py (+270 -78)
backend/open_webui/utils/tool_approval.py (+122 -0)
📝 src/lib/components/admin/Settings/General.svelte (+10 -2)
📝 src/lib/components/chat/Chat.svelte (+35 -86)
📝 src/lib/components/chat/MessageInput.svelte (+82 -68)
src/lib/components/chat/ToolApprovalModal.svelte (+230 -0)
📝 src/lib/i18n/locales/ar-BH/translation.json (+7 -110)
📝 src/lib/i18n/locales/ar/translation.json (+3 -106)
📝 src/lib/i18n/locales/bg-BG/translation.json (+4 -107)
📝 src/lib/i18n/locales/bn-BD/translation.json (+7 -110)
📝 src/lib/i18n/locales/bo-TB/translation.json (+3 -106)
📝 src/lib/i18n/locales/ca-ES/translation.json (+5 -108)
📝 src/lib/i18n/locales/ceb-PH/translation.json (+7 -110)
📝 src/lib/i18n/locales/cs-CZ/translation.json (+1157 -1260)
📝 src/lib/i18n/locales/da-DK/translation.json (+3 -106)
📝 src/lib/i18n/locales/de-DE/translation.json (+27 -120)

...and 51 more files

📄 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:

  • Target branch: Please verify that the pull request targets the dev branch.
  • Description: Provide a concise description of the changes made in this pull request.
  • 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?
  • Dependencies: Are there any new dependencies? Have you updated the dependency versions in the documentation?
  • Testing: Have you written and run sufficient tests to validate the changes?
  • 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?
  • Prefix: To clearly categorize this pull request, prefix the pull request title using one of the following:
    • BREAKING CHANGE: Significant changes that may affect compatibility
    • build: Changes that affect the build system or external dependencies
    • ci: Changes to our continuous integration processes or workflows
    • chore: Refactor, cleanup, or other non-functional code changes
    • docs: Documentation update or addition
    • feat: Introduces a new feature or enhancement to the codebase
    • fix: Bug fix or error correction
    • i18n: Internationalization or localization changes
    • perf: Performance improvement
    • refactor: Code restructuring for better maintainability, readability, or scalability
    • style: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.)
    • test: Adding missing tests or correcting existing tests
    • WIP: Work in progress, a temporary label for incomplete or ongoing work

Changelog Entry

Description

This pull request implements a comprehensive tool approval system that allows users to control when and how AI tools are executed during conversations. The system provides both per-chat and global configuration options, with a user-friendly interface that includes real-time notifications, approval modals, and visual indicators for auto-approval status.

Added

  • Tool Approval Modal: Interactive modal interface for approving or denying individual tool executions with detailed tool information and parameters
  • Auto-Approval Badge: Visual indicator in chat input showing when auto-approval is enabled for the current chat, with toggle functionality
  • WebSocket Communication Layer: Real-time bidirectional communication between frontend and backend for tool approval requests and responses
  • Per-Chat Auto-Approval Settings: Individual chat-level configuration to automatically approve all tool executions
  • Global Tool Approval Toggle: Admin-level setting to enable/disable the tool approval system across the entire instance
  • Internationalization Support: Multi-language support for all tool approval UI elements and messages
  • Cross-Tab Coordination: Browser-level coordination to handle tool approvals across multiple open tabs
  • Event-Driven Architecture: Custom event system for real-time communication between UI components

Changed

  • Tool Execution Flow: Modified to include approval step before tool execution, with proper error handling and user feedback
  • Database Schema: Extended to support per-chat auto-approval preferences storage
  • WebSocket Protocol: Enhanced to handle tool approval message types and coordination
  • Frontend State Management: Improved reactive state handling for approval status across components

Deprecated

  • N/A

Removed

  • N/A

Fixed

  • N/A

Security

  • Tool Execution Control: Enhanced security by requiring explicit user approval before executing potentially sensitive tools

Breaking Changes

  • N/A

Additional Information

Screenshots or Videos

image image

youtube - demo video

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/16879 **Author:** [@leoperleo](https://github.com/leoperleo) **Created:** 8/24/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `human-in-the-loop-dev` --- ### 📝 Commits (6) - [`cb8840d`](https://github.com/open-webui/open-webui/commit/cb8840d021f81b8709f1bd3ab821f51697173273) feat: implement backend tool approval system - [`6d579a1`](https://github.com/open-webui/open-webui/commit/6d579a1dc13a94f00717d8160330815e91932f78) feat: implement WebSocket communication layer for tool approval - [`55bcdea`](https://github.com/open-webui/open-webui/commit/55bcdea39526574eeea632d68f4afddefa0f7280) feat: implement frontend tool approval interface - [`4476e3f`](https://github.com/open-webui/open-webui/commit/4476e3f239e85ad13a80dee84232f888c103905d) feat: add global tool approval toggle in admin settings - [`e9e042c`](https://github.com/open-webui/open-webui/commit/e9e042c4f4937f39b64126769d747b096a26473b) feat: add internationalization support for tool approval - [`ef899c0`](https://github.com/open-webui/open-webui/commit/ef899c0641911bb1891aa34f453d4ba309bd1aee) minor fix and refinement ### 📊 Changes **71 files changed** (+3052 additions, -7945 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+8 -26) 📝 `backend/open_webui/main.py` (+65 -87) 📝 `backend/open_webui/routers/auths.py` (+9 -13) 📝 `backend/open_webui/socket/main.py` (+111 -4) 📝 `backend/open_webui/utils/middleware.py` (+270 -78) ➕ `backend/open_webui/utils/tool_approval.py` (+122 -0) 📝 `src/lib/components/admin/Settings/General.svelte` (+10 -2) 📝 `src/lib/components/chat/Chat.svelte` (+35 -86) 📝 `src/lib/components/chat/MessageInput.svelte` (+82 -68) ➕ `src/lib/components/chat/ToolApprovalModal.svelte` (+230 -0) 📝 `src/lib/i18n/locales/ar-BH/translation.json` (+7 -110) 📝 `src/lib/i18n/locales/ar/translation.json` (+3 -106) 📝 `src/lib/i18n/locales/bg-BG/translation.json` (+4 -107) 📝 `src/lib/i18n/locales/bn-BD/translation.json` (+7 -110) 📝 `src/lib/i18n/locales/bo-TB/translation.json` (+3 -106) 📝 `src/lib/i18n/locales/ca-ES/translation.json` (+5 -108) 📝 `src/lib/i18n/locales/ceb-PH/translation.json` (+7 -110) 📝 `src/lib/i18n/locales/cs-CZ/translation.json` (+1157 -1260) 📝 `src/lib/i18n/locales/da-DK/translation.json` (+3 -106) 📝 `src/lib/i18n/locales/de-DE/translation.json` (+27 -120) _...and 51 more files_ </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. **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. - [x] **Documentation:** Have you updated relevant documentation [Open WebUI Docs](https://github.com/open-webui/docs), or other documentation sources? - [ ] **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: - **BREAKING CHANGE**: Significant changes that may affect compatibility - **build**: Changes that affect the build system or external dependencies - **ci**: Changes to our continuous integration processes or workflows - **chore**: Refactor, cleanup, or other non-functional code changes - **docs**: Documentation update or addition - **feat**: Introduces a new feature or enhancement to the codebase - **fix**: Bug fix or error correction - **i18n**: Internationalization or localization changes - **perf**: Performance improvement - **refactor**: Code restructuring for better maintainability, readability, or scalability - **style**: Changes that do not affect the meaning of the code (white space, formatting, missing semi-colons, etc.) - **test**: Adding missing tests or correcting existing tests - **WIP**: Work in progress, a temporary label for incomplete or ongoing work # Changelog Entry ### Description This pull request implements a comprehensive tool approval system that allows users to control when and how AI tools are executed during conversations. The system provides both per-chat and global configuration options, with a user-friendly interface that includes real-time notifications, approval modals, and visual indicators for auto-approval status. ### Added - Tool Approval Modal: Interactive modal interface for approving or denying individual tool executions with detailed tool information and parameters - Auto-Approval Badge: Visual indicator in chat input showing when auto-approval is enabled for the current chat, with toggle functionality - WebSocket Communication Layer: Real-time bidirectional communication between frontend and backend for tool approval requests and responses - Per-Chat Auto-Approval Settings: Individual chat-level configuration to automatically approve all tool executions - Global Tool Approval Toggle: Admin-level setting to enable/disable the tool approval system across the entire instance - Internationalization Support: Multi-language support for all tool approval UI elements and messages - Cross-Tab Coordination: Browser-level coordination to handle tool approvals across multiple open tabs - Event-Driven Architecture: Custom event system for real-time communication between UI components ### Changed - Tool Execution Flow: Modified to include approval step before tool execution, with proper error handling and user feedback - Database Schema: Extended to support per-chat auto-approval preferences storage - WebSocket Protocol: Enhanced to handle tool approval message types and coordination - Frontend State Management: Improved reactive state handling for approval status across components ### Deprecated - N/A ### Removed - N/A ### Fixed - N/A ### Security - Tool Execution Control: Enhanced security by requiring explicit user approval before executing potentially sensitive tools ### Breaking Changes - N/A --- ### Additional Information - Documentation ready to be merged: [Human in the loop docs](https://barbaronno.github.io/docs/features/human%20in%20the%20loop/) - Open discussion here: [Discussion 16701](https://github.com/open-webui/open-webui/discussions/16701) ### Screenshots or Videos <img width="1604" height="988" alt="image" src="https://github.com/user-attachments/assets/2df2fe6b-b5b9-4c55-850a-3a383edc2c50" /> <img width="2265" height="1226" alt="image" src="https://github.com/user-attachments/assets/ea9631c4-03ad-4942-b021-aca53df0e393" /> [youtube - demo video](https://www.youtube.com/watch?v=F-IUOZrHj68&ab_channel=Barbaronno) ### 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-21 10:13:16 -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#127925