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
Code review: Have you performed a self-review of your code
Changelog Entry
Fix file deletion to properly clean up resources
Description
When deleting files from either knowledge bases or chat, the system wasn't properly cleaning up all associated resources, particularly in the sqlite DB. This caused issues with re-uploading previously deleted files and left orphaned entries in the database and the uploads/ folder.
Known issues
There still are orphaned collections (file-UID) in Chroma when removing a file from the chat input. I don't like to add more coupling in routers/files.py with something like this in the delete_file_by_id function:
So I added a comment there ( # We should add Chroma cleanup here) as a placeholder to remember that we should act here.
🔄 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/8547
**Author:** [@juananpe](https://github.com/juananpe)
**Created:** 1/14/2025
**Status:** ✅ Merged
**Merged:** 1/15/2025
**Merged by:** [@tjbck](https://github.com/tjbck)
**Base:** `dev` ← **Head:** `file-deletion`
---
### 📝 Commits (1)
- [`f477f4f`](https://github.com/open-webui/open-webui/commit/f477f4f79015788a8f96d56ff365a900d7e902fb) fix: fixess issue #7181
### 📊 Changes
**5 files changed** (+34 additions, -15 deletions)
<details>
<summary>View changed files</summary>
📝 `backend/open_webui/routers/files.py` (+2 -0)
📝 `src/lib/components/chat/MessageInput.svelte` (+14 -3)
📝 `src/lib/components/common/FileItem.svelte` (+2 -0)
📝 `src/lib/components/workspace/Knowledge/KnowledgeBase.svelte` (+15 -11)
📝 `src/lib/components/workspace/Knowledge/KnowledgeBase/Files.svelte` (+1 -1)
</details>
### 📄 Description
# 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 following the format
- [x] **Code review:** Have you performed a self-review of your code
# Changelog Entry
Fix file deletion to properly clean up resources
### Description
When deleting files from either knowledge bases or chat, the system wasn't properly cleaning up all associated resources, particularly in the sqlite DB. This caused issues with re-uploading previously deleted files and left orphaned entries in the database and the uploads/ folder.
### Known issues
- There still are orphaned collections (file-UID) in Chroma when removing a file from the chat input. I don't like to add more coupling in routers/files.py with something like this in the `delete_file_by_id` function:
```python
file_collection = f"file-{id}"
if VECTOR_DB_CLIENT.has_collection(collection_name=file_collection):
VECTOR_DB_CLIENT.delete_collection(collection_name=file_collection)
```
So I added a comment there ( # We should add Chroma cleanup here) as a placeholder to remember that we should act here.
---
<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/8547
Author: @juananpe
Created: 1/14/2025
Status: ✅ Merged
Merged: 1/15/2025
Merged by: @tjbck
Base:
dev← Head:file-deletion📝 Commits (1)
f477f4ffix: fixess issue [PR #578] [MERGED] add missing OLLAMA_WEBUI_PORT override (#7181)📊 Changes
5 files changed (+34 additions, -15 deletions)
View changed files
📝
backend/open_webui/routers/files.py(+2 -0)📝
src/lib/components/chat/MessageInput.svelte(+14 -3)📝
src/lib/components/common/FileItem.svelte(+2 -0)📝
src/lib/components/workspace/Knowledge/KnowledgeBase.svelte(+15 -11)📝
src/lib/components/workspace/Knowledge/KnowledgeBase/Files.svelte(+1 -1)📄 Description
Pull Request Checklist
devbranch.Changelog Entry
Fix file deletion to properly clean up resources
Description
When deleting files from either knowledge bases or chat, the system wasn't properly cleaning up all associated resources, particularly in the sqlite DB. This caused issues with re-uploading previously deleted files and left orphaned entries in the database and the uploads/ folder.
Known issues
delete_file_by_idfunction:So I added a comment there ( # We should add Chroma cleanup here) as a placeholder to remember that we should act here.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.