34 行
884 B
Python
34 行
884 B
Python
"""DTOs for platform-neutral ImageStudio chat commands."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
SIZE_ALIASES = {"1k": "1920x1080", "2k": "2560x1440", "4k": "3840x2160"}
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class SingleImageCommand:
|
|
prompt: str
|
|
profile_ref: str | None = None
|
|
model_route: str | None = None
|
|
size: str = "1920x1080"
|
|
count: int = 1
|
|
negative_prompt: str | None = None
|
|
translation_consent: bool = False
|
|
|
|
def to_payload(self) -> dict:
|
|
return {
|
|
"prompt": self.prompt,
|
|
"profile_ref": self.profile_ref,
|
|
"model_route": self.model_route,
|
|
"size": self.size,
|
|
"count": self.count,
|
|
"negative_prompt": self.negative_prompt,
|
|
"translation_consent": self.translation_consent,
|
|
}
|
|
|
|
|
|
class ChatCommandParseError(ValueError):
|
|
pass
|