修复chat生成参数提交错误BUG|模型引擎积分设置关联开发优化成功|视频/图片生成引擎API开发完成
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from sqlalchemy import Float, ForeignKey, Integer, String
|
||||
from sqlalchemy import Float, Index, String
|
||||
from sqlalchemy.orm import Mapped, mapped_column
|
||||
|
||||
from app.models.base import Base, TimestampMixin
|
||||
@@ -6,13 +6,19 @@ from app.models.base import Base, TimestampMixin
|
||||
|
||||
class CreditRatio(Base, TimestampMixin):
|
||||
__tablename__ = "credit_ratios"
|
||||
__table_args__ = (
|
||||
Index("ix_credit_ratios_gen_type_engine_resolution", "gen_type", "model_config_id", "resolution"),
|
||||
Index("ix_credit_ratios_gen_type_resolution", "gen_type", "resolution"),
|
||||
)
|
||||
|
||||
id: Mapped[str] = mapped_column(String(32), primary_key=True)
|
||||
model_config_id: Mapped[str] = mapped_column(
|
||||
String(32), ForeignKey("model_configs.id")
|
||||
)
|
||||
gen_type: Mapped[str] = mapped_column(String(16), default="video")
|
||||
resolution: Mapped[str] = mapped_column(String(16), nullable=False)
|
||||
# 兼容旧字段名:
|
||||
# gen_type=image 时,该字段保存 image_engines.id;
|
||||
# gen_type=video 时,该字段保存 video_engines.id。
|
||||
# 不再通过数据库外键绑定 model_configs.id,避免同一字段无法同时关联图片/视频引擎表。
|
||||
model_config_id: Mapped[str] = mapped_column(String(32), index=True)
|
||||
gen_type: Mapped[str] = mapped_column(String(16), default="video", index=True)
|
||||
resolution: Mapped[str] = mapped_column(String(16), nullable=False, index=True)
|
||||
ratio: Mapped[float] = mapped_column(Float, nullable=False)
|
||||
base_credits: Mapped[float] = mapped_column(Float, default=80.0)
|
||||
per_second_credits: Mapped[float] = mapped_column(Float, default=2.0)
|
||||
|
||||
Reference in New Issue
Block a user