1.7
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
"""聊天气候模型"""
|
||||
|
||||
from datetime import datetime
|
||||
|
||||
from sqlalchemy import String, Integer, DateTime, Text, ForeignKey
|
||||
from sqlalchemy.orm import Mapped, mapped_column, relationship
|
||||
|
||||
from app.database import Base
|
||||
|
||||
|
||||
class ChatClimate(Base):
|
||||
__tablename__ = "chat_climates"
|
||||
|
||||
conversation_id: Mapped[str] = mapped_column(String(36), ForeignKey("conversations.id", ondelete="CASCADE"), primary_key=True)
|
||||
season: Mapped[str] = mapped_column(String(10), nullable=False) # spring/summer/autumn/winter
|
||||
temperature: Mapped[int] = mapped_column(Integer, nullable=False) # -10 ~ 40
|
||||
weather: Mapped[str] = mapped_column(String(20), nullable=False) # sunny/cloudy/rainy/windy/snowy
|
||||
emoji: Mapped[str] = mapped_column(String(10), nullable=False)
|
||||
daily_history: Mapped[str | None] = mapped_column(Text, nullable=True) # JSON: [{date, season, temp, emoji}]
|
||||
updated_at: Mapped[datetime] = mapped_column(
|
||||
DateTime, default=lambda: datetime.utcnow(), onupdate=lambda: datetime.utcnow()
|
||||
)
|
||||
|
||||
conversation = relationship("Conversation")
|
||||
Reference in New Issue
Block a user