Skip to content

Commit 301785b

Browse files
authored
fix: The tool in the application export loop body has not been exported (#4177)
1 parent e4ac778 commit 301785b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

apps/application/serializers/application.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,10 @@ def export(self, with_valid=True):
683683
application = QuerySet(Application).filter(id=application_id).first()
684684
tool_id_list = [node.get('properties', {}).get('node_data', {}).get('tool_lib_id') for node
685685
in
686-
application.work_flow.get('nodes', []) if
686+
application.work_flow.get('nodes', []) + reduce(lambda x, y: [*x, *y], [
687+
n.get('properties', {}).get('node_data', {}).get('loop_body', {}).get('nodes', []) for n
688+
in
689+
application.work_flow.get('nodes', []) if n.get('type') == 'loop-node'], []) if
687690
node.get('type') == 'tool-lib-node']
688691
tool_list = []
689692
if len(tool_id_list) > 0:
@@ -760,7 +763,7 @@ def publish(self, instance, with_valid=True):
760763
work_flow_version.save()
761764
access_token = hashlib.md5(
762765
str(uuid.uuid7()).encode()).hexdigest()[
763-
8:24]
766+
8:24]
764767
application_access_token = QuerySet(ApplicationAccessToken).filter(
765768
application_id=application.id).first()
766769
if application_access_token is None:
@@ -965,7 +968,8 @@ def speech_to_text(self, instance, debug=True, with_valid=True):
965968
application = QuerySet(ApplicationVersion).filter(application_id=application_id).order_by(
966969
'-create_time').first()
967970
if application.stt_model_enable:
968-
model = get_model_instance_by_model_workspace_id(application.stt_model_id, application.workspace_id, **application.stt_model_params_setting)
971+
model = get_model_instance_by_model_workspace_id(application.stt_model_id, application.workspace_id,
972+
**application.stt_model_params_setting)
969973
text = model.speech_to_text(instance.get('file'))
970974
return text
971975

0 commit comments

Comments
 (0)