From c482179850db1248ead3af1693f9ea224a40524e Mon Sep 17 00:00:00 2001 From: QuantumGhost Date: Tue, 10 Jun 2025 15:19:36 +0800 Subject: [PATCH] feat(api): conditionally add chatflow-specific variables to system inputs --- api/services/workflow_service.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/api/services/workflow_service.py b/api/services/workflow_service.py index 349c9f4af0..129ea10141 100644 --- a/api/services/workflow_service.py +++ b/api/services/workflow_service.py @@ -669,18 +669,24 @@ def _setup_variable_pool( # Create a variable pool. system_inputs = { # From inputs: - SystemVariableKey.QUERY: query, SystemVariableKey.FILES: files, SystemVariableKey.USER_ID: user_id, - # From sysvar - SystemVariableKey.CONVERSATION_ID: conversation_id, - SystemVariableKey.DIALOGUE_COUNT: 0, # From workflow model SystemVariableKey.APP_ID: workflow.app_id, SystemVariableKey.WORKFLOW_ID: workflow.id, # Randomly generated. SystemVariableKey.WORKFLOW_EXECUTION_ID: str(uuid.uuid4()), } + + # Only add chatflow-specific variables for non-workflow types + if workflow.type != WorkflowType.WORKFLOW.value: + system_inputs.update( + { + SystemVariableKey.QUERY: query, + SystemVariableKey.CONVERSATION_ID: conversation_id, + SystemVariableKey.DIALOGUE_COUNT: 0, + } + ) else: system_inputs = {}