fix: uses to check if the tools are already loaded

This commit is contained in:
Yeuoly 2024-11-12 21:43:19 +08:00
parent 56bd0dedfe
commit 5828abcd62
No known key found for this signature in database
GPG Key ID: A66E7E320FB19F61
2 changed files with 4 additions and 4 deletions

View File

@ -148,7 +148,7 @@ class ApiToolProviderController(ToolProviderController):
:param tenant_id: the tenant id
:return: the tools
"""
if self.tools is not None:
if len(self.tools) > 0:
return self.tools
tools: list[ApiTool] = []

View File

@ -159,7 +159,7 @@ class ApiToolManageService:
# encrypt credentials
tool_configuration = ProviderConfigEncrypter(
tenant_id=tenant_id,
config=provider_controller.get_credentials_schema(),
config=list(provider_controller.get_credentials_schema()),
provider_type=provider_controller.provider_type.value,
provider_identity=provider_controller.entity.identity.name,
)
@ -291,7 +291,7 @@ class ApiToolManageService:
# get original credentials if exists
tool_configuration = ProviderConfigEncrypter(
tenant_id=tenant_id,
config=provider_controller.get_credentials_schema(),
config=list(provider_controller.get_credentials_schema()),
provider_type=provider_controller.provider_type.value,
provider_identity=provider_controller.entity.identity.name,
)
@ -410,7 +410,7 @@ class ApiToolManageService:
if db_provider.id:
tool_configuration = ProviderConfigEncrypter(
tenant_id=tenant_id,
config=provider_controller.get_credentials_schema(),
config=list(provider_controller.get_credentials_schema()),
provider_type=provider_controller.provider_type.value,
provider_identity=provider_controller.entity.identity.name,
)