mirror of
https://github.com/yuruotong1/autoMate.git
synced 2026-03-22 13:07:17 +08:00
25 lines
949 B
Python
25 lines
949 B
Python
from tools.FindDesktopPath import FindDesktopPath
|
|
from tools.ListAllFile import ListAllFile
|
|
from tools.ListDesktopFiles import ListDesktopFiles
|
|
from tools.OpenApplication import OpenApplicationAction
|
|
from langchain.tools import StructuredTool
|
|
from utils.global_util import GlobalUtil
|
|
|
|
|
|
class ToolsUtil:
|
|
@staticmethod
|
|
def get_tools():
|
|
print("get_tools")
|
|
action_tools = []
|
|
# 从 function_list 中生成工具
|
|
for edit_page in GlobalUtil.edit_page_global:
|
|
# 动态生成 langchain 工具
|
|
langchain_tools = StructuredTool.from_function(
|
|
func=edit_page.run_action,
|
|
name=edit_page.func_name,
|
|
description=edit_page.func_description,
|
|
return_direct=True)
|
|
action_tools.append(langchain_tools)
|
|
print(action_tools)
|
|
return [OpenApplicationAction(), FindDesktopPath(), ListAllFile(), ListDesktopFiles()] + action_tools
|