wokring models and image genration model and admin apges
This commit is contained in:
@@ -0,0 +1,87 @@
|
||||
"""
|
||||
Migration: Update Runware model configurations in AIModelConfig
|
||||
|
||||
This migration:
|
||||
1. Updates runware:97@1 to have display_name "Hi Dream Full - Standard"
|
||||
2. Adds Bria 3.2 model as civitai:618692@691639
|
||||
"""
|
||||
from decimal import Decimal
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def update_runware_models(apps, schema_editor):
|
||||
"""Update Runware models in AIModelConfig"""
|
||||
AIModelConfig = apps.get_model('billing', 'AIModelConfig')
|
||||
|
||||
# Update existing runware:97@1 model
|
||||
AIModelConfig.objects.update_or_create(
|
||||
model_name='runware:97@1',
|
||||
defaults={
|
||||
'display_name': 'Hi Dream Full - Standard',
|
||||
'model_type': 'image',
|
||||
'provider': 'runware',
|
||||
'cost_per_image': Decimal('0.008'),
|
||||
'valid_sizes': ['512x512', '768x768', '1024x1024', '1024x1792', '1792x1024'],
|
||||
'supports_json_mode': False,
|
||||
'supports_vision': False,
|
||||
'supports_function_calling': False,
|
||||
'is_active': True,
|
||||
'is_default': True, # Make this the default Runware model
|
||||
'sort_order': 10,
|
||||
'description': 'Hi Dream Full - Standard quality image generation via Runware',
|
||||
}
|
||||
)
|
||||
|
||||
# Add Bria 3.2 Premium model
|
||||
AIModelConfig.objects.update_or_create(
|
||||
model_name='civitai:618692@691639',
|
||||
defaults={
|
||||
'display_name': 'Bria 3.2 - Premium',
|
||||
'model_type': 'image',
|
||||
'provider': 'runware',
|
||||
'cost_per_image': Decimal('0.012'),
|
||||
'valid_sizes': ['512x512', '768x768', '1024x1024', '1024x1792', '1792x1024'],
|
||||
'supports_json_mode': False,
|
||||
'supports_vision': False,
|
||||
'supports_function_calling': False,
|
||||
'is_active': True,
|
||||
'is_default': False,
|
||||
'sort_order': 11,
|
||||
'description': 'Bria 3.2 - Premium quality image generation via Runware/Civitai',
|
||||
}
|
||||
)
|
||||
|
||||
# Optionally remove the old runware:100@1 and runware:101@1 models if they exist
|
||||
AIModelConfig.objects.filter(
|
||||
model_name__in=['runware:100@1', 'runware:101@1']
|
||||
).update(is_active=False)
|
||||
|
||||
|
||||
def reverse_migration(apps, schema_editor):
|
||||
"""Reverse the migration"""
|
||||
AIModelConfig = apps.get_model('billing', 'AIModelConfig')
|
||||
|
||||
# Restore old display name
|
||||
AIModelConfig.objects.filter(model_name='runware:97@1').update(
|
||||
display_name='Runware Standard',
|
||||
is_default=False,
|
||||
)
|
||||
|
||||
# Remove Bria 3.2 model
|
||||
AIModelConfig.objects.filter(model_name='civitai:618692@691639').delete()
|
||||
|
||||
# Re-activate old models
|
||||
AIModelConfig.objects.filter(
|
||||
model_name__in=['runware:100@1', 'runware:101@1']
|
||||
).update(is_active=True)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('billing', '0022_fix_historical_calculation_mode_null'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RunPython(update_runware_models, reverse_migration),
|
||||
]
|
||||
Reference in New Issue
Block a user