models + refactor
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
from typing import Optional
|
||||
from pydantic import BaseModel, Field
|
||||
from models.enums import AspectRatios, Quality
|
||||
|
||||
@@ -7,29 +6,31 @@ class ExternalGenerationRequest(BaseModel):
|
||||
"""Request model for importing external generations."""
|
||||
|
||||
prompt: str
|
||||
tech_prompt: Optional[str] = None
|
||||
tech_prompt: str | None = None
|
||||
|
||||
# Image can be provided as base64 string OR URL (one must be provided)
|
||||
image_data: Optional[str] = Field(None, description="Base64-encoded image data")
|
||||
image_url: Optional[str] = Field(None, description="URL to download image from")
|
||||
image_data: str | None = Field(None, description="Base64-encoded image data")
|
||||
image_url: str | None = Field(None, description="URL to download image from")
|
||||
|
||||
nsfw: bool = False
|
||||
|
||||
# Generation metadata
|
||||
aspect_ratio: AspectRatios = AspectRatios.NINESIXTEEN # "1:1","2:3","3:2","3:4","4:3","4:5","5:4","9:16","16:9","21:9"
|
||||
quality: Quality = Quality.ONEK
|
||||
model: str | None = None
|
||||
seed: int | None = None
|
||||
|
||||
# Optional linking
|
||||
linked_character_id: Optional[str] = None
|
||||
linked_character_id: str | None = None
|
||||
created_by: str = Field(..., description="User ID from external system")
|
||||
project_id: Optional[str] = None
|
||||
project_id: str | None = None
|
||||
|
||||
# Performance metrics
|
||||
execution_time_seconds: Optional[float] = None
|
||||
api_execution_time_seconds: Optional[float] = None
|
||||
token_usage: Optional[int] = None
|
||||
input_token_usage: Optional[int] = None
|
||||
output_token_usage: Optional[int] = None
|
||||
execution_time_seconds: float | None = None
|
||||
api_execution_time_seconds: float | None = None
|
||||
token_usage: int | None = None
|
||||
input_token_usage: int | None = None
|
||||
output_token_usage: int | None = None
|
||||
|
||||
def validate_image_source(self):
|
||||
"""Ensure at least one image source is provided."""
|
||||
|
||||
Reference in New Issue
Block a user