- Added primary_keyword, secondary_keywords, tags, and categories fields to Tasks model - Updated generate_content function to handle full JSON response with all SEO fields - Improved progress bar animation: smooth 1% increments every 300ms - Enhanced step detection for content generation vs clustering vs ideas - Fixed progress modal to show correct messages for each function type - Added comprehensive logging to Keywords and Tasks pages for AI functions - Fixed error handling to show meaningful error messages instead of generic failures
272 lines
8.6 KiB
Markdown
272 lines
8.6 KiB
Markdown
# AI Function Related Files
|
|
|
|
This document lists all files containing code related to:
|
|
- Auto Cluster Keywords
|
|
- Auto Generate Ideas
|
|
- Auto Generate Content
|
|
- Auto Generate Images
|
|
|
|
---
|
|
|
|
## Backend Files
|
|
|
|
### Auto Cluster Keywords
|
|
|
|
#### Core Implementation
|
|
- `backend/igny8_core/ai/functions/auto_cluster.py` - **Main AI function implementation** (BaseAIFunction)
|
|
- `backend/igny8_core/ai/base.py` - Base AI function class
|
|
- `backend/igny8_core/ai/engine.py` - AI engine orchestrator
|
|
- `backend/igny8_core/ai/processor.py` - AI processor wrapper
|
|
- `backend/igny8_core/ai/tasks.py` - Unified Celery task entrypoint
|
|
- `backend/igny8_core/ai/registry.py` - Function registry
|
|
- `backend/igny8_core/ai/tracker.py` - Progress and cost tracking
|
|
|
|
#### API Endpoints & Views
|
|
- `backend/igny8_core/modules/planner/views.py` - **KeywordViewSet.auto_cluster()** action
|
|
- `backend/igny8_core/modules/planner/urls.py` - URL routing
|
|
|
|
#### Celery Tasks (Legacy/Alternative)
|
|
- `backend/igny8_core/modules/planner/tasks.py` - **auto_cluster_keywords_task()** (legacy implementation)
|
|
|
|
#### AI Processor
|
|
- `backend/igny8_core/utils/ai_processor.py` - **AIProcessor.cluster_keywords()** method
|
|
|
|
#### Models
|
|
- `backend/igny8_core/modules/planner/models.py` - Keywords, Clusters models
|
|
|
|
#### Serializers
|
|
- `backend/igny8_core/modules/planner/serializers.py` - Keyword, Cluster serializers
|
|
- `backend/igny8_core/modules/planner/cluster_serializers.py` - Cluster-specific serializers
|
|
|
|
#### System Integration
|
|
- `backend/igny8_core/modules/system/schemas.py` - Schema definitions
|
|
- `backend/igny8_core/modules/system/utils.py` - Prompt loading utilities
|
|
|
|
---
|
|
|
|
### Auto Generate Ideas
|
|
|
|
#### Core Implementation
|
|
- `backend/igny8_core/utils/ai_processor.py` - **AIProcessor.generate_ideas()** method
|
|
|
|
#### API Endpoints & Views
|
|
- `backend/igny8_core/modules/planner/views.py` - **ClusterViewSet.auto_generate_ideas()** action
|
|
- `backend/igny8_core/modules/planner/urls.py` - URL routing
|
|
|
|
#### Celery Tasks
|
|
- `backend/igny8_core/modules/planner/tasks.py` - **auto_generate_ideas_task()** and **generate_single_idea_core()**
|
|
|
|
#### Models
|
|
- `backend/igny8_core/modules/planner/models.py` - Clusters, ContentIdeas models
|
|
|
|
#### Serializers
|
|
- `backend/igny8_core/modules/planner/serializers.py` - Cluster, ContentIdeas serializers
|
|
|
|
#### System Integration
|
|
- `backend/igny8_core/modules/system/utils.py` - Prompt loading utilities
|
|
|
|
---
|
|
|
|
### Auto Generate Content
|
|
|
|
#### Core Implementation
|
|
- `backend/igny8_core/utils/ai_processor.py` - **AIProcessor.generate_content()** method
|
|
|
|
#### API Endpoints & Views
|
|
- `backend/igny8_core/modules/writer/views.py` - **TasksViewSet.auto_generate_content()** action
|
|
- `backend/igny8_core/modules/writer/urls.py` - URL routing
|
|
|
|
#### Celery Tasks
|
|
- `backend/igny8_core/modules/writer/tasks.py` - **auto_generate_content_task()**
|
|
|
|
#### Models
|
|
- `backend/igny8_core/modules/writer/models.py` - Tasks, Content models
|
|
|
|
#### Serializers
|
|
- `backend/igny8_core/modules/writer/serializers.py` - Task, Content serializers
|
|
|
|
#### System Integration
|
|
- `backend/igny8_core/modules/system/schemas.py` - Schema definitions
|
|
- `backend/igny8_core/modules/system/utils.py` - Prompt loading utilities
|
|
|
|
---
|
|
|
|
### Auto Generate Images
|
|
|
|
#### Core Implementation
|
|
- `backend/igny8_core/utils/ai_processor.py` - **AIProcessor.extract_image_prompts()** and **AIProcessor.generate_image()** methods
|
|
|
|
#### API Endpoints & Views
|
|
- `backend/igny8_core/modules/writer/views.py` - **TasksViewSet.auto_generate_images()** action
|
|
- `backend/igny8_core/modules/writer/urls.py` - URL routing
|
|
|
|
#### Celery Tasks
|
|
- `backend/igny8_core/modules/writer/tasks.py` - **auto_generate_images_task()**
|
|
|
|
#### Models
|
|
- `backend/igny8_core/modules/writer/models.py` - Tasks, Images models
|
|
|
|
#### Serializers
|
|
- `backend/igny8_core/modules/writer/serializers.py` - Task, Images serializers
|
|
|
|
#### System Integration
|
|
- `backend/igny8_core/modules/system/schemas.py` - Schema definitions
|
|
- `backend/igny8_core/modules/system/integration_views.py` - Integration settings for image generation
|
|
|
|
---
|
|
|
|
## Frontend Files
|
|
|
|
### Auto Cluster Keywords
|
|
|
|
#### Pages
|
|
- `frontend/src/pages/Planner/Keywords.tsx` - **Main page component** with auto cluster functionality
|
|
|
|
#### API Services
|
|
- `frontend/src/services/api.ts` - **autoClusterKeywords()** function
|
|
|
|
#### Configuration
|
|
- `frontend/src/config/pages/keywords.config.tsx` - Page configuration
|
|
- `frontend/src/config/pages/table-actions.config.tsx` - Action button configurations
|
|
|
|
#### State Management
|
|
- `frontend/src/store/aiRequestLogsStore.ts` - AI request/response logs store
|
|
|
|
#### Hooks
|
|
- `frontend/src/hooks/useProgressModal.ts` - Progress modal hook for tracking task progress
|
|
|
|
---
|
|
|
|
### Auto Generate Ideas
|
|
|
|
#### Pages
|
|
- `frontend/src/pages/Planner/Clusters.tsx` - **Main page component** with auto generate ideas functionality
|
|
|
|
#### API Services
|
|
- `frontend/src/services/api.ts` - **autoGenerateIdeas()** function
|
|
|
|
#### Configuration
|
|
- `frontend/src/config/pages/clusters.config.tsx` - Page configuration
|
|
- `frontend/src/config/pages/table-actions.config.tsx` - Action button configurations
|
|
|
|
#### State Management
|
|
- `frontend/src/store/aiRequestLogsStore.ts` - AI request/response logs store
|
|
|
|
#### Hooks
|
|
- `frontend/src/hooks/useProgressModal.ts` - Progress modal hook for tracking task progress
|
|
|
|
---
|
|
|
|
### Auto Generate Content
|
|
|
|
#### Pages
|
|
- `frontend/src/pages/Writer/Tasks.tsx` - **Main page component** with auto generate content functionality
|
|
|
|
#### API Services
|
|
- `frontend/src/services/api.ts` - **autoGenerateContent()** function
|
|
|
|
#### Configuration
|
|
- `frontend/src/config/pages/tasks.config.tsx` - Page configuration
|
|
- `frontend/src/config/pages/table-actions.config.tsx` - Action button configurations
|
|
|
|
#### State Management
|
|
- `frontend/src/store/aiRequestLogsStore.ts` - AI request/response logs store
|
|
|
|
#### Hooks
|
|
- `frontend/src/hooks/useProgressModal.ts` - Progress modal hook for tracking task progress
|
|
|
|
---
|
|
|
|
### Auto Generate Images
|
|
|
|
#### Pages
|
|
- `frontend/src/pages/Writer/Tasks.tsx` - **Main page component** with auto generate images functionality
|
|
|
|
#### API Services
|
|
- `frontend/src/services/api.ts` - **autoGenerateImages()** function
|
|
|
|
#### Configuration
|
|
- `frontend/src/config/pages/tasks.config.tsx` - Page configuration
|
|
- `frontend/src/config/pages/images.config.tsx` - Image-related configuration
|
|
- `frontend/src/config/pages/table-actions.config.tsx` - Action button configurations
|
|
|
|
#### State Management
|
|
- `frontend/src/store/aiRequestLogsStore.ts` - AI request/response logs store
|
|
|
|
#### Hooks
|
|
- `frontend/src/hooks/useProgressModal.ts` - Progress modal hook for tracking task progress
|
|
|
|
---
|
|
|
|
## Shared/Common Files
|
|
|
|
### AI Framework (Backend)
|
|
- `backend/igny8_core/ai/__init__.py` - AI module initialization and auto-registration
|
|
- `backend/igny8_core/ai/models.py` - AITaskLog model for unified logging
|
|
- `backend/igny8_core/ai/types.py` - Shared dataclasses and types
|
|
- `backend/igny8_core/ai/admin.py` - Admin interface for AITaskLog
|
|
|
|
### Progress Tracking (Backend)
|
|
- `backend/igny8_core/modules/system/integration_views.py` - **task_progress()** endpoint
|
|
|
|
### Progress Tracking (Frontend)
|
|
- `frontend/src/components/common/ProgressModal.tsx` - Progress modal component
|
|
- `frontend/src/hooks/useProgressModal.ts` - Progress modal hook
|
|
|
|
### Common Components (Frontend)
|
|
- `frontend/src/components/common/FormModal.tsx` - Form modal used in AI function pages
|
|
|
|
---
|
|
|
|
## Summary by Function
|
|
|
|
### Auto Cluster Keywords
|
|
**Backend**: 15 files
|
|
**Frontend**: 5 files
|
|
**Total**: 20 files
|
|
|
|
### Auto Generate Ideas
|
|
**Backend**: 7 files
|
|
**Frontend**: 5 files
|
|
**Total**: 12 files
|
|
|
|
### Auto Generate Content
|
|
**Backend**: 7 files
|
|
**Frontend**: 5 files
|
|
**Total**: 12 files
|
|
|
|
### Auto Generate Images
|
|
**Backend**: 7 files
|
|
**Frontend**: 5 files
|
|
**Total**: 12 files
|
|
|
|
### Shared/Common
|
|
**Backend**: 4 files
|
|
**Frontend**: 3 files
|
|
**Total**: 7 files
|
|
|
|
---
|
|
|
|
## Key Files (Most Important)
|
|
|
|
### Backend Core Files
|
|
1. `backend/igny8_core/ai/functions/auto_cluster.py` - Auto cluster AI function
|
|
2. `backend/igny8_core/utils/ai_processor.py` - Unified AI processor (all functions)
|
|
3. `backend/igny8_core/modules/planner/views.py` - Auto cluster & ideas API endpoints
|
|
4. `backend/igny8_core/modules/writer/views.py` - Content & images API endpoints
|
|
5. `backend/igny8_core/modules/planner/tasks.py` - Planner Celery tasks
|
|
6. `backend/igny8_core/modules/writer/tasks.py` - Writer Celery tasks
|
|
7. `backend/igny8_core/ai/tasks.py` - Unified AI task entrypoint
|
|
|
|
### Frontend Core Files
|
|
1. `frontend/src/pages/Planner/Keywords.tsx` - Auto cluster UI
|
|
2. `frontend/src/pages/Planner/Clusters.tsx` - Auto generate ideas UI
|
|
3. `frontend/src/pages/Writer/Tasks.tsx` - Content & images generation UI
|
|
4. `frontend/src/services/api.ts` - All API functions
|
|
5. `frontend/src/hooks/useProgressModal.ts` - Progress tracking hook
|
|
|
|
---
|
|
|
|
**Last Updated**: 2025-01-XX
|
|
|