Skip to content

Commit 4550f72

Browse files
authored
fix: Workflow cannot respond to errors (#1899)
1 parent 32e5c81 commit 4550f72

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

apps/application/flow/workflow_manage.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,6 @@ def __init__(self, flow: Flow, params, work_flow_post_handler: WorkFlowPostHandl
263263
self.audio_list = audio_list
264264
self.params = params
265265
self.flow = flow
266-
self.lock = threading.Lock()
267266
self.context = {}
268267
self.node_chunk_manage = NodeChunkManage(self)
269268
self.work_flow_post_handler = work_flow_post_handler
@@ -391,6 +390,8 @@ def run_chain_manage(self, current_node, node_result_future):
391390
start_node = self.get_start_node()
392391
current_node = get_node(start_node.type)(start_node, self.params, self)
393392
result = self.run_chain(current_node, node_result_future)
393+
if result is None:
394+
return
394395
node_list = self.get_next_node_list(current_node, result)
395396
if len(node_list) == 1:
396397
self.run_chain_manage(node_list[0], None)
@@ -424,7 +425,7 @@ def run_chain(self, current_node, node_result_future=None):
424425
return result
425426
except Exception as e:
426427
traceback.print_exc()
427-
return []
428+
return None
428429

429430
def hand_node_result(self, current_node, node_result_future):
430431
try:
@@ -507,7 +508,6 @@ def hand_event_node_result(self, current_node, node_result_future):
507508
# 添加节点
508509
self.append_node(current_node)
509510
traceback.print_exc()
510-
self.answer += str(e)
511511
chunk = self.base_to_response.to_stream_chunk_response(self.params['chat_id'],
512512
self.params['chat_record_id'],
513513
current_node.id,
@@ -524,6 +524,7 @@ def hand_event_node_result(self, current_node, node_result_future):
524524
node_chunk.end(chunk)
525525
current_node.get_write_error_context(e)
526526
self.status = 500
527+
return None
527528

528529
def run_node_async(self, node):
529530
future = executor.submit(self.run_node, node)

0 commit comments

Comments
 (0)