image strugles 2
This commit is contained in:
@@ -10,6 +10,42 @@ class Migration(migrations.Migration):
|
||||
]
|
||||
|
||||
operations = [
|
||||
# Fields already added via direct SQL, just mark as noop
|
||||
# This ensures the model matches the database schema
|
||||
# Declare the fields in Django schema so migrations can use them
|
||||
# These fields already exist in DB, so state_operations syncs Django's understanding
|
||||
migrations.SeparateDatabaseAndState(
|
||||
state_operations=[
|
||||
migrations.AddField(
|
||||
model_name='aimodelconfig',
|
||||
name='landscape_size',
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
help_text="Landscape image size for this model (e.g., '1792x1024', '1280x768')",
|
||||
max_length=20,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='aimodelconfig',
|
||||
name='square_size',
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
default='1024x1024',
|
||||
help_text="Square image size for this model (e.g., '1024x1024')",
|
||||
max_length=20,
|
||||
),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='aimodelconfig',
|
||||
name='valid_sizes',
|
||||
field=models.JSONField(
|
||||
blank=True,
|
||||
default=list,
|
||||
help_text="List of valid sizes for this model (e.g., ['1024x1024', '1792x1024'])",
|
||||
),
|
||||
),
|
||||
],
|
||||
database_operations=[
|
||||
# No DB operations - fields already exist via direct SQL
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
# Generated manually - Add Seedream 4.5 image model and update quality_tier choices
|
||||
from decimal import Decimal
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
def add_seedream_model(apps, schema_editor):
|
||||
"""
|
||||
Add ByteDance Seedream 4.5 image model via Runware.
|
||||
|
||||
Model specs:
|
||||
- model: bytedance:seedream@4.5
|
||||
- Square size: 2048x2048
|
||||
- Landscape size: 2304x1728
|
||||
- Quality tier: quality_option2
|
||||
- Credits per image: 5
|
||||
"""
|
||||
AIModelConfig = apps.get_model('billing', 'AIModelConfig')
|
||||
|
||||
AIModelConfig.objects.update_or_create(
|
||||
model_name='bytedance:seedream@4.5',
|
||||
defaults={
|
||||
'display_name': 'Seedream 4.5 - High Quality',
|
||||
'model_type': 'image',
|
||||
'provider': 'runware',
|
||||
'is_default': False,
|
||||
'is_active': True,
|
||||
'credits_per_image': 5,
|
||||
'quality_tier': 'quality_option2',
|
||||
'landscape_size': '2304x1728',
|
||||
'square_size': '2048x2048',
|
||||
'valid_sizes': ['2048x2048', '2304x1728', '2560x1440', '1728x2304', '1440x2560'],
|
||||
'capabilities': {
|
||||
'max_sequential_images': 4,
|
||||
'high_resolution': True,
|
||||
'provider_settings': {
|
||||
'bytedance': {
|
||||
'maxSequentialImages': 4
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
)
|
||||
print("✅ Added Seedream 4.5 image model")
|
||||
|
||||
|
||||
def reverse_migration(apps, schema_editor):
|
||||
"""Remove Seedream model"""
|
||||
AIModelConfig = apps.get_model('billing', 'AIModelConfig')
|
||||
AIModelConfig.objects.filter(model_name='bytedance:seedream@4.5').delete()
|
||||
print("❌ Removed Seedream 4.5 image model")
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
"""Add Seedream 4.5 image model and update quality_tier choices."""
|
||||
|
||||
dependencies = [
|
||||
('billing', '0030_add_aimodel_image_sizes'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
# Update quality_tier field choices to include quality_option2
|
||||
migrations.AlterField(
|
||||
model_name='aimodelconfig',
|
||||
name='quality_tier',
|
||||
field=models.CharField(
|
||||
blank=True,
|
||||
choices=[
|
||||
('basic', 'Basic'),
|
||||
('quality', 'Quality'),
|
||||
('quality_option2', 'Quality-Option2'),
|
||||
('premium', 'Premium'),
|
||||
],
|
||||
help_text='basic / quality / quality_option2 / premium - for image models',
|
||||
max_length=20,
|
||||
null=True,
|
||||
),
|
||||
),
|
||||
# Add the Seedream model
|
||||
migrations.RunPython(add_seedream_model, reverse_migration),
|
||||
]
|
||||
Reference in New Issue
Block a user