[GH-ISSUE #12279] feat: OPTIONAL deletion of files and db entries on chat deletion #103525

Closed
opened 2026-05-18 00:59:53 -05:00 by GiteaMirror · 0 comments
Owner

Originally created by @mahenning on GitHub (Apr 1, 2025).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/12279

Check Existing Issues

  • I have searched the existing issues and discussions.

Problem Description

I wanted to ask if there is interest in the feature named in the title.

I am aware this issue was already discussed and answered by the maintainer in https://github.com/open-webui/open-webui/issues/7181#issuecomment-2492633499! And possibly in some other issues too.

But personally, it goes completely against how I want Open-WebUI to work. I don't want files to be stored indefinetly on the server. I also don't want the vector db to slowly creep up in size, as there are old vectors in it which are never used again. For instance, a user uploads a document in the chat, asks some questions about it and then deletes the chat. Now I have the unused document on the file system, the Files entry in the sqlite db, and the chunk vectors in the vector db. All that while the user will not (and can not) address this file/the vectors ever again. If they upload the same file again, a new file entry is created, essentially doubling the space already.

If there is a safe and easy way to see which files are not used in chats/knowledge databases anymore and remove the file, sqlite db entry and associated vectors, it would be a bandaid. It seems at least knowledge databases clean up after themselves, at least in the databases.

Desired Solution you'd like

If desired, I could work on a PR that has the following goals:

  • if a chat is deleted, it should trigger the deletion of files that were uploaded in that chat, their FilesTable (sqlite) entries and vector db entries
  • this should not trigger if a chat is only archived
  • if a knowledge base is deleted, delete the files too (currently only the sqlite/vector db entries are deleted)
  • In the admin settings, there would be a toggle to adtivate this feature (default: deactivated), so this feature would be completely optional and the default behaviour would not change
  • (optional) to save storage, there could be a check on upload with hashes if that file was already uploaded. If yes, skip process of saving the content (again) and link to that file/db entries. This would make the delete logic more complicated. Theere has to be a check if the file is used somewhere else.
    • this is only handy if the same files are linked a lot in the different knowledge bases or uploaded a lot in chats that are not deleted

If there is a definetive "no" to this feature, I don't have to start working on it, so feedback would be great.

Originally created by @mahenning on GitHub (Apr 1, 2025). Original GitHub issue: https://github.com/open-webui/open-webui/issues/12279 ### Check Existing Issues - [x] I have searched the existing issues and discussions. ### Problem Description I wanted to ask if there is interest in the feature named in the title. I am aware this issue was already discussed and answered by the maintainer in https://github.com/open-webui/open-webui/issues/7181#issuecomment-2492633499! And possibly in some other issues too. But personally, it goes completely against how I want `Open-WebUI` to work. I don't want files to be stored indefinetly on the server. I also don't want the vector db to slowly creep up in size, as there are old vectors in it which are never used again. For instance, a user uploads a document in the chat, asks some questions about it and then deletes the chat. Now I have the unused document on the file system, the `Files` entry in the sqlite db, and the chunk vectors in the vector db. All that while the user will not (and can not) address this file/the vectors ever again. If they upload the same file again, a new file entry is created, essentially doubling the space already. If there is a safe and easy way to see which files are not used in chats/knowledge databases anymore and remove the file, sqlite db entry and associated vectors, it would be a bandaid. It seems at least knowledge databases clean up after themselves, at least in the databases. ### Desired Solution you'd like If desired, I could work on a PR that has the following goals: - if a chat is deleted, it should trigger the deletion of files that were uploaded in that chat, their `FilesTable` (sqlite) entries and vector db entries - this should not trigger if a chat is only archived - if a knowledge base is deleted, delete the files too (currently only the sqlite/vector db entries are deleted) - In the admin settings, there would be a toggle to adtivate this feature (default: deactivated), so this feature would be completely optional and the default behaviour would not change - (optional) to save storage, there could be a check on upload with hashes if that file was already uploaded. If yes, skip process of saving the content (again) and link to that file/db entries. This would make the delete logic more complicated. Theere has to be a check if the file is used somewhere else. - this is only handy if the same files are linked a lot in the different knowledge bases or uploaded a lot in chats that are not deleted If there is a definetive "no" to this feature, I don't have to start working on it, so feedback would be great.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#103525