feat: mypy for all type check (#10921)

This commit is contained in:
yihong 2024-12-24 18:38:51 +08:00 • committed by GitHub
commit 56e15d09a9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
584 changed files with 3975 additions and 2826 deletions

View file

@ -50,8 +50,8 @@ class BuiltinToolManageService:
credentials = builtin_provider.credentials
credentials = tool_provider_configurations.decrypt_tool_credentials(credentials)
result = []
for tool in tools:
result: list[UserTool] = []
for tool in tools or []:
result.append(
ToolTransformService.tool_to_user_tool(
tool=tool,
@ -217,6 +217,8 @@ class BuiltinToolManageService:
name_func=lambda x: x.identity.name,
):
continue
if provider_controller.identity is None:
continue
# convert provider controller to user provider
user_builtin_provider = ToolTransformService.builtin_provider_to_user_provider(
@ -229,7 +231,7 @@ class BuiltinToolManageService:
ToolTransformService.repack_provider(user_builtin_provider)
tools = provider_controller.get_tools()
for tool in tools:
for tool in tools or []:
user_builtin_provider.tools.append(
ToolTransformService.tool_to_user_tool(
tenant_id=tenant_id,