mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-12 22:20:19 +08:00
feat(openai): align GPT-5.6 and Codex request contracts
This commit is contained in:
@@ -2222,6 +2222,6 @@ mod tests {
|
||||
build_user_leaderboard_items(&[item], &BTreeMap::new(), false, false, false);
|
||||
|
||||
assert_eq!(leaderboard.len(), 1);
|
||||
assert_eq!(leaderboard[0].tokens, 140);
|
||||
assert_eq!(leaderboard[0].tokens, 120);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3435,7 +3435,7 @@ mod tests {
|
||||
assert_eq!(payload["cache_creation_input_tokens"], 20);
|
||||
assert_eq!(payload["cache_creation_ephemeral_5m_input_tokens"], 12);
|
||||
assert_eq!(payload["cache_creation_ephemeral_1h_input_tokens"], 8);
|
||||
assert_eq!(payload["total_tokens"], 50);
|
||||
assert_eq!(payload["total_tokens"], 40);
|
||||
}
|
||||
|
||||
#[test]
|
||||
@@ -3451,7 +3451,7 @@ mod tests {
|
||||
..sample_usage("completed", Some(200), None)
|
||||
};
|
||||
|
||||
assert_eq!(admin_usage_total_tokens(&item), 140);
|
||||
assert_eq!(admin_usage_total_tokens(&item), 120);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
||||
@@ -217,6 +217,14 @@ fn extract_openai_chatgpt_auth_fields_from_object(
|
||||
result.insert("user_id".to_string(), json!(user_id));
|
||||
}
|
||||
|
||||
if let Some(is_fedramp) = auth
|
||||
.and_then(|value| value.get("chatgpt_account_is_fedramp"))
|
||||
.and_then(Value::as_bool)
|
||||
.or_else(|| source.get("is_fedramp").and_then(Value::as_bool))
|
||||
{
|
||||
result.insert("is_fedramp".to_string(), json!(is_fedramp));
|
||||
}
|
||||
|
||||
if let Some(organizations) = auth
|
||||
.and_then(|value| value.get("organizations"))
|
||||
.and_then(Value::as_array)
|
||||
@@ -250,6 +258,7 @@ pub fn enrich_admin_provider_oauth_auth_config(
|
||||
"plan_type",
|
||||
"user_id",
|
||||
"account_name",
|
||||
"is_fedramp",
|
||||
],
|
||||
);
|
||||
|
||||
@@ -268,6 +277,7 @@ pub fn enrich_admin_provider_oauth_auth_config(
|
||||
"plan_type",
|
||||
"user_id",
|
||||
"organizations",
|
||||
"is_fedramp",
|
||||
],
|
||||
);
|
||||
|
||||
@@ -288,6 +298,7 @@ pub fn enrich_admin_provider_oauth_auth_config(
|
||||
"plan_type",
|
||||
"user_id",
|
||||
"account_name",
|
||||
"is_fedramp",
|
||||
],
|
||||
);
|
||||
let chatgpt_claim_fields = extract_openai_chatgpt_auth_fields_from_object(&claims);
|
||||
@@ -301,6 +312,7 @@ pub fn enrich_admin_provider_oauth_auth_config(
|
||||
"plan_type",
|
||||
"user_id",
|
||||
"organizations",
|
||||
"is_fedramp",
|
||||
],
|
||||
);
|
||||
}
|
||||
@@ -428,6 +440,7 @@ mod tests {
|
||||
"chatgpt_account_user_id": "user-image__acc-image",
|
||||
"chatgpt_plan_type": "plus",
|
||||
"chatgpt_user_id": "user-image",
|
||||
"chatgpt_account_is_fedramp": true,
|
||||
},
|
||||
}));
|
||||
let token_payload = json!({
|
||||
@@ -445,5 +458,6 @@ mod tests {
|
||||
);
|
||||
assert_eq!(auth_config.get("plan_type"), Some(&json!("plus")));
|
||||
assert_eq!(auth_config.get("user_id"), Some(&json!("user-image")));
|
||||
assert_eq!(auth_config.get("is_fedramp"), Some(&json!(true)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1736,66 +1736,7 @@ pub fn admin_system_config_default_value(key: &str) -> Option<serde_json::Value>
|
||||
"email_suffix_list" => Some(json!([])),
|
||||
"enable_format_conversion" => Some(json!(false)),
|
||||
"enable_model_directives" => Some(json!(false)),
|
||||
"model_directives" => Some(json!({
|
||||
"reasoning_effort": {
|
||||
"enabled": true,
|
||||
"api_formats": {
|
||||
"openai:chat": {
|
||||
"enabled": true,
|
||||
"mappings": {
|
||||
"low": { "reasoning_effort": "low" },
|
||||
"medium": { "reasoning_effort": "medium" },
|
||||
"high": { "reasoning_effort": "high" },
|
||||
"xhigh": { "reasoning_effort": "xhigh" },
|
||||
"max": { "reasoning_effort": "max" },
|
||||
"fast": { "service_tier": "priority" }
|
||||
}
|
||||
},
|
||||
"openai:responses": {
|
||||
"enabled": true,
|
||||
"mappings": {
|
||||
"low": { "reasoning": { "effort": "low" } },
|
||||
"medium": { "reasoning": { "effort": "medium" } },
|
||||
"high": { "reasoning": { "effort": "high" } },
|
||||
"xhigh": { "reasoning": { "effort": "xhigh" } },
|
||||
"max": { "reasoning": { "effort": "max" } },
|
||||
"fast": { "service_tier": "priority" }
|
||||
}
|
||||
},
|
||||
"openai:responses:compact": {
|
||||
"enabled": true,
|
||||
"mappings": {
|
||||
"low": { "reasoning": { "effort": "low" } },
|
||||
"medium": { "reasoning": { "effort": "medium" } },
|
||||
"high": { "reasoning": { "effort": "high" } },
|
||||
"xhigh": { "reasoning": { "effort": "xhigh" } },
|
||||
"max": { "reasoning": { "effort": "max" } },
|
||||
"fast": { "service_tier": "priority" }
|
||||
}
|
||||
},
|
||||
"claude:messages": {
|
||||
"enabled": true,
|
||||
"mappings": {
|
||||
"low": { "thinking": { "type": "enabled", "budget_tokens": 1024 } },
|
||||
"medium": { "thinking": { "type": "enabled", "budget_tokens": 4096 } },
|
||||
"high": { "thinking": { "type": "enabled", "budget_tokens": 8192 } },
|
||||
"xhigh": { "thinking": { "type": "enabled", "budget_tokens": 16384 } },
|
||||
"max": { "thinking": { "type": "enabled", "budget_tokens": 32768 } }
|
||||
}
|
||||
},
|
||||
"gemini:generate_content": {
|
||||
"enabled": true,
|
||||
"mappings": {
|
||||
"low": { "generationConfig": { "thinkingConfig": { "thinkingBudget": 1024 } } },
|
||||
"medium": { "generationConfig": { "thinkingConfig": { "thinkingBudget": 4096 } } },
|
||||
"high": { "generationConfig": { "thinkingConfig": { "thinkingBudget": 8192 } } },
|
||||
"xhigh": { "generationConfig": { "thinkingConfig": { "thinkingBudget": 16384 } } },
|
||||
"max": { "generationConfig": { "thinkingConfig": { "thinkingBudget": -1 } } }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
})),
|
||||
"model_directives" => Some(aether_ai_formats::default_model_directives_config()),
|
||||
"keep_priority_on_conversion" => Some(json!(false)),
|
||||
"audit_log_retention_days" => Some(json!(30)),
|
||||
"enable_db_maintenance" => Some(json!(true)),
|
||||
|
||||
Reference in New Issue
Block a user