From 9d6f9ac952789b1cfd950755836a25ebd30a5255 Mon Sep 17 00:00:00 2001 From: Zhicheng Zhang Date: Wed, 15 May 2024 14:14:48 +0800 Subject: [PATCH] fix tool import bugs (#438) --- modelscope_agent/agent.py | 2 +- modelscope_agent/tools/base.py | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/modelscope_agent/agent.py b/modelscope_agent/agent.py index f23935b0d..912004705 100644 --- a/modelscope_agent/agent.py +++ b/modelscope_agent/agent.py @@ -124,7 +124,7 @@ def _register_tool(self, # check if the tenant_id of tool instance or tool service are exists # TODO: change from use_tool_api=True to False, to get the tenant_id of the tool changes to - if tenant_id in tool_class_with_tenant: + if tenant_id in tool_class_with_tenant and self.use_tool_api: return try: diff --git a/modelscope_agent/tools/base.py b/modelscope_agent/tools/base.py index f17c11d21..4a730ce85 100644 --- a/modelscope_agent/tools/base.py +++ b/modelscope_agent/tools/base.py @@ -118,9 +118,7 @@ def __contains__(self, key): def register_tool(name): def decorator(cls): - if name not in TOOL_REGISTRY: - TOOL_REGISTRY[name] = {} - TOOL_REGISTRY[name]['class'] = cls + TOOL_REGISTRY[name] = {'class': cls} return cls return decorator