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