|
|
@@ -25,14 +25,24 @@ def get_all_tools() -> List[BaseTool]:
|
|
|
|
|
|
# 扫描工具文件
|
|
|
tool_files = []
|
|
|
+ # 模式1: 编译前的.py文件
|
|
|
for file_path in tools_dir.glob("*_tools.py"):
|
|
|
if file_path.is_file():
|
|
|
module_name = file_path.stem
|
|
|
tool_files.append(module_name)
|
|
|
print(f"📦 发现工具文件: {module_name}")
|
|
|
|
|
|
+ # 模式2: 编译后的.pyd文件
|
|
|
+ for file_path in tools_dir.glob("*_tools.cp*.pyd"):
|
|
|
+ if file_path.is_file():
|
|
|
+ # 从文件名中提取模块名,如: ware_tools.cp313-win_amd64.pyd -> ware_tools
|
|
|
+ module_name = file_path.stem.split(".")[0]
|
|
|
+ if module_name not in tool_files: # 避免重复添加
|
|
|
+ tool_files.append(module_name)
|
|
|
+ print(f"📦 发现编译后工具文件: {module_name}")
|
|
|
+
|
|
|
if not tool_files:
|
|
|
- tool_files = ["knowledge_tools", "sale_tools"]
|
|
|
+ tool_files = ["knowledge_tools", "sale_tools", "ware_tools"]
|
|
|
print("⚠️ 使用默认工具列表")
|
|
|
|
|
|
for module_name in tool_files:
|