Skip to content

Commit 82701e7

Browse files
committed
fix: include default values in parameter initialization
--bug=1060961 --user=刘瑞斌 【工具优化】在“启动参数”设置中保存默认值后,应用内调用时可直接使用预设的默认参数,无需在工具中每次单独设置,简化操作流程。 https://www.tapd.cn/62980211/s/1764217
1 parent 7ee33b8 commit 82701e7

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

apps/application/flow/step_node/tool_lib_node/impl/base_tool_lib_node.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,11 @@ def execute(self, tool_lib_id, input_field_list, **kwargs) -> NodeResult:
147147

148148
self.context['params'] = params
149149
# 合并初始化参数
150+
init_params_default_value = {i["field"]: i.get('default_value') for i in tool_lib.init_field_list}
150151
if tool_lib.init_params is not None:
151-
all_params = json.loads(rsa_long_decrypt(tool_lib.init_params)) | params
152+
all_params = init_params_default_value | json.loads(rsa_long_decrypt(tool_lib.init_params)) | params
152153
else:
153-
all_params = params
154+
all_params = init_params_default_value | params
154155
result = function_executor.exec_code(tool_lib.code, all_params)
155156
return NodeResult({'result': result}, {}, _write_context=write_context)
156157

0 commit comments

Comments
 (0)