Skip to content

Commit efe67e2

Browse files
authored
fix: Progress needs to be printed before node execution (#6147)
1 parent 7bbae90 commit efe67e2

1 file changed

Lines changed: 24 additions & 17 deletions

File tree

apps/application/flow/workflow_manage.py

Lines changed: 24 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ def hand_event_node_result(self, current_node, node_result_future):
419419
child_node = {}
420420
view_type = current_node.view_type
421421
try:
422+
self.send_progress(current_node)
422423
current_result = node_result_future.result()
423424
result = current_result.write_context(current_node, self)
424425
if result is not None:
@@ -477,23 +478,6 @@ def hand_event_node_result(self, current_node, node_result_future):
477478
current_node.node_chunk.add_chunk(chunk)
478479
else:
479480
list(result)
480-
if 'form-node' != current_node.type:
481-
chunk = self.base_to_response.to_stream_chunk_response(self.params.get('chat_id'),
482-
self.params.get('chat_record_id'),
483-
current_node.id,
484-
current_node.up_node_id_list,
485-
'', False, 0, 0,
486-
{'node_type': current_node.type,
487-
'runtime_node_id': runtime_node_id,
488-
'node_name': current_node.node.properties.get(
489-
'stepName'),
490-
'view_type': view_type,
491-
'child_node': child_node,
492-
'node_is_end': True,
493-
'real_node_id': real_node_id,
494-
'reasoning_content': '',
495-
'node_status': "SUCCESS"})
496-
current_node.node_chunk.add_chunk(chunk)
497481
if current_node.status == 500:
498482
enableException = current_node.node.properties.get('enableException')
499483
if not enableException:
@@ -542,6 +526,29 @@ def hand_event_node_result(self, current_node, node_result_future):
542526
# 归还链接到连接池
543527
connection.close()
544528

529+
def send_progress(self, current_node):
530+
runtime_node_id = current_node.runtime_node_id
531+
real_node_id = current_node.runtime_node_id
532+
child_node = {}
533+
view_type = current_node.view_type
534+
if 'form-node' != current_node.type:
535+
chunk = self.base_to_response.to_stream_chunk_response(self.params.get('chat_id'),
536+
self.params.get('chat_record_id'),
537+
current_node.id,
538+
current_node.up_node_id_list,
539+
'', False, 0, 0,
540+
{'node_type': current_node.type,
541+
'runtime_node_id': runtime_node_id,
542+
'node_name': current_node.node.properties.get(
543+
'stepName'),
544+
'view_type': view_type,
545+
'child_node': child_node,
546+
'node_is_end': True,
547+
'real_node_id': real_node_id,
548+
'reasoning_content': '',
549+
'node_status': "SUCCESS"})
550+
current_node.node_chunk.add_chunk(chunk)
551+
545552
def run_node_async(self, node):
546553
future = executor.submit(self.run_node, node)
547554
return future

0 commit comments

Comments
 (0)