astrbot_plugin_imagestudio/backend/dto/chat_command_dto.py

32 行
785 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
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,
}
class ChatCommandParseError(ValueError):
pass