Skip to content

RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.

Fix: get user_id from variables (#13716)

Lynndb57155b30a7
diff --git a/agent/component/message.py b/agent/component/message.py
index fce572c8b0..7f9a9d328c 100644
--- a/agent/component/message.py
+++ b/agent/component/message.py
@@ -432,8 +432,15 @@ class Message(ComponentBase):
if not hasattr(self._param, "memory_ids") or not self._param.memory_ids:
return True, "No memory selected."
+ user_id = self._param.user_id if hasattr(self._param, "user_id") else ""
+ if user_id:
+ import re
+ # is variable
+ if re.match(r"^{.*}$", user_id):
+ user_id = self._canvas.get_variable_value(user_id)
+
message_dict = {
- "user_id": self._param.user_id if hasattr(self._param, "user_id") else "",
+ "user_id": user_id,
"agent_id": self._canvas._id,
"session_id": self._canvas.task_id,
"user_input": self._canvas.get_sys_query(),
diff --git a/agent/tools/retrieval.py b/agent/tools/retrieval.py
index 6fde0a2cc8..a09a1df37c 100644
--- a/agent/tools/retrieval.py
+++ b/agent/tools/retrieval.py
@@ -273,6 +273,10 @@ class Retrieval(ToolBase, ABC):
# query message
filter_dict: dict = {"memory_id": memory_ids}
if user_id:
+ import re
+ # is variable
+ if re.match(r"^{.*}$", user_id):
+ user_id = self._canvas.get_variable_value(user_id)
filter_dict["user_id"] = user_id
message_list = memory_message_service.query_message(filter_dict, {
"query": query,