This commit is contained in:
IGNY8 VPS (Salman)
2026-01-01 01:54:54 +00:00
parent 0d3e25e50f
commit af408d0747
5 changed files with 387 additions and 17 deletions

View File

@@ -1,6 +1,7 @@
# Automation Module
**Last Verified:** December 25, 2025
**Last Verified:** January 1, 2026
**Version:** 1.3.0
**Status:** ✅ Active
**Backend Path:** `backend/igny8_core/business/automation/`
**Frontend Path:** `frontend/src/pages/Automation/`
@@ -16,6 +17,8 @@
| Logger | `business/automation/services/automation_logger.py` | `AutomationLogger` |
| Celery Tasks | `business/automation/tasks.py` | `run_automation_task`, `check_scheduled_automations` |
| Frontend | `pages/Automation/AutomationPage.tsx` | Main automation UI |
| Progress Bar | `components/Automation/GlobalProgressBar.tsx` | Full pipeline progress |
| Processing Card | `components/Automation/CurrentProcessingCard.tsx` | Real-time progress |
---
@@ -24,7 +27,7 @@
The Automation module runs the complete 7-stage content pipeline automatically:
```
Keywords → Clusters → Ideas → Tasks → Content → Image Prompts → Images → Review
Keywords → Clusters → Ideas → Tasks → Content → Image Prompts → Images → Published
```
---
@@ -39,7 +42,9 @@ Keywords → Clusters → Ideas → Tasks → Content → Image Prompts → Imag
| 4 | Tasks → Content | `GenerateContentFunction` | Per 100 words |
| 5 | Content → Image Prompts | `GenerateImagePromptsFunction` | Per prompt |
| 6 | Image Prompts → Images | `process_image_generation_queue` | Per image |
| 7 | Manual Review Gate | None | None |
| 7 | Review → Published | None (auto-approve) | None |
**Note:** Stage 7 changed from "Manual Review Gate" to auto-approve and publish in v1.3.0.
---
@@ -79,6 +84,7 @@ Keywords → Clusters → Ideas → Tasks → Content → Image Prompts → Imag
| cancelled_at | DateTime | Cancel time (nullable) |
| completed_at | DateTime | Completion time (nullable) |
| total_credits_used | Decimal | Total credits consumed |
| **initial_snapshot** | JSON | **v1.3.0** Queue sizes at run start |
| stage_1_result | JSON | Stage 1 results |
| stage_2_result | JSON | Stage 2 results |
| stage_3_result | JSON | Stage 3 results |
@@ -100,6 +106,7 @@ Keywords → Clusters → Ideas → Tasks → Content → Image Prompts → Imag
| GET | `/api/v1/automation/current_run/` | Get current run | Run status/progress |
| GET | `/api/v1/automation/pipeline_overview/` | Get pipeline | Stage status counts |
| GET | `/api/v1/automation/current_processing/` | Get processing | Live processing status |
| **GET** | `/api/v1/automation/run_progress/` | **v1.3.0** | Unified progress data |
| POST | `/api/v1/automation/pause/` | Pause run | Pause after current item |
| POST | `/api/v1/automation/resume/` | Resume run | Resume from saved stage |
| POST | `/api/v1/automation/cancel/` | Cancel run | Cancel after current item |
@@ -109,6 +116,22 @@ Keywords → Clusters → Ideas → Tasks → Content → Image Prompts → Imag
**Query Parameters:** All require `?site_id=`, run-specific require `?run_id=`
### run_progress Endpoint (v1.3.0)
Returns unified progress data for frontend:
```json
{
"run": { "run_id": "...", "status": "running", "current_stage": 3 },
"global_progress": { "total_items": 100, "completed_items": 45, "percentage": 45 },
"stages": [
{ "number": 1, "status": "completed", "input_count": 50, "processed_count": 50 },
...
],
"metrics": { "credits_used": 120, "duration_seconds": 3600 },
"initial_snapshot": { "stage_1_initial": 50, ... }
}
```
---
## Execution Flow
@@ -118,10 +141,11 @@ Keywords → Clusters → Ideas → Tasks → Content → Image Prompts → Imag
1. User clicks "Run Now" on frontend
2. Frontend calls `POST /automation/run_now/?site_id=X`
3. Backend acquires cache lock `automation_lock_{site_id}`
4. Estimates credits required (1.2x buffer)
5. Validates balance >= estimate
6. Creates `AutomationRun` record
7. Enqueues `run_automation_task` Celery task
4. **v1.3.0:** Captures initial snapshot with `_capture_initial_snapshot()`
5. Estimates credits required (1.2x buffer)
6. Validates balance >= estimate
7. Creates `AutomationRun` record
8. Enqueues `run_automation_task` Celery task
8. Returns run ID immediately
### Stage Execution