- Created AIStatus data model with TypeScript interfaces
- Implemented AIStatusService with polling mechanism
- Created AIStatusIndicatorComponent with icon, tooltip, and animations
- Added component to navbar between notifications and user menu
- Includes unit tests for service and component
- Shows AI active/inactive state with visual indicators
- Displays statistics: documents scanned, suggestions applied
- Shows pending deletion requests with badge
- Processing animation when AI is active
- Link to AI configuration settings
- Non-intrusive design following existing patterns
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
- Backend API:
- Added DeletionRequestSerializer and DeletionRequestActionSerializer
- Added DeletionRequestViewSet with approve/reject/pending_count actions
- Added /api/deletion_requests/ route
- Frontend:
- Created deletion-request data model
- Created deletion-request.service.ts with full CRUD operations
- Created DeletionRequestsComponent with status filtering (pending/approved/rejected/completed)
- Created DeletionRequestDetailComponent with impact analysis display
- Added /deletion-requests route with permissions guard
- Implemented approve/reject modals with confirmation
- Added status badges and pending request counter
- All code linted and built successfully
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
Added comprehensive documentation in administration.md including:
- Command syntax and all available options
- Usage examples for different scenarios
- Explanation of confidence levels
- Performance considerations for large document sets
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
- Fixed blank line whitespace issues
- Changed logger.error with exc_info=True to logger.exception
- Prefixed unused unpacked variables with underscore
- Applied ruff formatting to both command and test files
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
Resolved merge conflicts in:
- src/documents/ai_deletion_manager.py: Kept webhook integration alongside dev changes
- src/documents/ai_scanner.py: Kept webhook integration and applied_fields tracking
- src/documents/models.py: Integrated AISuggestionFeedback model with webhook imports
All conflicts resolved maintaining both webhook functionality and new AI suggestions features from dev branch.
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
- Created serializers for AI suggestions (AISuggestionsSerializer, ApplySuggestionSerializer, etc.)
- Added AISuggestionFeedback model for tracking applied/rejected suggestions
- Implemented 4 new API endpoints:
- GET /api/documents/{id}/ai-suggestions/ - Get AI suggestions for a document
- POST /api/documents/{id}/apply-suggestion/ - Apply a suggestion and record feedback
- POST /api/documents/{id}/reject-suggestion/ - Reject a suggestion and record feedback
- GET /api/documents/ai-suggestion-stats/ - Get accuracy statistics
- Created database migration for AISuggestionFeedback model
- Added comprehensive test suite (28 test cases) covering all endpoints
- Supports tracking for tags, correspondents, document types, storage paths, titles
- Calculates accuracy rates and confidence scores for AI improvement
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
Created comprehensive documentation for migration 1076 including:
- Overview and migration details
- Complete field descriptions
- How to apply and rollback
- Testing instructions
- Performance and security considerations
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
Created migration 1076_add_deletion_request.py to add the DeletionRequest model
to the database schema. This model tracks AI-initiated deletion requests that
require explicit user approval before any documents are deleted.
Migration includes:
- All model fields (created_at, updated_at, requested_by_ai, ai_reason, status, etc.)
- ManyToMany relationship with Document model
- Foreign keys to User model (user and reviewed_by)
- Custom indexes for common query patterns (status+user, created_at)
- Proper ordering and metadata
Fixes#10
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
- Move all imports to module level (removed from inside methods)
- Add missing `status` import from rest_framework
- Fix docstring formatting to comply with PEP 257
- Add explanatory comments to empty except clauses
- Improve error message for document not found
- Add warning comment about thread-safety in config update
- Add TODO comments for storing approval/rejection reasons
- Remove unused StoragePath import from tests
- Remove duplicate permission imports at end of file
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
- Add PAPERLESS_ENABLE_AI_SCANNER check in consumer._run_ai_scanner() method
- Move AIScanResult import to top of test file to follow DRY principle
- Create helper methods: create_empty_scan_result_mock() and get_test_file_with_name()
- Reduce code duplication by using helper methods across all tests
- Improve performance test threshold from 10s to 1s for mocked operations
- Add TODO comment for proper performance testing with real ML models
- Remove duplicate 'from documents.ai_scanner import AIScanResult' imports from 7 test methods
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>
- Add composite index (user, status, created_at) for listing queries
- Add index for reviewed_at field for filtering reviewed requests
- Add index for completed_at field for filtering completed requests
- Create migration 1076_add_deletionrequest_performance_indexes
- Expected improvement: list queries <100ms, filter queries <50ms
Addresses: [AI Scanner] Índices de Performance para DeletionRequest
Epic: Migraciones de Base de Datos
Co-authored-by: dawnsystem <42047891+dawnsystem@users.noreply.github.com>