Skip to content

refactor: Improve parameter handling in function execution #2596

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ def execute(self, function_lib_id, input_field_list, **kwargs) -> NodeResult:

self.context['params'] = params
# 合并初始化参数
all_params = json.loads(rsa_long_decrypt(function_lib.init_params)) | params
if function_lib.init_params is not None:
all_params = json.loads(rsa_long_decrypt(function_lib.init_params)) | params
else:
all_params = params
result = function_executor.exec_code(function_lib.code, all_params)
return NodeResult({'result': result}, {}, _write_context=write_context)

Expand Down
7 changes: 5 additions & 2 deletions apps/function_lib/serializers/function_lib_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,11 @@ def debug(self, debug_instance, with_valid=True):
**field} for field in
input_field_list]}
# 合并初始化参数
params = init_params | params
return function_executor.exec_code(code, params)
if init_params is not None:
all_params = init_params | params
else:
all_params = params
return function_executor.exec_code(code, all_params)

@staticmethod
def get_field_value(debug_field_list, name, is_required):
Expand Down