imp part 4

This commit is contained in:
IGNY8 VPS (Salman)
2025-12-30 13:14:21 +00:00
parent 51950c7ce1
commit 1632ee62b6
8 changed files with 1200 additions and 3 deletions

View File

@@ -57,6 +57,12 @@ class GlobalIntegrationSettings(models.Model):
('runware:101@1', 'Runware 101@1 - Fast Generation'),
]
BRIA_MODEL_CHOICES = [
('bria-2.3', 'Bria 2.3 - High Quality ($0.015/image)'),
('bria-2.3-fast', 'Bria 2.3 Fast - Quick Generation ($0.010/image)'),
('bria-2.2', 'Bria 2.2 - Standard ($0.012/image)'),
]
IMAGE_QUALITY_CHOICES = [
('standard', 'Standard'),
('hd', 'HD'),
@@ -73,6 +79,20 @@ class GlobalIntegrationSettings(models.Model):
IMAGE_SERVICE_CHOICES = [
('openai', 'OpenAI DALL-E'),
('runware', 'Runware'),
('bria', 'Bria AI'),
]
ANTHROPIC_MODEL_CHOICES = [
('claude-3-5-sonnet-20241022', 'Claude 3.5 Sonnet - $3.00 / $15.00 per 1M tokens'),
('claude-3-5-haiku-20241022', 'Claude 3.5 Haiku - $1.00 / $5.00 per 1M tokens'),
('claude-3-opus-20240229', 'Claude 3 Opus - $15.00 / $75.00 per 1M tokens'),
('claude-3-sonnet-20240229', 'Claude 3 Sonnet - $3.00 / $15.00 per 1M tokens'),
('claude-3-haiku-20240307', 'Claude 3 Haiku - $0.25 / $1.25 per 1M tokens'),
]
TEXT_PROVIDER_CHOICES = [
('openai', 'OpenAI (GPT)'),
('anthropic', 'Anthropic (Claude)'),
]
# OpenAI Settings (for text generation)
@@ -96,6 +116,35 @@ class GlobalIntegrationSettings(models.Model):
help_text="Default max tokens for responses (accounts can override if plan allows)"
)
# Anthropic Settings (for text generation - alternative to OpenAI)
anthropic_api_key = models.CharField(
max_length=500,
blank=True,
help_text="Platform Anthropic API key - used by ALL accounts"
)
anthropic_model = models.CharField(
max_length=100,
default='claude-3-5-sonnet-20241022',
choices=ANTHROPIC_MODEL_CHOICES,
help_text="Default Claude model (accounts can override if plan allows)"
)
anthropic_temperature = models.FloatField(
default=0.7,
help_text="Default temperature for Claude 0.0-1.0 (accounts can override if plan allows)"
)
anthropic_max_tokens = models.IntegerField(
default=8192,
help_text="Default max tokens for Claude responses (accounts can override if plan allows)"
)
# Default Text Generation Provider
default_text_provider = models.CharField(
max_length=20,
default='openai',
choices=TEXT_PROVIDER_CHOICES,
help_text="Default text generation provider for all accounts (openai=GPT, anthropic=Claude)"
)
# Image Generation Settings (OpenAI/DALL-E)
dalle_api_key = models.CharField(
max_length=500,
@@ -128,12 +177,25 @@ class GlobalIntegrationSettings(models.Model):
help_text="Default Runware model (accounts can override if plan allows)"
)
# Image Generation Settings (Bria AI)
bria_api_key = models.CharField(
max_length=500,
blank=True,
help_text="Platform Bria API key - used by ALL accounts"
)
bria_model = models.CharField(
max_length=100,
default='bria-2.3',
choices=BRIA_MODEL_CHOICES,
help_text="Default Bria model (accounts can override if plan allows)"
)
# Default Image Generation Service
default_image_service = models.CharField(
max_length=20,
default='openai',
choices=IMAGE_SERVICE_CHOICES,
help_text="Default image generation service for all accounts (openai=DALL-E, runware=Runware)"
help_text="Default image generation service for all accounts (openai=DALL-E, runware=Runware, bria=Bria)"
)
# Universal Image Generation Settings (applies to ALL providers)

View File

@@ -0,0 +1,53 @@
# Generated migration for Bria AI integration
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('system', '0011_disable_phase2_modules'),
]
operations = [
# Add Bria API key field
migrations.AddField(
model_name='globalintegrationsettings',
name='bria_api_key',
field=models.CharField(
blank=True,
help_text='Platform Bria API key - used by ALL accounts',
max_length=500
),
),
# Add Bria model selection field
migrations.AddField(
model_name='globalintegrationsettings',
name='bria_model',
field=models.CharField(
choices=[
('bria-2.3', 'Bria 2.3 - High Quality ($0.015/image)'),
('bria-2.3-fast', 'Bria 2.3 Fast - Quick Generation ($0.010/image)'),
('bria-2.2', 'Bria 2.2 - Standard ($0.012/image)'),
],
default='bria-2.3',
help_text='Default Bria model (accounts can override if plan allows)',
max_length=100
),
),
# Update default_image_service choices to include bria
migrations.AlterField(
model_name='globalintegrationsettings',
name='default_image_service',
field=models.CharField(
choices=[
('openai', 'OpenAI DALL-E'),
('runware', 'Runware'),
('bria', 'Bria AI'),
],
default='openai',
help_text='Default image generation service for all accounts (openai=DALL-E, runware=Runware, bria=Bria)',
max_length=20
),
),
]

View File

@@ -0,0 +1,64 @@
# Generated migration for Anthropic (Claude) integration
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('system', '0012_add_bria_integration'),
]
operations = [
migrations.AddField(
model_name='globalintegrationsettings',
name='anthropic_api_key',
field=models.CharField(
blank=True,
help_text='Platform Anthropic API key - used by ALL accounts',
max_length=500
),
),
migrations.AddField(
model_name='globalintegrationsettings',
name='anthropic_model',
field=models.CharField(
choices=[
('claude-3-5-sonnet-20241022', 'Claude 3.5 Sonnet (Latest)'),
('claude-3-5-haiku-20241022', 'Claude 3.5 Haiku (Fast)'),
('claude-3-opus-20240229', 'Claude 3 Opus'),
('claude-3-sonnet-20240229', 'Claude 3 Sonnet'),
('claude-3-haiku-20240307', 'Claude 3 Haiku'),
],
default='claude-3-5-sonnet-20241022',
help_text='Default Claude model (accounts can override if plan allows)',
max_length=100
),
),
migrations.AddField(
model_name='globalintegrationsettings',
name='anthropic_temperature',
field=models.FloatField(
default=0.7,
help_text='Default temperature for Claude 0.0-1.0 (accounts can override if plan allows)'
),
),
migrations.AddField(
model_name='globalintegrationsettings',
name='anthropic_max_tokens',
field=models.IntegerField(
default=8192,
help_text='Default max tokens for Claude responses (accounts can override if plan allows)'
),
),
migrations.AddField(
model_name='globalintegrationsettings',
name='default_text_provider',
field=models.CharField(
choices=[('openai', 'OpenAI (GPT)'), ('anthropic', 'Anthropic (Claude)')],
default='openai',
help_text='Default text generation provider for all accounts (openai=GPT, anthropic=Claude)',
max_length=20
),
),
]