feat: persist story generation states and cache audio
Some checks failed
Build and Push Docker Images / changes (push) Has been cancelled
Build and Push Docker Images / build-backend (push) Has been cancelled
Build and Push Docker Images / build-frontend (push) Has been cancelled
Build and Push Docker Images / build-admin-frontend (push) Has been cancelled
Some checks failed
Build and Push Docker Images / changes (push) Has been cancelled
Build and Push Docker Images / build-backend (push) Has been cancelled
Build and Push Docker Images / build-frontend (push) Has been cancelled
Build and Push Docker Images / build-admin-frontend (push) Has been cancelled
This commit is contained in:
@@ -27,10 +27,10 @@ class User(Base):
|
||||
|
||||
__tablename__ = "users"
|
||||
|
||||
id: Mapped[str] = mapped_column(String(255), primary_key=True) # OAuth provider user ID
|
||||
id: Mapped[str] = mapped_column(String(255), primary_key=True)
|
||||
name: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
avatar_url: Mapped[str | None] = mapped_column(String(500))
|
||||
provider: Mapped[str] = mapped_column(String(50), nullable=False) # github / google
|
||||
provider: Mapped[str] = mapped_column(String(50), nullable=False)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now()
|
||||
)
|
||||
@@ -59,11 +59,22 @@ class Story(Base):
|
||||
String(36), ForeignKey("story_universes.id", ondelete="SET NULL"), nullable=True
|
||||
)
|
||||
title: Mapped[str] = mapped_column(String(255), nullable=False)
|
||||
story_text: Mapped[str] = mapped_column(Text, nullable=True) # 允许为空(绘本模式下)
|
||||
pages: Mapped[list[dict] | None] = mapped_column(JSON, default=list) # 绘本分页数据
|
||||
story_text: Mapped[str | None] = mapped_column(Text, nullable=True)
|
||||
pages: Mapped[list[dict] | None] = mapped_column(JSON, default=list)
|
||||
cover_prompt: Mapped[str | None] = mapped_column(Text)
|
||||
image_url: Mapped[str | None] = mapped_column(String(500))
|
||||
mode: Mapped[str] = mapped_column(String(20), nullable=False, default="generated")
|
||||
generation_status: Mapped[str] = mapped_column(
|
||||
String(32), nullable=False, default="narrative_ready"
|
||||
)
|
||||
image_status: Mapped[str] = mapped_column(
|
||||
String(32), nullable=False, default="not_requested"
|
||||
)
|
||||
audio_status: Mapped[str] = mapped_column(
|
||||
String(32), nullable=False, default="not_requested"
|
||||
)
|
||||
audio_path: Mapped[str | None] = mapped_column(String(500))
|
||||
last_error: Mapped[str | None] = mapped_column(Text)
|
||||
created_at: Mapped[datetime] = mapped_column(
|
||||
DateTime(timezone=True), server_default=func.now()
|
||||
)
|
||||
@@ -123,6 +134,7 @@ class ChildProfile(Base):
|
||||
|
||||
class StoryUniverse(Base):
|
||||
"""Story universe entity."""
|
||||
|
||||
__tablename__ = "story_universes"
|
||||
|
||||
id: Mapped[str] = mapped_column(String(36), primary_key=True, default=_uuid)
|
||||
@@ -142,7 +154,9 @@ class StoryUniverse(Base):
|
||||
DateTime(timezone=True), server_default=func.now(), onupdate=func.now()
|
||||
)
|
||||
|
||||
child_profile: Mapped["ChildProfile"] = relationship("ChildProfile", back_populates="story_universes")
|
||||
child_profile: Mapped["ChildProfile"] = relationship(
|
||||
"ChildProfile", back_populates="story_universes"
|
||||
)
|
||||
|
||||
|
||||
class ReadingEvent(Base):
|
||||
@@ -163,6 +177,7 @@ class ReadingEvent(Base):
|
||||
DateTime(timezone=True), server_default=func.now(), index=True
|
||||
)
|
||||
|
||||
|
||||
class PushConfig(Base):
|
||||
"""Push configuration entity."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user