fix(1.0): unexpected error raise (#12812)

This commit is contained in:
非法操作
2025-01-21 10:04:56 +08:00
committed by GitHub
parent 60427f1adf
commit de4752a16b
2 changed files with 7 additions and 3 deletions

View File

@ -48,7 +48,9 @@ class PluginToolProviderController(BuiltinToolProviderController):
"""
return tool with given name
"""
tool_entity = next(tool_entity for tool_entity in self.entity.tools if tool_entity.identity.name == tool_name)
tool_entity = next(
(tool_entity for tool_entity in self.entity.tools if tool_entity.identity.name == tool_name), None
)
if not tool_entity:
raise ValueError(f"Tool with name {tool_name} not found")