🌟 The Multi-Agent Framework: First AI Software Company, Towards Natural Language Programming
update globals with function tools.
刘棒棒52b8ba84d32d
diff --git a/metagpt/tools/functions/libs/udf/__init__.py b/metagpt/tools/functions/libs/udf/__init__.pyindex b74ae2ab9..5d9c35b27 100644--- a/metagpt/tools/functions/libs/udf/__init__.py+++ b/metagpt/tools/functions/libs/udf/__init__.py@@ -29,6 +29,8 @@ def extract_function_signatures(file_path):# 导入函数module_name = Path(file_path).parts[-1][:-len(Path(file_path).suffix)]module = importlib.import_module(f"metagpt.tools.functions.libs.udf.{module_name}")+ # 将函数导入到当前命名空间+ globals().update({function_name: getattr(module, function_name)})# 获取函数注释和函数路径function_schema = {'udf_name': function_signature,'udf_path': f'from metagpt.tools.functions.libs.udf.{module_name} import {function_name}',