Prechádzať zdrojové kódy

自研智能体会话列表排序

zhaoqingang 1 rok pred
rodič
commit
87524b8bf9
1 zmenil súbory, kde vykonal 1 pridanie a 1 odobranie
  1. 1 1
      app/api/agent.py

+ 1 - 1
app/api/agent.py

@@ -60,7 +60,7 @@ async def chat_list(
 
     elif agent.agent_type == AgentType.BASIC:
         offset = (page - 1) * limit
-        records = db.query(SessionModel).filter(SessionModel.agent_id == agent_id, SessionModel.tenant_id==current_user.id).offset(offset).limit(limit).all()
+        records = db.query(SessionModel).filter(SessionModel.agent_id == agent_id, SessionModel.tenant_id==current_user.id).order_by(SessionModel.create_date.desc()).offset(offset).limit(limit).all()
         result = [item.to_dict() for item in records]
         return ResponseList(code=200, msg="", data=result)