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(workflow): missing content in the answer node stream output during iterations (#8292)

takatost56c90e212a1b
diff --git a/api/core/rag/extractor/word_extractor.py b/api/core/rag/extractor/word_extractor.py
index c6f15e55b65..947644a90b1 100644
--- a/api/core/rag/extractor/word_extractor.py
+++ b/api/core/rag/extractor/word_extractor.py
@@ -7,8 +7,8 @@ import os
import re
import tempfile
import uuid
-import xml.etree.ElementTree as ET
from urllib.parse import urlparse
+from xml.etree import ElementTree
import requests
from docx import Document as DocxDocument
@@ -218,7 +218,7 @@ class WordExtractor(BaseExtractor):
hyperlinks_url = None
if "HYPERLINK" in run.element.xml:
try:
- xml = ET.XML(run.element.xml)
+ xml = ElementTree.XML(run.element.xml)
x_child = [c for c in xml.iter() if c is not None]
for x in x_child:
if x_child is None:
diff --git a/api/core/workflow/nodes/iteration/iteration_node.py b/api/core/workflow/nodes/iteration/iteration_node.py
index 77b14e36a19..4d944e93db2 100644
--- a/api/core/workflow/nodes/iteration/iteration_node.py
+++ b/api/core/workflow/nodes/iteration/iteration_node.py
@@ -16,6 +16,7 @@ from core.workflow.graph_engine.entities.event import (
IterationRunNextEvent,
IterationRunStartedEvent,
IterationRunSucceededEvent,
+ NodeRunStreamChunkEvent,
NodeRunSucceededEvent,
)
from core.workflow.graph_engine.entities.graph import Graph
@@ -154,7 +155,11 @@ class IterationNode(BaseNode):
if isinstance(event, (BaseNodeEvent | BaseParallelBranchEvent)) and not event.in_iteration_id:
event.in_iteration_id = self.node_id
- if isinstance(event, BaseNodeEvent) and event.node_type == NodeType.ITERATION_START:
+ if (
+ isinstance(event, BaseNodeEvent)
+ and event.node_type == NodeType.ITERATION_START
+ and not isinstance(event, NodeRunStreamChunkEvent)
+ ):
continue
if isinstance(event, NodeRunSucceededEvent):