mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
migrate ai format conversion to responses adapters
This commit is contained in:
@@ -253,7 +253,11 @@ pub fn extract_global_priority_for_format(
|
||||
}
|
||||
|
||||
pub fn normalize_api_format(value: &str) -> String {
|
||||
value.trim().to_ascii_lowercase()
|
||||
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 row_has_candidate_model_name(
|
||||
@@ -273,7 +277,7 @@ fn row_has_candidate_model_name(
|
||||
}
|
||||
|
||||
fn api_format_matches(left: &str, right: &str) -> bool {
|
||||
left.trim().eq_ignore_ascii_case(right.trim())
|
||||
normalize_api_format(left) == normalize_api_format(right)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -732,7 +732,7 @@ mod tests {
|
||||
"endpoint_id": "endpoint-1",
|
||||
"key_id": "catalog-key-1",
|
||||
"client_api_format": "openai:chat",
|
||||
"provider_api_format": "openai:cli",
|
||||
"provider_api_format": "openai:responses",
|
||||
"header_rules": [
|
||||
{"op": "set", "name": "x-test", "value": "1"}
|
||||
],
|
||||
@@ -878,7 +878,7 @@ mod tests {
|
||||
"user_id": "user-1",
|
||||
"api_key_id": "api-key-1",
|
||||
"client_api_format": "openai:chat",
|
||||
"provider_api_format": "openai:cli",
|
||||
"provider_api_format": "openai:responses",
|
||||
"upstream_url": "https://example.com/v1/responses",
|
||||
"mapped_model": "gpt-5-upstream",
|
||||
"key_name": "primary"
|
||||
@@ -906,7 +906,7 @@ mod tests {
|
||||
.extra_data
|
||||
.as_ref()
|
||||
.and_then(|value| value.get("provider_api_format")),
|
||||
Some(&json!("openai:cli"))
|
||||
Some(&json!("openai:responses"))
|
||||
);
|
||||
assert_eq!(
|
||||
record
|
||||
|
||||
Reference in New Issue
Block a user