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,7 +1,7 @@
# System Architecture
**Last Verified:** December 27, 2025
**Version:** 1.2.0
**Last Verified:** January 1, 2026
**Version:** 1.3.0
**Backend Path:** `backend/igny8_core/`
**Frontend Path:** `frontend/src/`
@@ -67,7 +67,7 @@
┌─────────────────────────────────────────────────────────────────┐
│ EXTERNAL SERVICES │
OpenAI API (GPT-4, DALL-E) │ Runware │ WordPress Sites
│ OpenAI │ Anthropic │ Runware │ Bria │ WordPress Sites │
└─────────────────────────────────────────────────────────────────┘
```
@@ -97,6 +97,7 @@ backend/igny8_core/
│ ├── engine.py # AIEngine orchestrator
│ ├── functions/ # AutoCluster, GenerateIdeas, GenerateContent, etc.
│ ├── registry.py # Function registry
│ ├── model_registry.py # Model Registry service (v1.3.0)
│ └── progress.py # Progress tracking
├── modules/ # Feature modules (API layer)
@@ -192,6 +193,7 @@ frontend/src/
│ └── AppSidebar.tsx
├── hooks/ # Custom hooks
│ └── useWorkflowStats.ts # Automation stats hook (v1.3.0)
├── context/ # React contexts
└── utils/ # Utility functions
```
@@ -299,10 +301,46 @@ AI keys are stored in `GlobalIntegrationSettings` (database), not env vars.
---
## Model Registry (v1.3.0)
The Model Registry provides centralized AI model configuration with database-stored pricing and settings:
```python
# backend/igny8_core/ai/model_registry.py
from igny8_core.modules.system.models import AIModelConfig
class ModelRegistry:
"""Centralized AI model configuration service"""
@classmethod
def get_model(cls, model_id: str) -> AIModelConfig:
"""Get model config by ID"""
return AIModelConfig.objects.get(model_id=model_id)
@classmethod
def get_active_models_by_type(cls, model_type: str) -> QuerySet:
"""Get all active models for a type (text, image, etc.)"""
return AIModelConfig.objects.filter(
model_type=model_type,
is_active=True
)
```
**Supported Providers:**
| Provider | Types | Integration |
|----------|-------|-------------|
| OpenAI | Text, Image | GPT-4o, GPT-4-turbo, DALL-E 3 |
| Anthropic | Text | Claude 3.5 Sonnet, Claude 3 Opus |
| Runware | Image | RunwareFLUX, SD 3.5 |
| Bria | Image | Bria 2.3 |
---
## Planned Changes
| Feature | Status | Description |
|---------|--------|-------------|
| AIModelConfig Database | 🔜 Planned | Move AI model pricing from constants to database |
| ~~AIModelConfig Database~~ | ✅ v1.3.0 | ~~Move AI model pricing from constants to database~~ |
| ~~Multi-provider AI~~ | ✅ v1.3.0 | ~~Support for Anthropic, Bria~~ |
| Module Guard Extension | 🔜 Planned | Extend linker/optimizer disable to all pages (currently sidebar only) |
| Multi-provider AI | 🔜 Planned | Support for Anthropic, Google AI |
| Google AI Integration | 🔜 Planned | Support for Gemini models |

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

View File

@@ -1,6 +1,7 @@
# Integrations Module
**Last Verified:** December 25, 2025
**Last Verified:** January 1, 2026
**Version:** 1.3.0
**Status:** ✅ Active
**Backend Path:** `backend/igny8_core/modules/integration/` + `backend/igny8_core/business/integration/`
**Frontend Path:** `frontend/src/pages/Settings/IntegrationSettings.tsx`
@@ -15,13 +16,66 @@
| Views | `modules/integration/views.py` | `SiteIntegrationViewSet` |
| Webhooks | `modules/integration/webhooks.py` | `wordpress_webhook` |
| Services | `business/integration/services/*.py` | Sync services |
| AI Core | `ai/ai_core.py` | OpenAI, Anthropic, Runware, Bria clients |
| Model Registry | `ai/model_registry.py` | Centralized model configs |
| Frontend | `pages/Settings/IntegrationSettings.tsx` | Integration UI |
---
## AI Provider Integrations (v1.3.0)
### Supported Providers
| Provider | Type | Models | API Key Field |
|----------|------|--------|---------------|
| OpenAI | Text/Image | gpt-4o, gpt-4o-mini, dall-e-3 | `openai_api_key` |
| Anthropic | Text | claude-3-5-sonnet, claude-3-opus, claude-3-haiku | `anthropic_api_key` |
| Runware | Image | runware-v2 | `runware_api_key` |
| Bria AI | Image | bria-2.3, bria-2.3-fast, bria-2.2 | `bria_api_key` |
### GlobalIntegrationSettings
Located in `modules/system/global_settings_models.py`:
| Field | Type | Purpose |
|-------|------|---------|
| openai_api_key | CharField | OpenAI API key |
| anthropic_api_key | CharField | Anthropic API key (v1.3.0) |
| runware_api_key | CharField | Runware API key |
| bria_api_key | CharField | Bria AI API key (v1.3.0) |
| default_text_model | CharField | Default text model |
| default_image_model | CharField | Default image model |
| default_image_provider | CharField | openai/runware/bria |
### Model Registry
Centralized model configuration with caching:
```python
from igny8_core.ai.model_registry import ModelRegistry
# Get model config
model = ModelRegistry.get_model('gpt-4o-mini')
# Calculate cost
cost = ModelRegistry.calculate_cost('gpt-4o-mini', input_tokens=1000, output_tokens=500)
# List all models
models = ModelRegistry.list_models(model_type='text', provider='openai')
```
### Migrations
- `0012_add_bria_integration.py` - Adds Bria AI integration settings
- `0013_add_anthropic_integration.py` - Adds Anthropic integration settings
- `0009_seed_ai_model_configs.py` - Seeds model configurations
---
## Purpose
The Integrations module manages:
- AI provider connections (OpenAI, Anthropic, Runware, Bria)
- WordPress site connections
- Two-way content synchronization
- Webhook handling

View File

@@ -1,7 +1,7 @@
# Frontend Pages & Routes
**Last Verified:** December 27, 2025
**Version:** 1.2.0
**Last Verified:** January 1, 2026
**Version:** 1.3.0
**Framework:** React 19 + TypeScript + React Router 6 + Vite
---
@@ -27,6 +27,15 @@ Routes defined in `/frontend/src/App.tsx`:
---
## Legal Pages (v1.3.0)
| Route | File | Description |
|-------|------|-------------|
| `/privacy` | `legal/Privacy.tsx` | Privacy Policy |
| `/terms` | `legal/Terms.tsx` | Terms of Service |
---
## Dashboard
| Route | File | Description |