fix: avoid llm node result var not init issue while do retry. (#14286)

This commit is contained in:
Jacky Wu 2025-03-11 12:43:24 +08:00 committed by GitHub
parent 49d0acd188
commit ed5596a8f4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -94,6 +94,9 @@ class LLMNode(BaseNode[LLMNodeData]):
def _run(self) -> Generator[NodeEvent | InNodeEvent, None, None]:
node_inputs: Optional[dict[str, Any]] = None
process_data = None
result_text = ""
usage = LLMUsage.empty_usage()
finish_reason = None
try:
# init messages template
@ -178,9 +181,6 @@ class LLMNode(BaseNode[LLMNodeData]):
stop=stop,
)
result_text = ""
usage = LLMUsage.empty_usage()
finish_reason = None
for event in generator:
if isinstance(event, RunStreamChunkEvent):
yield event