@@ -251,6 +251,15 @@ def tool_exec_record(self, tool_lib, all_params):
251251 task_record_id = uuid .uuid7 ()
252252 start_time = time .time ()
253253 try :
254+ # 过滤掉 tool_init_params 中的参数
255+ tool_init_params = json .loads (rsa_long_decrypt (tool_lib .init_params ))
256+ if tool_init_params :
257+ filtered_args = {
258+ k : v for k , v in all_params .items ()
259+ if k not in tool_init_params
260+ }
261+ else :
262+ filtered_args = all_params
254263 ToolRecord (
255264 id = task_record_id ,
256265 workspace_id = tool_lib .workspace_id ,
@@ -259,7 +268,7 @@ def tool_exec_record(self, tool_lib, all_params):
259268 'knowledge_id' ) else ToolTaskTypeChoices .APPLICATION .value ,
260269 source_id = self .workflow_manage .params .get ('knowledge_id' ) or self .workflow_manage .params .get (
261270 'application_id' ),
262- meta = {'input' : all_params , 'output' : {}},
271+ meta = {'input' : filtered_args , 'output' : {}},
263272 state = State .STARTED
264273 ).save ()
265274
@@ -268,7 +277,7 @@ def tool_exec_record(self, tool_lib, all_params):
268277 QuerySet (ToolRecord ).filter (id = task_record_id ).update (
269278 state = State .SUCCESS ,
270279 run_time = time .time () - start_time ,
271- meta = {'input' : all_params , 'output' : result_dict }
280+ meta = {'input' : filtered_args , 'output' : result_dict }
272281 )
273282
274283 return result
@@ -277,7 +286,7 @@ def tool_exec_record(self, tool_lib, all_params):
277286 QuerySet (ToolRecord ).filter (id = task_record_id ).update (
278287 state = State .FAILURE ,
279288 run_time = time .time () - start_time ,
280- meta = {'input' : all_params , 'output' : 'Error: ' + str (e )}
289+ meta = {'input' : filtered_args , 'output' : 'Error: ' + str (e )}
281290 )
282291
283292 def upload_knowledge_file (self , file ):
0 commit comments