migrate ai format conversion to responses adapters

This commit is contained in:
fawney19
2026-04-26 23:59:53 +08:00
parent e36fb8c07a
commit 5b914aa78c
183 changed files with 13539 additions and 3401 deletions
@@ -328,11 +328,8 @@ fn resolve_fixed_provider_endpoint_template<'a>(
}
template.endpoints.iter().find(|item| {
item.api_format
.eq_ignore_ascii_case(updated_endpoint.api_format.trim())
|| item
.api_format
.eq_ignore_ascii_case(existing_endpoint.api_format.trim())
api_format_matches(item.api_format, updated_endpoint.api_format.trim())
|| api_format_matches(item.api_format, existing_endpoint.api_format.trim())
})
}
@@ -349,6 +346,19 @@ fn endpoint_matches_fixed_provider_template(
.api_format
.trim()
.eq_ignore_ascii_case(endpoint_template.api_format)
|| api_format_matches(&endpoint.api_format, endpoint_template.api_format)
}
fn normalize_api_format_alias(value: &str) -> String {
match value.trim().to_ascii_lowercase().as_str() {
"openai:cli" => "openai:responses".to_string(),
"openai:compact" => "openai:responses:compact".to_string(),
other => other.to_string(),
}
}
fn api_format_matches(left: &str, right: &str) -> bool {
normalize_api_format_alias(left) == normalize_api_format_alias(right)
}
fn fixed_provider_endpoint_metadata(