From 87524b8bf9fc48cf7992cb06eac95306eeee2540 Mon Sep 17 00:00:00 2001
From: zhaoqingang <zhaoqg0118@163.com>
Date: 星期五, 22 十一月 2024 11:38:36 +0800
Subject: [PATCH] 自研智能体会话列表排序

---
 app/api/agent.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/app/api/agent.py b/app/api/agent.py
index fe6e6c0..e2982c7 100644
--- a/app/api/agent.py
+++ b/app/api/agent.py
@@ -60,7 +60,7 @@
 
     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)
 

--
Gitblit v1.8.0