[PR #8816] [CLOSED] feat: Add search query configuration for multiple searching query handling #9086

Closed
opened 2025-11-11 18:13:45 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/open-webui/open-webui/pull/8816
Author: @hurxxxx
Created: 1/23/2025
Status: Closed

Base: devHead: dev


📝 Commits (10+)

  • 920ef69 feat: Add search query configuration for multiple searching query handling
  • 122dcb4 fix: ALLOW_MULTIPLE_SEARCH_QUERIES set default False
  • 4fe0eef refactor: use clearer naming for option and variable
  • ae46aca Merge remote-tracking branch 'upstream/dev' into dev
  • ec644a0 Merge remote-tracking branch 'upstream/dev' into dev
  • 6b29e2a Merge remote-tracking branch 'upstream/dev' into dev
  • f92b4b1 Merge remote-tracking branch 'upstream/dev' into dev
  • 6b4cbcd Merge remote-tracking branch 'upstream/dev' into dev
  • 6d82761 fix : resolve conflict and fetch Inferface.svelte
  • 0443630 fix: default value

📊 Changes

54 files changed (+137 additions, -64 deletions)

View changed files

📝 backend/open_webui/config.py (+6 -0)
📝 backend/open_webui/main.py (+2 -0)
📝 backend/open_webui/routers/tasks.py (+6 -0)
📝 backend/open_webui/utils/middleware.py (+64 -63)
📝 src/lib/components/admin/Settings/Interface.svelte (+9 -0)
📝 src/lib/i18n/locales/ar-BH/translation.json (+1 -0)
📝 src/lib/i18n/locales/bg-BG/translation.json (+1 -0)
📝 src/lib/i18n/locales/bn-BD/translation.json (+1 -0)
📝 src/lib/i18n/locales/ca-ES/translation.json (+1 -0)
📝 src/lib/i18n/locales/ceb-PH/translation.json (+1 -0)
📝 src/lib/i18n/locales/cs-CZ/translation.json (+1 -0)
📝 src/lib/i18n/locales/da-DK/translation.json (+1 -0)
📝 src/lib/i18n/locales/de-DE/translation.json (+1 -0)
📝 src/lib/i18n/locales/dg-DG/translation.json (+1 -0)
📝 src/lib/i18n/locales/el-GR/translation.json (+1 -0)
📝 src/lib/i18n/locales/en-GB/translation.json (+1 -0)
📝 src/lib/i18n/locales/en-US/translation.json (+1 -0)
📝 src/lib/i18n/locales/es-ES/translation.json (+1 -0)
📝 src/lib/i18n/locales/eu-ES/translation.json (+1 -0)
📝 src/lib/i18n/locales/fa-IR/translation.json (+1 -0)

...and 34 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 for validating 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 cleary 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

Currently, web search only processes a single hardcoded query, even when multiple search queries are generated. To improve this functionality, the following changes have been introduced:

  • Duplicate keywords are removed before performing the search.
  • Added an "Allow Multiple Search Queries" option under Admin Settings → Interface.
    • When set to False, the behavior remains unchanged: only the first query generated by the Query Generation Prompt is searched and added to the context.
    • When set to True, all generated search queries are executed and included in the context.

Added

Changed

  • backend/open_webui/config.py
  • backend/open_webui/main.py
  • backend/open_webui/routers/tasks.py
  • backend/open_webui/utils/middleware.py
  • src/lib/components/admin/Settings/Interface.svelte
  • Changes apply to all translation files located under src/lib/i18n/locales/

Deprecated

Removed

Fixed

Security

Breaking Changes


Additional Information

The changes are as follows:

  • Removed duplicate keywords
  • Added code related to the "Allow Multiple Search Queries" option
  • Added a for loop

async def chat_web_search_handler(
    request: Request, form_data: dict, extra_params: dict, user
):

...

queries = queries.get("queries", [])
queries = list(dict.fromkeys(queries))   #Remove duplicate keywords


#searchQuery = queries[0]  ##Disable


 searchQueries = queries
 if not request.app.state.config.ALLOW_MULTIPLE_SEARCH_QUERIES:
     searchQueries = [queries[0]]

 for searchQuery in searchQueries:

...

Screenshots or Videos

405900689-596f3c70-2294-4103-9527-a2ddca575fbf


🔄 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/8816 **Author:** [@hurxxxx](https://github.com/hurxxxx) **Created:** 1/23/2025 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `dev` --- ### 📝 Commits (10+) - [`920ef69`](https://github.com/open-webui/open-webui/commit/920ef697d5d98b6527771be930f0a888299d8d8c) feat: Add search query configuration for multiple searching query handling - [`122dcb4`](https://github.com/open-webui/open-webui/commit/122dcb4a9a5d4c17ab7ae84284e85a991b3a328b) fix: ALLOW_MULTIPLE_SEARCH_QUERIES set default False - [`4fe0eef`](https://github.com/open-webui/open-webui/commit/4fe0eefaca3359e00d64070492f940a4943c1071) refactor: use clearer naming for option and variable - [`ae46aca`](https://github.com/open-webui/open-webui/commit/ae46acaf494289330172bfaa0ab01ee9ec891487) Merge remote-tracking branch 'upstream/dev' into dev - [`ec644a0`](https://github.com/open-webui/open-webui/commit/ec644a04b2a1e2f838323ebd9b551dc989f8e4c0) Merge remote-tracking branch 'upstream/dev' into dev - [`6b29e2a`](https://github.com/open-webui/open-webui/commit/6b29e2a9b89cfe30972dafb824c59e33ede30b78) Merge remote-tracking branch 'upstream/dev' into dev - [`f92b4b1`](https://github.com/open-webui/open-webui/commit/f92b4b1b28730bd16069882c8fa2e1cefa0cc22f) Merge remote-tracking branch 'upstream/dev' into dev - [`6b4cbcd`](https://github.com/open-webui/open-webui/commit/6b4cbcdf50131deb2ff4b8d7be30ece3ec412d20) Merge remote-tracking branch 'upstream/dev' into dev - [`6d82761`](https://github.com/open-webui/open-webui/commit/6d827618e3db036d5ac7095bf069e07ebcfc06ab) fix : resolve conflict and fetch Inferface.svelte - [`0443630`](https://github.com/open-webui/open-webui/commit/044363082e4148d08a1f1b677a0fb501e8615830) fix: default value ### 📊 Changes **54 files changed** (+137 additions, -64 deletions) <details> <summary>View changed files</summary> 📝 `backend/open_webui/config.py` (+6 -0) 📝 `backend/open_webui/main.py` (+2 -0) 📝 `backend/open_webui/routers/tasks.py` (+6 -0) 📝 `backend/open_webui/utils/middleware.py` (+64 -63) 📝 `src/lib/components/admin/Settings/Interface.svelte` (+9 -0) 📝 `src/lib/i18n/locales/ar-BH/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/bg-BG/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/bn-BD/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/ca-ES/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/ceb-PH/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/cs-CZ/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/da-DK/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/de-DE/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/dg-DG/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/el-GR/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/en-GB/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/en-US/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/es-ES/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/eu-ES/translation.json` (+1 -0) 📝 `src/lib/i18n/locales/fa-IR/translation.json` (+1 -0) _...and 34 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. - [ ] **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? - [ ] **Testing:** Have you written and run sufficient tests for validating 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 cleary 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 Currently, web search only processes a single hardcoded query, even when multiple search queries are generated. To improve this functionality, the following changes have been introduced: - Duplicate keywords are removed before performing the search. - Added an "Allow Multiple Search Queries" option under **Admin Settings → Interface**. - When set to **False**, the behavior remains unchanged: only the first query generated by the Query Generation Prompt is searched and added to the context. - When set to **True**, all generated search queries are executed and included in the context. ### Added ### Changed - backend/open_webui/config.py - backend/open_webui/main.py - backend/open_webui/routers/tasks.py - backend/open_webui/utils/middleware.py - src/lib/components/admin/Settings/Interface.svelte - Changes apply to all translation files located under src/lib/i18n/locales/ ### Deprecated ### Removed ### Fixed ### Security ### Breaking Changes --- ### Additional Information The changes are as follows: - Removed duplicate keywords - Added code related to the "Allow Multiple Search Queries" option - Added a for loop ```python async def chat_web_search_handler( request: Request, form_data: dict, extra_params: dict, user ): ... queries = queries.get("queries", []) queries = list(dict.fromkeys(queries)) #Remove duplicate keywords #searchQuery = queries[0] ##Disable searchQueries = queries if not request.app.state.config.ALLOW_MULTIPLE_SEARCH_QUERIES: searchQueries = [queries[0]] for searchQuery in searchQueries: ... ``` ### Screenshots or Videos ![405900689-596f3c70-2294-4103-9527-a2ddca575fbf](https://github.com/user-attachments/assets/24a95b5b-68c1-46e7-8600-ca5ae327ae04) --- <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 2025-11-11 18:13:45 -06: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#9086