[PR #25019] Feat/Bulk and selective log deletion #30891

Open
opened 2026-02-21 20:48:25 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/langgenius/dify/pull/25019

State: open
Merged: No


Summary

This PR implements comprehensive log clearing functionality for both chat and completion conversations. The implementation supports both bulk deletion (all logs) and selective deletion (specific conversation IDs).

Key Features:

  • Backend API endpoints for clearing chat/completion conversations
  • Frontend UI with "Clear All" and "Clear Selected" functionality
  • Multi-select checkboxes with confirmation dialogs

Technical Implementation:

  • Cascading deletion across database tables (conversations, messages, annotations, variables)
  • Background file cleanup with Celery tasks
  • Comprehensive localStorage clearing mechanism
  • SWR cache invalidation and cross-tab synchronization

Resolve #24626

Screenshots

Default shows "Clear All Logs" button only:

image

"Clear Selected" button shows when conversations are selected:

image

Confirmation dialog shows before execution:

image

Checklist

  • This change requires a documentation update, included: https://github.com/langgenius/dify-docs
  • I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!)
  • I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change.
  • I've updated the documentation accordingly.
  • I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods

Additional Notes

Files Modified:

  • api/controllers/console/app/conversation.py - New DELETE endpoints
  • api/tasks/clean_uploaded_files_task.py - Background file cleanup task
  • web/app/components/app/log/filter.tsx - Clear buttons and confirmations
  • web/app/components/app/log/list.tsx - Multi-select functionality
  • web/app/components/app/log/index.tsx - Selection state management
  • web/service/log.ts - Enhanced clearing with 404 prevention
  • web/app/components/base/chat/chat-with-history/hooks.tsx - Error handling

Testing Completed:

  • Bulk deletion flow with explore page navigation
  • Selective deletion with remaining conversation accessibility
  • Error recovery scenarios (cross-tab conversation deletion)
  • localStorage synchronization across browser tabs
**Original Pull Request:** https://github.com/langgenius/dify/pull/25019 **State:** open **Merged:** No --- ## Summary This PR implements comprehensive log clearing functionality for both chat and completion conversations. The implementation supports both bulk deletion (all logs) and selective deletion (specific conversation IDs). ## Key Features: - Backend API endpoints for clearing chat/completion conversations - Frontend UI with "Clear All" and "Clear Selected" functionality - Multi-select checkboxes with confirmation dialogs ## Technical Implementation: - Cascading deletion across database tables (conversations, messages, annotations, variables) - Background file cleanup with Celery tasks - Comprehensive localStorage clearing mechanism - SWR cache invalidation and cross-tab synchronization Resolve #24626 ## Screenshots ### Default shows "Clear All Logs" button only: <img width="1105" height="266" alt="image" src="https://github.com/user-attachments/assets/72acb942-f070-45d6-82bf-3133449e457c" /> ### "Clear Selected" button shows when conversations are selected: <img width="1100" height="259" alt="image" src="https://github.com/user-attachments/assets/50ba40ae-b492-4a2b-97fa-0487e2989f91" /> ### Confirmation dialog shows before execution: <img width="528" height="219" alt="image" src="https://github.com/user-attachments/assets/4e2f0da7-9a39-4462-9f3c-a105098e878d" /> ## Checklist - [ ] This change requires a documentation update, included: https://github.com/langgenius/dify-docs - [x] I understand that this PR may be closed in case there was no previous discussion or issues. (This doesn't apply to typos!) - [x] I've added a test for each change that was introduced, and I tried as much as possible to make a single atomic change. - [ ] I've updated the documentation accordingly. - [x] I ran dev/reformat(backend) and cd web && npx lint-staged(frontend) to appease the lint gods ## Additional Notes ### Files Modified: - api/controllers/console/app/conversation.py - New DELETE endpoints - api/tasks/clean_uploaded_files_task.py - Background file cleanup task - web/app/components/app/log/filter.tsx - Clear buttons and confirmations - web/app/components/app/log/list.tsx - Multi-select functionality - web/app/components/app/log/index.tsx - Selection state management - web/service/log.ts - Enhanced clearing with 404 prevention - web/app/components/base/chat/chat-with-history/hooks.tsx - Error handling ### Testing Completed: - Bulk deletion flow with explore page navigation - Selective deletion with remaining conversation accessibility - Error recovery scenarios (cross-tab conversation deletion) - localStorage synchronization across browser tabs
yindo added the pull-request label 2026-02-21 20:48:25 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#30891