v2-exece-docs
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
# IGNY8 Phase 0: Self-Hosted AI Infrastructure (00F)
|
||||
|
||||
**Status:** Ready for Implementation
|
||||
**Version:** 1.1
|
||||
**Priority:** High (cost savings critical for unit economics)
|
||||
**Duration:** 5-7 days
|
||||
**Dependencies:** 00B (VPS provisioning) must be complete first
|
||||
**Version Reference:** See [00B Version Matrix](./00B-vps-provisioning.md) for authoritative version information
|
||||
**Source of Truth:** Codebase at `/data/app/igny8/`
|
||||
**Cost:** ~$200/month GPU rental + $0 software (open source)
|
||||
|
||||
---
|
||||
@@ -12,14 +13,12 @@
|
||||
## 1. Current State
|
||||
|
||||
### Existing AI Integration
|
||||
- **External providers:** OpenAI (GPT-4, GPT-3.5), Anthropic (Claude), Runware (image gen), Bria (image gen)
|
||||
- **Storage:** API keys stored in `GlobalIntegrationSettings` / `IntegrationProvider` models in database
|
||||
- **External providers (verified from `IntegrationProvider` model):** OpenAI (GPT-4, GPT-3.5), Anthropic (Claude), Runware (image gen)
|
||||
- **Storage:** API keys stored in `IntegrationProvider` model (table: `igny8_integration_providers`) with per-account overrides in `IntegrationSettings` (table: `igny8_integration_settings`). Global defaults in `GlobalIntegrationSettings`.
|
||||
- **Provider types in codebase:** `ai`, `payment`, `email`, `storage` (from `PROVIDER_TYPE_CHOICES`)
|
||||
- **Existing provider_ids:** `openai`, `runware`, `stripe`, `paypal`, `resend`
|
||||
- **Architecture:** Multi-provider AI engine with model selection capability
|
||||
- **Current usage:**
|
||||
- Content generation: articles, product descriptions, blog posts
|
||||
- Image generation: product images, covers, social media graphics
|
||||
- Keyword research and SEO optimization
|
||||
- Content enhancement and rewriting
|
||||
- **Current AI functions:** `auto_cluster`, `generate_ideas`, `generate_content`, `generate_images`, `generate_image_prompts`, `optimize_content`, `generate_site_structure`
|
||||
- **Async handling:** Celery workers process long-running AI tasks
|
||||
- **Cost impact:** External APIs constitute 15-30% of monthly operational costs
|
||||
|
||||
@@ -125,31 +124,35 @@
|
||||
|
||||
## 3. Data Models / APIs
|
||||
|
||||
### Database Models (No Schema Changes Required)
|
||||
### Database Models (Minimal Schema Changes)
|
||||
|
||||
Use existing `IntegrationProvider` and `GlobalIntegrationSettings` models:
|
||||
Use existing `IntegrationProvider` model — add a new row with `provider_type='ai'`:
|
||||
|
||||
```python
|
||||
# In GlobalIntegrationSettings
|
||||
INTEGRATION_PROVIDER_SELF_HOSTED = "self_hosted_ai"
|
||||
# New IntegrationProvider row (NO new provider_type needed)
|
||||
# provider_type='ai' already exists in PROVIDER_TYPE_CHOICES
|
||||
|
||||
# Settings structure (stored as JSON)
|
||||
{
|
||||
"provider": "self_hosted_ai",
|
||||
"name": "Self-Hosted AI (LiteLLM)",
|
||||
"base_url": "http://localhost:8000",
|
||||
"api_key": "not_used", # LiteLLM doesn't require auth (internal)
|
||||
"enabled": True,
|
||||
"priority": 10, # Try self-hosted first
|
||||
"models": {
|
||||
"text_generation": "qwen3:32b",
|
||||
"text_generation_fast": "qwen3:8b",
|
||||
"image_generation": "flux.1-dev",
|
||||
"image_generation_fast": "sdxl-lightning"
|
||||
},
|
||||
"timeout": 300, # 5 minute timeout for slow models
|
||||
"fallback_to": "openai" # Fallback provider if self-hosted fails
|
||||
}
|
||||
# Create via admin or migration:
|
||||
IntegrationProvider.objects.create(
|
||||
provider_id='self_hosted_ai',
|
||||
display_name='Self-Hosted AI (LiteLLM)',
|
||||
provider_type='ai',
|
||||
api_key='', # LiteLLM doesn't require auth (internal)
|
||||
api_endpoint='http://localhost:8000',
|
||||
is_active=True,
|
||||
is_sandbox=False,
|
||||
config={
|
||||
"priority": 10, # Try self-hosted first
|
||||
"models": {
|
||||
"text_generation": "qwen3:32b",
|
||||
"text_generation_fast": "qwen3:8b",
|
||||
"image_generation": "flux.1-dev",
|
||||
"image_generation_fast": "sdxl-lightning"
|
||||
},
|
||||
"timeout": 300, # 5 minute timeout for slow models
|
||||
"fallback_to": "openai" # Fallback provider if self-hosted fails
|
||||
}
|
||||
)
|
||||
```
|
||||
|
||||
### LiteLLM API Endpoints
|
||||
|
||||
Reference in New Issue
Block a user