From aa594a5681e9f84331c10b43b1ad7590a22698e4 Mon Sep 17 00:00:00 2001 From: ulleo Date: Thu, 9 Jul 2026 18:17:03 +0800 Subject: [PATCH] feat: Adjust the organizational attribution logic of dialogues in MCP #1221 --- backend/apps/chat/task/llm.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/apps/chat/task/llm.py b/backend/apps/chat/task/llm.py index df36ad40..308e2ad6 100644 --- a/backend/apps/chat/task/llm.py +++ b/backend/apps/chat/task/llm.py @@ -137,11 +137,14 @@ class LLMService: raise SingleMessageError(f"Chat with id {chat_id} not found") self.oid = chat.oid - if self.oid: + if self.oid and not current_assistant: w_list = user_ws_list(session, self.current_user.id) oid_list = [item.id for item in w_list] if int(self.oid) not in oid_list: raise SingleMessageError("Current user cannot not access this chat") + if self.oid and current_assistant: + if self.oid != self.current_user.oid: + raise SingleMessageError("Current assistant user cannot not access this chat") self.current_user.oid = chat.oid ds: CoreDatasource | AssistantOutDsSchema | None = None