enhancement: reduce requests to plugin daemon

This commit is contained in:
Yeuoly 2024-09-29 17:07:40 +08:00
parent e9e5c8806a
commit 957ab093c9
No known key found for this signature in database
GPG Key ID: A66E7E320FB19F61

View File

@ -123,12 +123,13 @@ class ToolManager:
:return: the tool :return: the tool
""" """
if provider_type == ToolProviderType.BUILT_IN: if provider_type == ToolProviderType.BUILT_IN:
builtin_tool = cls.get_builtin_tool(provider_id, tool_name, tenant_id)
if not builtin_tool:
raise ValueError(f"tool {tool_name} not found")
# check if the builtin tool need credentials # check if the builtin tool need credentials
provider_controller = cls.get_builtin_provider(provider_id, tenant_id) provider_controller = cls.get_builtin_provider(provider_id, tenant_id)
builtin_tool = provider_controller.get_tool(tool_name)
if not builtin_tool:
raise ToolProviderNotFoundError(f"builtin tool {tool_name} not found")
if not provider_controller.need_credentials: if not provider_controller.need_credentials:
return cast( return cast(
BuiltinTool, BuiltinTool,