mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
centralize openai responses alias handling
This commit is contained in:
@@ -570,11 +570,7 @@ fn wildcard_matches(pattern: &str, model_id: &str) -> bool {
|
||||
}
|
||||
|
||||
fn normalize_api_format(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(),
|
||||
}
|
||||
aether_ai_formats::normalize_legacy_openai_format_alias(value)
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -381,14 +381,12 @@ fn apply_fetch_header_rules(
|
||||
}
|
||||
|
||||
fn standard_models_fetch_headers(api_format: &str) -> BTreeMap<String, String> {
|
||||
let api_format = api_format.trim().to_ascii_lowercase();
|
||||
let api_format = aether_ai_formats::normalize_legacy_openai_format_alias(api_format);
|
||||
match api_format.as_str() {
|
||||
"openai:responses" | "openai:responses:compact" | "openai:cli" | "openai:compact" => {
|
||||
BTreeMap::from([(
|
||||
"user-agent".to_string(),
|
||||
OPENAI_RESPONSES_USER_AGENT.to_string(),
|
||||
)])
|
||||
}
|
||||
"openai:responses" | "openai:responses:compact" => BTreeMap::from([(
|
||||
"user-agent".to_string(),
|
||||
OPENAI_RESPONSES_USER_AGENT.to_string(),
|
||||
)]),
|
||||
"claude:chat" => BTreeMap::from([(
|
||||
"anthropic-version".to_string(),
|
||||
CLAUDE_VERSION_HEADER.to_string(),
|
||||
|
||||
Reference in New Issue
Block a user