913e0d3 fix: complete file cleanup when removing from Knowledge Base
📊 Changes
1 file changed (+13 additions, -1 deletions)
View changed files
📝backend/open_webui/routers/knowledge.py (+13 -1)
📄 Description
fix: complete file cleanup when removing from Knowledge Base
Pull Request Checklist
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
Prefix: To cleary categorize this pull request, prefix the pull request title
Changelog Entry
Fixed file cleanup when removing from Knowledge Base - files are now properly deleted from storage, database, and vector storage instead of remaining as orphaned resources
Description
Currently, when removing a file from a Knowledge Base, the system only partially cleans up the resources. This PR implements a complete cleanup by:
Removing the file's vectors from the Knowledge Base collection in ChromaDB
Removing the file's dedicated collection from ChromaDB (file-{id})
Deleting the physical file from storage
Removing the file entry from the SQLite database
Maintaining the existing security checks and KB data updates
Changed
Modified remove_file_from_knowledge_by_id in backend/open_webui/routers/knowledge.py to:
Delete the file's vectors from KB collection in ChromaDB
Delete the file's dedicated collection from ChromaDB
Delete the physical file from storage
Remove the file entry from the database
Keep existing permission checks and KB data updates
🔄 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/8499
**Author:** [@juananpe](https://github.com/juananpe)
**Created:** 1/12/2025
**Status:** ✅ Merged
**Merged:** 1/13/2025
**Merged by:** [@tjbck](https://github.com/tjbck)
**Base:** `dev` ← **Head:** `file-cleanup-knowledge`
---
### 📝 Commits (1)
- [`913e0d3`](https://github.com/open-webui/open-webui/commit/913e0d391b6d2ec68a055e5d0c787e096ea0d48b) fix: complete file cleanup when removing from Knowledge Base
### 📊 Changes
**1 file changed** (+13 additions, -1 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/routers/knowledge.py` (+13 -1)
</details>
### 📄 Description
fix: complete file cleanup when removing from Knowledge Base
# Pull Request Checklist
- [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
- [x] **Prefix:** To cleary categorize this pull request, prefix the pull request title
# Changelog Entry
- Fixed file cleanup when removing from Knowledge Base - files are now properly deleted from storage, database, and vector storage instead of remaining as orphaned resources
### Description
Currently, when removing a file from a Knowledge Base, the system only partially cleans up the resources. This PR implements a complete cleanup by:
1. Removing the file's vectors from the Knowledge Base collection in ChromaDB
2. Removing the file's dedicated collection from ChromaDB (file-{id})
3. Deleting the physical file from storage
4. Removing the file entry from the SQLite database
5. Maintaining the existing security checks and KB data updates
### Changed
- Modified `remove_file_from_knowledge_by_id` in `backend/open_webui/routers/knowledge.py` to:
- Delete the file's vectors from KB collection in ChromaDB
- Delete the file's dedicated collection from ChromaDB
- Delete the physical file from storage
- Remove the file entry from the database
- Keep existing permission checks and KB data updates
---
<sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/open-webui/open-webui/pull/8499
Author: @juananpe
Created: 1/12/2025
Status: ✅ Merged
Merged: 1/13/2025
Merged by: @tjbck
Base:
dev← Head:file-cleanup-knowledge📝 Commits (1)
913e0d3fix: complete file cleanup when removing from Knowledge Base📊 Changes
1 file changed (+13 additions, -1 deletions)
View changed files
📝
backend/open_webui/routers/knowledge.py(+13 -1)📄 Description
fix: complete file cleanup when removing from Knowledge Base
Pull Request Checklist
devbranch.Changelog Entry
Description
Currently, when removing a file from a Knowledge Base, the system only partially cleans up the resources. This PR implements a complete cleanup by:
Changed
remove_file_from_knowledge_by_idinbackend/open_webui/routers/knowledge.pyto:🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.