mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-04-30 15:27:48 +08:00
Fix: get user_id from variables (#13716)
### What problem does this PR solve?
Get user_id from canvas variable when input a {} pattern value.
### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -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(),
|
||||
|
||||
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user