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
+12 -12
View File
@@ -306,15 +306,15 @@ mod tests {
#[test]
fn deduplicates_active_provider_api_formats() {
let endpoints = vec![
sample_endpoint("openai:cli", true),
sample_endpoint("openai:responses", true),
sample_endpoint("openai:image", true),
sample_endpoint("openai:cli", true),
sample_endpoint("openai:compact", false),
sample_endpoint("openai:responses", true),
sample_endpoint("openai:responses:compact", false),
];
assert_eq!(
provider_active_api_formats(&endpoints),
vec!["openai:cli".to_string(), "openai:image".to_string()]
vec!["openai:responses".to_string(), "openai:image".to_string()]
);
}
@@ -322,14 +322,14 @@ mod tests {
fn fixed_oauth_key_with_null_formats_inherits_provider_formats() {
let key = sample_key("oauth");
let endpoints = vec![
sample_endpoint("openai:cli", true),
sample_endpoint("openai:responses", true),
sample_endpoint("openai:image", true),
];
assert!(provider_key_inherits_provider_api_formats(&key, "codex"));
assert_eq!(
provider_key_effective_api_formats(&key, "codex", &endpoints),
vec!["openai:cli".to_string(), "openai:image".to_string()]
vec!["openai:responses".to_string(), "openai:image".to_string()]
);
}
@@ -338,34 +338,34 @@ mod tests {
let mut key = sample_key("oauth");
key.api_formats = Some(json!(["openai:compact"]));
let endpoints = vec![
sample_endpoint("openai:cli", true),
sample_endpoint("openai:responses", true),
sample_endpoint("openai:image", true),
];
assert!(provider_key_inherits_provider_api_formats(&key, "codex"));
assert_eq!(
provider_key_effective_api_formats(&key, "codex", &endpoints),
vec!["openai:cli".to_string(), "openai:image".to_string()]
vec!["openai:responses".to_string(), "openai:image".to_string()]
);
}
#[test]
fn explicit_formats_do_not_inherit_for_non_fixed_key() {
let mut key = sample_key("oauth");
key.api_formats = Some(json!(["openai:compact"]));
key.api_formats = Some(json!(["openai:responses:compact"]));
let endpoints = vec![
sample_endpoint("openai:cli", true),
sample_endpoint("openai:responses", true),
sample_endpoint("openai:image", true),
];
assert!(!provider_key_inherits_provider_api_formats(&key, "openai"));
assert_eq!(
provider_key_configured_api_formats(&key),
vec!["openai:compact".to_string()]
vec!["openai:responses:compact".to_string()]
);
assert_eq!(
provider_key_effective_api_formats(&key, "openai", &endpoints),
vec!["openai:compact".to_string()]
vec!["openai:responses:compact".to_string()]
);
}
}