Skip to content

Commit b40336f

Browse files
committed
fix: 修复函数库响应数据在日志中不显示问题 (#1814)
(cherry picked from commit f9437ca)
1 parent ce78192 commit b40336f

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

apps/application/flow/step_node/application_node/impl/base_application_node.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ def write_context_stream(node_variable: Dict, workflow_variable: Dict, node: INo
5252
runtime_node_id = response_content.get('runtime_node_id', '')
5353
chat_record_id = response_content.get('chat_record_id', '')
5454
child_node = response_content.get('child_node')
55+
view_type = response_content.get('view_type')
5556
node_type = response_content.get('node_type')
5657
real_node_id = response_content.get('real_node_id')
5758
node_is_end = response_content.get('node_is_end', False)
@@ -65,7 +66,8 @@ def write_context_stream(node_variable: Dict, workflow_variable: Dict, node: INo
6566
'runtime_node_id': runtime_node_id, 'chat_record_id': chat_record_id,
6667
'child_node': child_node,
6768
'real_node_id': real_node_id,
68-
'node_is_end': node_is_end}
69+
'node_is_end': node_is_end,
70+
'view_type': view_type}
6971
usage = response_content.get('usage', {})
7072
node_variable['result'] = {'usage': usage}
7173
node_variable['is_interrupt_exec'] = is_interrupt_exec

apps/application/flow/step_node/function_lib_node/impl/base_function_lib_node.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def write_context(step_variable: Dict, global_variable: Dict, node, workflow):
2929
if workflow.is_result(node, NodeResult(step_variable, global_variable)) and 'result' in step_variable:
3030
result = str(step_variable['result']) + '\n'
3131
yield result
32-
workflow.answer += result
32+
node.answer_text = result
3333
node.context['run_time'] = time.time() - node.context['start_time']
3434

3535

@@ -94,6 +94,7 @@ class BaseFunctionLibNodeNode(IFunctionLibNode):
9494
def save_context(self, details, workflow_manage):
9595
self.context['result'] = details.get('result')
9696
self.answer_text = details.get('result')
97+
9798
def execute(self, function_lib_id, input_field_list, **kwargs) -> NodeResult:
9899
function_lib = QuerySet(FunctionLib).filter(id=function_lib_id).first()
99100
if not function_lib.is_active:

apps/application/flow/step_node/function_node/impl/base_function_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def write_context(step_variable: Dict, global_variable: Dict, node, workflow):
2727
if workflow.is_result(node, NodeResult(step_variable, global_variable)) and 'result' in step_variable:
2828
result = str(step_variable['result']) + '\n'
2929
yield result
30-
workflow.answer += result
30+
node.answer_text = result
3131
node.context['run_time'] = time.time() - node.context['start_time']
3232

3333

apps/application/flow/workflow_manage.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,21 +454,23 @@ def hand_event_node_result(self, current_node, node_result_future):
454454
content = r
455455
child_node = {}
456456
node_is_end = False
457+
view_type = current_node.view_type
457458
if isinstance(r, dict):
458459
content = r.get('content')
459460
child_node = {'runtime_node_id': r.get('runtime_node_id'),
460461
'chat_record_id': r.get('chat_record_id')
461462
, 'child_node': r.get('child_node')}
462463
real_node_id = r.get('real_node_id')
463464
node_is_end = r.get('node_is_end')
465+
view_type = r.get('view_type')
464466
chunk = self.base_to_response.to_stream_chunk_response(self.params['chat_id'],
465467
self.params['chat_record_id'],
466468
current_node.id,
467469
current_node.up_node_id_list,
468470
content, False, 0, 0,
469471
{'node_type': current_node.type,
470472
'runtime_node_id': current_node.runtime_node_id,
471-
'view_type': current_node.view_type,
473+
'view_type': view_type,
472474
'child_node': child_node,
473475
'node_is_end': node_is_end,
474476
'real_node_id': real_node_id})

0 commit comments

Comments
 (0)