tool支持是否启用,更人性化的直接调用

This commit is contained in:
Windpicker-owo
2025-07-28 22:56:52 +08:00
parent 4ac487dd14
commit 8131e65e9e
3 changed files with 33 additions and 4 deletions

View File

@@ -193,10 +193,14 @@ class ComponentRegistry:
def _register_tool_component(self, tool_info: ToolInfo, tool_class: BaseTool):
"""注册Tool组件到Tool特定注册表"""
tool_name = tool_info.name
if not tool_info.enabled:
logger.info(f"Tool组件 {tool_name} 未启用,跳过注册")
return False
self._tool_registry[tool_name] = tool_class
# 如果是llm可用的且启用的工具,添加到 llm可用工具列表
if tool_info.available_for_llm and tool_info.enabled:
# 如果是llm可用的工具,添加到 llm可用工具列表
if tool_info.available_for_llm:
self._llm_available_tools[tool_name] = tool_class
return True