Image genartiona dn temaplte design redesign
This commit is contained in:
@@ -816,6 +816,27 @@ class AIModelConfig(models.Model):
|
||||
help_text="basic / quality / premium - for image models"
|
||||
)
|
||||
|
||||
# Image Size Configuration (for image models)
|
||||
landscape_size = models.CharField(
|
||||
max_length=20,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text="Landscape image size for this model (e.g., '1792x1024', '1280x768')"
|
||||
)
|
||||
|
||||
square_size = models.CharField(
|
||||
max_length=20,
|
||||
default='1024x1024',
|
||||
blank=True,
|
||||
help_text="Square image size for this model (e.g., '1024x1024')"
|
||||
)
|
||||
|
||||
valid_sizes = models.JSONField(
|
||||
default=list,
|
||||
blank=True,
|
||||
help_text="List of valid sizes for this model (e.g., ['1024x1024', '1792x1024'])"
|
||||
)
|
||||
|
||||
# Model Limits
|
||||
max_tokens = models.IntegerField(
|
||||
null=True,
|
||||
@@ -884,6 +905,21 @@ class AIModelConfig(models.Model):
|
||||
model_type='image',
|
||||
is_active=True
|
||||
).order_by('quality_tier', 'model_name')
|
||||
|
||||
def validate_size(self, size: str) -> bool:
|
||||
"""Validate that the given size is valid for this image model"""
|
||||
if not self.valid_sizes:
|
||||
# If no valid_sizes defined, accept common sizes
|
||||
return True
|
||||
return size in self.valid_sizes
|
||||
|
||||
def get_landscape_size(self) -> str:
|
||||
"""Get the landscape size for this model"""
|
||||
return self.landscape_size or '1792x1024'
|
||||
|
||||
def get_square_size(self) -> str:
|
||||
"""Get the square size for this model"""
|
||||
return self.square_size or '1024x1024'
|
||||
|
||||
|
||||
class WebhookEvent(models.Model):
|
||||
|
||||
Reference in New Issue
Block a user