fix: api tool encoding (#2296)

This commit is contained in:
Yeuoly 2024-01-30 22:22:58 +08:00 committed by GitHub
commit 6d24a2cb87
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 29 additions and 6 deletions

View file

@ -485,10 +485,10 @@ class ToolManageService:
if schema_type not in [member.value for member in ApiProviderSchemaType]:
raise ValueError(f'invalid schema type {schema_type}')
if schema_type == ApiProviderSchemaType.OPENAPI.value:
tool_bundles = ApiBasedToolSchemaParser.parse_openapi_yaml_to_tool_bundle(schema)
else:
raise ValueError(f'invalid schema type {schema_type}')
try:
tool_bundles, _ = ApiBasedToolSchemaParser.auto_parse_to_tool_bundle(schema)
except Exception as e:
raise ValueError(f'invalid schema')
# get tool bundle
tool_bundle = next(filter(lambda tb: tb.operation_id == tool_name, tool_bundles), None)