fix: allow duplicate tool providers

This commit is contained in:
Yeuoly 2024-09-24 16:33:19 +08:00
parent 1907d791e1
commit 9722e6bcb1
No known key found for this signature in database
GPG Key ID: A66E7E320FB19F61
2 changed files with 10 additions and 3 deletions

View File

@ -38,4 +38,4 @@ class PluginTool(Tool):
runtime=runtime,
tenant_id=self.tenant_id,
plugin_unique_identifier=self.plugin_unique_identifier,
)
)

View File

@ -485,7 +485,7 @@ class ToolManager:
return cls._builtin_tools_labels[tool_name]
@classmethod
def user_list_providers(
def list_providers_from_api(
cls, user_id: str, tenant_id: str, typ: ToolProviderTypeApiLiteral
) -> list[ToolProviderApiEntity]:
result_providers: dict[str, ToolProviderApiEntity] = {}
@ -526,7 +526,14 @@ class ToolManager:
decrypt_credentials=False,
)
result_providers[provider.entity.identity.name] = user_provider
if isinstance(provider, PluginToolProviderController):
result_providers[f"plugin_provider.{user_provider.name}.{provider.plugin_unique_identifier}"] = (
user_provider
)
else:
result_providers[f"builtin_provider.{user_provider.name}"] = (
user_provider
)
# get db api providers