fix delete conversations via Api and delete conversations from db as well#23591
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR fixes the conversation deletion functionality by implementing proper database cleanup when conversations are deleted via the API. Previously, conversations were only marked as deleted without removing related data or entries from the database.
- Replaces soft deletion with hard deletion for conversations and all related entities
- Adds a new method
get_conversation_for_deletionto handle deletion-specific conversation retrieval - Updates console controllers to use the centralized conversation service for deletion operations
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| api/services/conversation_service.py | Implements hard deletion of conversations with cascade deletion of related entities and adds deletion-specific conversation retrieval |
| api/controllers/console/app/conversation.py | Updates both completion and chat conversation controllers to use centralized deletion service and filters out deleted conversations from listings |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@jubinsoni Sorry, try to fix this, but it failed :) Please resolve it again thanks :) |
|
@crazywoola so to fix that I have unwrapped the for loop also I have closed the session in the finally block so that connection goes back to connection pool |
…well (langgenius#23591) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…well (langgenius#23591) Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> Co-authored-by: crazywoola <427733928@qq.com> Co-authored-by: crazywoola <100913391+crazywoola@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> (cherry picked from commit 3aedc13)
|
我在这里有个疑问?为什么要将软删除改为硬删除?软删除不应该是一个应用通用的标准么? |

Important
Fixes #<issue number>.Summary
Fix #22868
close #22445
Screenshots
before
eventough we have deleted conversation, it still used to show in log pages and entry is also there in db
after



if we delete conversation, it will not show in log page and entry in db will also be deleted
Checklist
dev/reformat(backend) andcd web && npx lint-staged(frontend) to appease the lint gods