From 55148b47a82b16c83b02174172a1df69eb7c3a85 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Mon, 26 Jan 2026 10:35:43 +0800 Subject: [PATCH] refactor: Recently queried questions query restriction for the current login user --- backend/apps/chat/curd/chat.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/apps/chat/curd/chat.py b/backend/apps/chat/curd/chat.py index c71ed2a7..a231bef4 100644 --- a/backend/apps/chat/curd/chat.py +++ b/backend/apps/chat/curd/chat.py @@ -52,7 +52,8 @@ def list_recent_questions(session: SessionDep, current_user: CurrentUser, dataso .join(Chat, ChatRecord.chat_id == Chat.id) # 关联Chat表 .filter( Chat.datasource == datasource_id, # 使用Chat表的datasource字段 - ChatRecord.question.isnot(None) + ChatRecord.question.isnot(None), + ChatRecord.create_by == current_user.id ) .group_by(ChatRecord.question) .order_by(desc(func.max(ChatRecord.create_time)))