code tweak -Jakub's comment

This commit is contained in:
Kayla Man 2024-05-06 20:01:17 +08:00
parent e669ac7ab2
commit 037edc3722

View file

@ -286,12 +286,15 @@ def prepare_app_environments(
# Add tools environments
groups_by_name = {}
tool_by_group_name = collections.defaultdict(dict)
tools = None
if task_entity:
# Make sure each tool group can be added only once
tools_group_by_entity = task_entity["attrib"].get("tools")
if folder_entity and not tools_group_by_entity:
tools_group_by_entity = folder_entity["attrib"].get("tools")
for key in tools_group_by_entity or []:
tools = task_entity["attrib"].get("tools")
if tools is None and folder_entity:
tools = folder_entity["attrib"].get("tools")
if tools:
for key in tools:
tool = app.manager.tools.get(key)
if not tool or not tool.is_valid_for_app(app):
continue