mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-28 17:59:25 -05:00
[PR #12507] [MERGED] fix: fix web results all getting the same source id when using embedding and retrieval #93973
Reference in New Issue
Block a user
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/12507
Author: @Ithanil
Created: 4/6/2025
Status: ✅ Merged
Merged: 4/6/2025
Merged by: @tjbck
Base:
dev← Head:fix_web_result_collection_source_ids📝 Commits (1)
4476060fix web results all getting the same source id when using embedding and retrieval📊 Changes
2 files changed (+27 additions, -23 deletions)
View changed files
📝
backend/open_webui/routers/retrieval.py(+17 -14)📝
backend/open_webui/utils/middleware.py(+10 -9)📄 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:
devbranch.Changelog Entry
Description
All web search results per search query were assigned the same source id before, despite containing content from different URLs. Thus, URLs wouldn't be cited correctly.
This PR fixes the source id assignment for the case of web search with embedding&retrieval, making sure every URL gets its own collection and thus source id.
Fixed
Additional Information
This fixes https://github.com/open-webui/open-webui/discussions/11205 for web search (together with https://github.com/open-webui/open-webui/pull/12506). I think further fixes are needed for RAG with knowledge bases and potentially also tool results (https://github.com/open-webui/open-webui/discussions/10595). The case of regular file uploads within the chat is fine.
It works in conjunction with additional sources, e.g. from file uploads, or multiple search queries.
Alternatives considered
https://github.com/open-webui/open-webui/discussions/11205#discussioncomment-12684414 , but I think that would assign a different source id to every chunk in embed&retrieval mode.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.