Skip to content

Commit 2620495

Browse files
committed
fix(llm_node): Fallback to sys.query if query_prompt_template not exists.
Signed-off-by: -LAN- <[email protected]>
1 parent ae3a2cb commit 2620495

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

api/core/workflow/nodes/llm/node.py

+8-3
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
ObjectSegment,
3939
StringSegment,
4040
)
41+
from core.workflow.constants import SYSTEM_VARIABLE_NODE_ID
4142
from core.workflow.entities.node_entities import NodeRunMetadataKey, NodeRunResult
4243
from core.workflow.entities.variable_entities import VariableSelector
4344
from core.workflow.entities.variable_pool import VariablePool
@@ -133,11 +134,15 @@ def _run(self) -> NodeRunResult | Generator[NodeEvent | InNodeEvent, None, None]
133134
# fetch memory
134135
memory = self._fetch_memory(node_data_memory=self.node_data.memory, model_instance=model_instance)
135136

136-
# fetch prompt messages
137+
query = None
137138
if self.node_data.memory:
138139
query = self.node_data.memory.query_prompt_template
139-
else:
140-
query = None
140+
if query is None and (
141+
query_variable := self.graph_runtime_state.variable_pool.get(
142+
(SYSTEM_VARIABLE_NODE_ID, SystemVariableKey.QUERY)
143+
)
144+
):
145+
query = query_variable.text
141146

142147
prompt_messages, stop = self._fetch_prompt_messages(
143148
user_query=query,

0 commit comments

Comments
 (0)