@@ -342,7 +342,7 @@ def handle_multipart(self, message: dict) -> bytes:
342342 recv_data = b'' .join (recv_bytes )
343343 return recv_data
344344
345- def load_user_code (self , settings : dict ) -> str :
345+ def load_user_code (self , settings : dict , path : str = "." ) -> str :
346346 """
347347 Load and prepare the User Code for sending. This entails reading
348348 the Python files, encoding them to JSON strings and providing
@@ -358,10 +358,10 @@ def load_user_code(self, settings: dict) -> str:
358358 for module_name , module in agent_info ["SoftwareModules" ].items ():
359359 isCustomModule , isCustomAlgo = self .query_supported_module_list (module_name , module ["Algorithm" ]["ClassName" ])
360360 if isCustomAlgo :
361- with open ("user_code/{}/{}.py" .format (agent_name , module ["Algorithm" ]["ClassName" ]), "r" ) as file :
361+ with open ("{}/ user_code/{}/{}.py" .format (path , agent_name , module ["Algorithm" ]["ClassName" ]), "r" ) as file :
362362 user_code [agent_name ][module_name ] = {"Code" : json .dumps (file .read ()), "AlgorithmName" : module ["Algorithm" ]["ClassName" ]}
363363 elif isCustomModule :
364- with open ("user_code/{}/{}.py" .format (agent_name , module_name ), "r" ) as file :
364+ with open ("{}/ user_code/{}/{}.py" .format (path , agent_name , module_name ), "r" ) as file :
365365 user_code [agent_name ][module_name ] = {"Code" : json .dumps (file .read ()), "AlgorithmName" : module ["Algorithm" ]["ClassName" ]}
366366
367367 return user_code
0 commit comments