1
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from sqlalchemy import Boolean, Integer, String, Text
|
||||
from sqlalchemy import Boolean, CheckConstraint, Integer, String, Text
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.models.base import Base, TimestampMixin
|
||||
@@ -6,6 +6,11 @@ from app.models.base import Base, TimestampMixin
|
||||
|
||||
class ImageEngine(Base, TimestampMixin):
|
||||
__tablename__ = "image_engines"
|
||||
__table_args__ = (
|
||||
CheckConstraint("max_generation_count BETWEEN 1 AND 5", name="ck_image_engines_max_generation_count"),
|
||||
CheckConstraint("multi_image_max_images BETWEEN 1 AND 15", name="ck_image_engines_multi_image_max_images"),
|
||||
CheckConstraint("max_reference_image_count BETWEEN 0 AND 14", name="ck_image_engines_max_reference_image_count"),
|
||||
)
|
||||
|
||||
id: Mapped[str] = mapped_column(String(32), primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String(64), nullable=False)
|
||||
@@ -18,6 +23,26 @@ class ImageEngine(Base, TimestampMixin):
|
||||
supported_sizes: Mapped[str] = mapped_column(Text, default='{}')
|
||||
default_size: Mapped[str] = mapped_column(String(32), default="2K")
|
||||
max_image_count: Mapped[int] = mapped_column(Integer, default=0)
|
||||
|
||||
# 管理后台只配置能力开关与数量上限;本次实际生成数量保存在 ChatGenerationTask.generation_count。
|
||||
multi_generation_enabled: Mapped[bool] = mapped_column(
|
||||
Boolean,
|
||||
default=False,
|
||||
server_default="false",
|
||||
nullable=False,
|
||||
)
|
||||
max_generation_count: Mapped[int] = mapped_column(
|
||||
Integer,
|
||||
default=1,
|
||||
server_default="1",
|
||||
nullable=False,
|
||||
)
|
||||
|
||||
# 火山组图接口能力约束。多份图片始终只调用一次 sequential_image_generation=auto 接口。
|
||||
multi_image_max_images: Mapped[int] = mapped_column(Integer, default=15, server_default="15", nullable=False)
|
||||
max_reference_image_count: Mapped[int] = mapped_column(Integer, default=14, server_default="14", nullable=False)
|
||||
# 留空表示不向供应商传 output_format;用于兼容不支持该参数的模型。
|
||||
output_format: Mapped[str] = mapped_column(String(16), default="", server_default="", nullable=False)
|
||||
generate_url: Mapped[str | None] = mapped_column(String(512), nullable=True, default="")
|
||||
is_active: Mapped[bool] = mapped_column(Boolean, default=True)
|
||||
priority: Mapped[int] = mapped_column(Integer, default=0)
|
||||
|
||||
Reference in New Issue
Block a user