m
zhaoqingang
2024-12-09 52ba4076f5ad55fdf3239a33a2a376eaa0e0dea5
app/models/session_model.py
@@ -1,11 +1,17 @@
import json
from datetime import datetime
from enum import IntEnum
import pytz
from sqlalchemy import Column, String, Enum as SQLAlchemyEnum, Integer, DateTime, JSON, TEXT
from app.models import AgentType, current_time
from app.models.agent_model import AgentType
# from app.models import current_time
from app.models.base_model import Base
def current_time():
    tz = pytz.timezone('Asia/Shanghai')
    return datetime.now(tz)
class SessionModel(Base):
    __tablename__ = "sessions"
@@ -17,6 +23,7 @@
    update_date = Column(DateTime, default=current_time, onupdate=current_time)  # 更新时间,默认值为当前时区时间,更新时自动更新
    tenant_id = Column(Integer)  # 创建人
    message = Column(TEXT)  # 说明
    conversation_id = Column(String(64))
    # to_dict 方法
    def to_dict(self):