mirror of
https://github.com/open-webui/open-webui.git
synced 2026-07-17 08:21:12 -05:00
[PR #24831] fix: auto-link files to Knowledge Collection after processing completes #115188
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/24831
Author: @kindredzhang
Created: 5/17/2026
Status: 🔄 Open
Base:
dev← Head:fix/knowledge-upload-24807📝 Commits (1)
2c75d4bfix: auto-link files to Knowledge Collection after processing completes📊 Changes
1 file changed (+15 additions, -0 deletions)
View changed files
📝
backend/open_webui/routers/files.py(+15 -0)📄 Description
Pull Request Checklist
Closes #24807devfixDescription
When a file is uploaded to a Knowledge Collection, the final linking step previously depended on the frontend calling
POST /knowledge/{id}/file/addafter the SSE processing stream completed. If the user navigated away before that call fired, the file was processed successfully but permanently orphaned — visible in Global Files but absent from the Knowledge Collection.This change moves the linking operation server-side, inside
process_uploaded_file(), afterprocess_file()finishes. The upload request already carriesknowledge_idin file metadata, so the backend has all the information needed to complete the association without any frontend participation.The existing frontend code in
KnowledgeBase.sveltestill callsaddFileHandler()after upload — for Knowledge Collection uploads this becomes a duplicate call, butKnowledges.add_file_to_knowledge_by_id()is idempotent (DB insert is a no-op on duplicate), so no harm is done.Validation
Changelog Entry
Fixed
process_uploaded_file(), removing the dependence on the frontend maintaining an active SSE connection.Screenshots or Videos
Not applicable; backend behavior fix, no UI change.
Contributor License Agreement
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.