|
|
|
|
@@ -1,7 +1,7 @@
|
|
|
|
|
# Automation Module
|
|
|
|
|
|
|
|
|
|
**Last Verified:** January 17, 2026
|
|
|
|
|
**Version:** 1.8.0
|
|
|
|
|
**Last Verified:** January 18, 2026
|
|
|
|
|
**Version:** 1.8.1
|
|
|
|
|
**Status:** ✅ Active
|
|
|
|
|
**Backend Path:** `backend/igny8_core/business/automation/`
|
|
|
|
|
**Frontend Path:** `frontend/src/pages/Automation/`
|
|
|
|
|
@@ -12,18 +12,20 @@
|
|
|
|
|
|
|
|
|
|
| What | File | Key Items |
|
|
|
|
|
|------|------|-----------|
|
|
|
|
|
| Models | `business/automation/models.py` | `AutomationConfig`, `AutomationRun` |
|
|
|
|
|
| Models | `business/automation/models.py` | `AutomationConfig`, `AutomationRun`, `DefaultAutomationConfig` |
|
|
|
|
|
| Service | `business/automation/services/automation_service.py` | `AutomationService` |
|
|
|
|
|
| Logger | `business/automation/services/automation_logger.py` | `AutomationLogger` |
|
|
|
|
|
| Celery Tasks | `business/automation/tasks.py` | `run_automation_task`, `check_scheduled_automations` |
|
|
|
|
|
| Celery Tasks | `business/automation/tasks.py` | `run_automation_task`, `check_scheduled_automations`, `check_test_triggers` |
|
|
|
|
|
| Publishing Tasks | `igny8_core/tasks/publishing_scheduler.py` | Scheduled publishing |
|
|
|
|
|
| **Unified Settings** | `modules/integration/views/unified_settings.py` | **v1.8.0** Consolidated settings API |
|
|
|
|
|
| **Unified Settings** | `api/unified_settings.py` | **v1.8.0** Consolidated settings API |
|
|
|
|
|
| **Default Settings API** | `api/unified_settings.py` | **v1.8.1** `DefaultSettingsAPIView` for reset |
|
|
|
|
|
| Frontend Overview | `pages/Automation/AutomationOverview.tsx` | **v1.8.0** Run history dashboard |
|
|
|
|
|
| Frontend Run Detail | `pages/Automation/AutomationRunDetail.tsx` | **v1.8.0** Detailed run view |
|
|
|
|
|
| Frontend Manual Run | `pages/Automation/AutomationPage.tsx` | Manual run UI |
|
|
|
|
|
| **Site Settings** | `pages/Sites/AIAutomationSettings.tsx` | **v1.8.0** Unified settings UI |
|
|
|
|
|
| Progress Bar | `components/Automation/GlobalProgressBar.tsx` | Full pipeline progress |
|
|
|
|
|
| Processing Card | `components/Automation/CurrentProcessingCard.tsx` | Real-time progress |
|
|
|
|
|
| **Scheduling Doc** | `docs/40-WORKFLOWS/AUTOMATION-AND-PUBLISHING-SCHEDULING.md` | **v1.8.1** Complete scheduling guide |
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
@@ -35,7 +37,26 @@ The Automation module runs the complete 7-stage content pipeline automatically:
|
|
|
|
|
Keywords → Clusters → Ideas → Tasks → Content → Image Prompts → Images → Published
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
**Settings Location (v1.8.0):** Site Settings → Automation tab
|
|
|
|
|
**Settings Location (v1.8.0+):** Site Settings → Automation tab
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
## Scheduling (v1.8.1)
|
|
|
|
|
|
|
|
|
|
| Task | Schedule | Purpose |
|
|
|
|
|
|------|----------|---------|
|
|
|
|
|
| `check_scheduled_automations` | Every hour at `:05` | Check if automations should run |
|
|
|
|
|
| `check_test_triggers` | Every minute | Check for admin test triggers |
|
|
|
|
|
|
|
|
|
|
**How it works:**
|
|
|
|
|
- Users select hour (12-hour AM/PM format), stored as `HH:00` (24-hour)
|
|
|
|
|
- Celery compares `scheduled_hour == current_hour`
|
|
|
|
|
- 23-hour block prevents re-runs within same day
|
|
|
|
|
|
|
|
|
|
**Test Mode (Admin):**
|
|
|
|
|
- `test_mode_enabled` + `test_trigger_at` fields on `AutomationConfig`
|
|
|
|
|
- Allows immediate triggering without waiting for schedule
|
|
|
|
|
- Bypasses 23-hour blocking
|
|
|
|
|
|
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
@@ -79,6 +100,8 @@ Keywords → Clusters → Ideas → Tasks → Content → Image Prompts → Imag
|
|
|
|
|
| **stage_5_enabled** | Boolean | **v1.8.0** Enable stage 5 |
|
|
|
|
|
| **stage_6_enabled** | Boolean | **v1.8.0** Enable stage 6 |
|
|
|
|
|
| **stage_7_enabled** | Boolean | **v1.8.0** Enable stage 7 |
|
|
|
|
|
| **stage_X_use_testing** | Boolean | **v1.8.1** Use testing model (AI stages 1,2,4,5,6) |
|
|
|
|
|
| **stage_X_budget_pct** | Integer | **v1.8.1** Credit budget % (AI stages) |
|
|
|
|
|
| **max_keywords_per_run** | Integer | **v1.8.0** Per-run limit stage 1 |
|
|
|
|
|
| **max_clusters_per_run** | Integer | **v1.8.0** Per-run limit stage 2 |
|
|
|
|
|
| **max_ideas_per_run** | Integer | **v1.8.0** Per-run limit stage 3 |
|
|
|
|
|
@@ -89,6 +112,27 @@ Keywords → Clusters → Ideas → Tasks → Content → Image Prompts → Imag
|
|
|
|
|
| between_stage_delay | Integer | Seconds between stages |
|
|
|
|
|
| last_run_at | DateTime | Last execution |
|
|
|
|
|
| next_run_at | DateTime | Next scheduled run |
|
|
|
|
|
| **test_mode_enabled** | Boolean | **v1.8.1** Enable test mode for admin |
|
|
|
|
|
| **test_trigger_at** | DateTime | **v1.8.1** When to trigger test run |
|
|
|
|
|
|
|
|
|
|
### DefaultAutomationConfig (v1.8.1)
|
|
|
|
|
|
|
|
|
|
Singleton model for centralized default settings. See [AUTOMATION-AND-PUBLISHING-SCHEDULING.md](../40-WORKFLOWS/AUTOMATION-AND-PUBLISHING-SCHEDULING.md) for full schema.
|
|
|
|
|
|
|
|
|
|
| Field | Type | Purpose |
|
|
|
|
|
|-------|------|---------|
|
|
|
|
|
| is_enabled | Boolean | Default: Enable scheduled automation |
|
|
|
|
|
| frequency | CharField | Default frequency (daily/weekly/monthly) |
|
|
|
|
|
| next_scheduled_hour | Integer | Next hour to assign (auto-increments) |
|
|
|
|
|
| stage_X_enabled | Boolean | Default: Enable each stage |
|
|
|
|
|
| stage_X_batch_size | Integer | Default: Batch size per stage |
|
|
|
|
|
| stage_X_use_testing | Boolean | Default: Use testing model |
|
|
|
|
|
| stage_X_budget_pct | Integer | Default: Credit budget % |
|
|
|
|
|
| max_X_per_run | Integer | Default: Per-run limits |
|
|
|
|
|
| auto_approval_enabled | Boolean | Default: Auto-approve content |
|
|
|
|
|
| auto_publish_enabled | Boolean | Default: Auto-publish content |
|
|
|
|
|
| publish_days | JSONField | Default: Days to publish |
|
|
|
|
|
| publish_time_slots | JSONField | Default: Time slots to publish |
|
|
|
|
|
|
|
|
|
|
### AutomationRun
|
|
|
|
|
|
|
|
|
|
@@ -133,9 +177,31 @@ Keywords → Clusters → Ideas → Tasks → Content → Image Prompts → Imag
|
|
|
|
|
| GET | `/api/v1/automation/history/` | Get history | Last 20 runs |
|
|
|
|
|
| GET | `/api/v1/automation/logs/` | Get logs | Activity log for run |
|
|
|
|
|
| GET | `/api/v1/automation/estimate/` | Get estimate | Credit estimate |
|
|
|
|
|
| **GET** | `/api/v1/integration/settings/defaults/` | **v1.8.1** | Get default settings for reset |
|
|
|
|
|
|
|
|
|
|
**Query Parameters:** All require `?site_id=`, run-specific require `?run_id=`
|
|
|
|
|
|
|
|
|
|
### Default Settings Endpoint (v1.8.1)
|
|
|
|
|
|
|
|
|
|
Returns centralized defaults from `DefaultAutomationConfig`:
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"automation": { "enabled": false, "frequency": "daily", "time": "02:00" },
|
|
|
|
|
"stages": [
|
|
|
|
|
{ "number": 1, "enabled": true, "batch_size": 50, "per_run_limit": 0, "use_testing": false, "budget_pct": 15 },
|
|
|
|
|
...
|
|
|
|
|
],
|
|
|
|
|
"delays": { "within_stage": 3, "between_stage": 5 },
|
|
|
|
|
"publishing": {
|
|
|
|
|
"auto_approval_enabled": false,
|
|
|
|
|
"auto_publish_enabled": false,
|
|
|
|
|
"daily_publish_limit": 3,
|
|
|
|
|
"publish_days": ["mon", "tue", "wed", "thu", "fri"],
|
|
|
|
|
"time_slots": ["09:00", "14:00", "18:00"]
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### run_progress Endpoint (v1.3.0)
|
|
|
|
|
|
|
|
|
|
Returns unified progress data for frontend:
|
|
|
|
|
|