From 8e3a2d2cc78dba7e5c9a7145ceae65658b32da66 Mon Sep 17 00:00:00 2001 From: xuyonghao <898441624@qq.com> Date: 星期一, 20 一月 2025 11:01:45 +0800 Subject: [PATCH] 合并历史记录修改 --- app/models/session_model.py | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/app/models/session_model.py b/app/models/session_model.py index fd513d2..87f63b7 100644 --- a/app/models/session_model.py +++ b/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" @@ -14,7 +20,7 @@ agent_id = Column(String(255)) agent_type = Column(SQLAlchemyEnum(AgentType), nullable=False) # 鐩墠鍙瓨basic鐨勶紝ragflow鍜宐isheng鐨勮皟鎺ュ彛鑾峰彇 create_date = Column(DateTime, default=current_time) # 鍒涘缓鏃堕棿锛岄粯璁ゅ�间负褰撳墠鏃跺尯鏃堕棿 - update_date = Column(DateTime, default=current_time, onupdate=current_time) # 鏇存柊鏃堕棿锛岄粯璁ゅ�间负褰撳墠鏃跺尯鏃堕棿锛屾洿鏂版椂鑷姩鏇存柊 + update_date = Column(DateTime, default=current_time, onupdate=current_time, index=True) # 鏇存柊鏃堕棿锛岄粯璁ゅ�间负褰撳墠鏃跺尯鏃堕棿锛屾洿鏂版椂鑷姩鏇存柊 tenant_id = Column(Integer) # 鍒涘缓浜� message = Column(TEXT) # 璇存槑 conversation_id = Column(String(64)) -- Gitblit v1.8.0