Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

Fix missing user_id in trace_manager (#24024)

Yongtao Huang8b601a983cf5
diff --git a/api/core/app/apps/chat/app_generator.py b/api/core/app/apps/chat/app_generator.py
index 0c76cc39ae5..c273776eb19 100644
--- a/api/core/app/apps/chat/app_generator.py
+++ b/api/core/app/apps/chat/app_generator.py
@@ -140,7 +140,9 @@ class ChatAppGenerator(MessageBasedAppGenerator):
)
# get tracing instance
- trace_manager = TraceQueueManager(app_id=app_model.id)
+ trace_manager = TraceQueueManager(
+ app_id=app_model.id, user_id=user.id if isinstance(user, Account) else user.session_id
+ )
# init application generate entity
application_generate_entity = ChatAppGenerateEntity(
diff --git a/api/core/app/apps/completion/app_generator.py b/api/core/app/apps/completion/app_generator.py
index 9356bd1cea0..64dade2968d 100644
--- a/api/core/app/apps/completion/app_generator.py
+++ b/api/core/app/apps/completion/app_generator.py
@@ -124,7 +124,9 @@ class CompletionAppGenerator(MessageBasedAppGenerator):
)
# get tracing instance
- trace_manager = TraceQueueManager(app_model.id)
+ trace_manager = TraceQueueManager(
+ app_id=app_model.id, user_id=user.id if isinstance(user, Account) else user.session_id
+ )
# init application generate entity
application_generate_entity = CompletionAppGenerateEntity(