mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 17:30:23 +08:00
Normalize canonical API formats
This commit is contained in:
@@ -199,7 +199,7 @@ async fn gateway_handles_public_openai_models_with_cross_format_candidates_witho
|
||||
sample_models_candidate_row(
|
||||
"provider-claude",
|
||||
"claude",
|
||||
"claude:chat",
|
||||
"claude:messages",
|
||||
"claude-3-7-sonnet",
|
||||
10,
|
||||
),
|
||||
@@ -277,14 +277,14 @@ async fn gateway_handles_public_claude_models_without_hitting_fallback_probe() {
|
||||
sample_models_candidate_row(
|
||||
"provider-claude",
|
||||
"claude",
|
||||
"claude:chat",
|
||||
"claude:messages",
|
||||
"claude-3-7-sonnet",
|
||||
10,
|
||||
),
|
||||
sample_models_candidate_row(
|
||||
"provider-claude",
|
||||
"claude",
|
||||
"claude:chat",
|
||||
"claude:messages",
|
||||
"claude-3-5-haiku",
|
||||
10,
|
||||
),
|
||||
@@ -347,14 +347,14 @@ async fn gateway_handles_public_gemini_models_without_hitting_fallback_probe() {
|
||||
sample_models_candidate_row(
|
||||
"provider-gemini",
|
||||
"gemini",
|
||||
"gemini:chat",
|
||||
"gemini:generate_content",
|
||||
"gemini-2.5-flash",
|
||||
10,
|
||||
),
|
||||
sample_models_candidate_row(
|
||||
"provider-gemini",
|
||||
"gemini",
|
||||
"gemini:chat",
|
||||
"gemini:generate_content",
|
||||
"gemini-2.5-pro",
|
||||
10,
|
||||
),
|
||||
|
||||
@@ -720,13 +720,13 @@ async fn gateway_handles_public_catalog_providers_without_proxying_upstream() {
|
||||
sample_endpoint(
|
||||
"endpoint-claude",
|
||||
"provider-claude",
|
||||
"claude:chat",
|
||||
"claude:messages",
|
||||
"https://api.anthropic.example",
|
||||
),
|
||||
sample_endpoint(
|
||||
"endpoint-claude-cli",
|
||||
"provider-claude",
|
||||
"claude:cli",
|
||||
"claude:messages",
|
||||
"https://api.anthropic.example",
|
||||
),
|
||||
],
|
||||
@@ -943,7 +943,7 @@ async fn gateway_handles_public_catalog_stats_without_proxying_upstream() {
|
||||
sample_endpoint(
|
||||
"endpoint-claude",
|
||||
"provider-claude",
|
||||
"claude:chat",
|
||||
"claude:messages",
|
||||
"https://api.anthropic.example",
|
||||
),
|
||||
],
|
||||
@@ -956,7 +956,7 @@ async fn gateway_handles_public_catalog_stats_without_proxying_upstream() {
|
||||
sample_models_candidate_row(
|
||||
"provider-claude",
|
||||
"claude",
|
||||
"claude:chat",
|
||||
"claude:messages",
|
||||
"claude-3-7-sonnet",
|
||||
20,
|
||||
),
|
||||
@@ -989,7 +989,7 @@ async fn gateway_handles_public_catalog_stats_without_proxying_upstream() {
|
||||
assert_eq!(payload["active_models"], 3);
|
||||
assert_eq!(
|
||||
payload["supported_formats"],
|
||||
json!(["claude:chat", "openai:chat"])
|
||||
json!(["claude:messages", "openai:chat"])
|
||||
);
|
||||
assert_eq!(*upstream_hits.lock().expect("mutex should lock"), 0);
|
||||
|
||||
@@ -1078,7 +1078,7 @@ async fn gateway_handles_public_health_api_formats_without_proxying_upstream() {
|
||||
sample_endpoint(
|
||||
"endpoint-claude",
|
||||
"provider-claude",
|
||||
"claude:chat",
|
||||
"claude:messages",
|
||||
"https://api.anthropic.example",
|
||||
),
|
||||
],
|
||||
@@ -1158,7 +1158,7 @@ async fn gateway_handles_public_health_api_formats_without_proxying_upstream() {
|
||||
.as_array()
|
||||
.expect("formats should be an array");
|
||||
assert_eq!(formats.len(), 2);
|
||||
assert_eq!(formats[0]["api_format"], "claude:chat");
|
||||
assert_eq!(formats[0]["api_format"], "claude:messages");
|
||||
assert_eq!(formats[0]["api_path"], "/v1/messages");
|
||||
assert_eq!(formats[0]["total_attempts"], 1);
|
||||
assert_eq!(formats[0]["success_rate"], 1.0);
|
||||
@@ -4442,7 +4442,7 @@ async fn gateway_handles_users_me_endpoint_status_locally_without_proxying_upstr
|
||||
sample_endpoint(
|
||||
"endpoint-claude",
|
||||
"provider-claude",
|
||||
"claude:chat",
|
||||
"claude:messages",
|
||||
"https://api.anthropic.example",
|
||||
),
|
||||
],
|
||||
@@ -4456,7 +4456,7 @@ async fn gateway_handles_users_me_endpoint_status_locally_without_proxying_upstr
|
||||
sample_key(
|
||||
"key-claude",
|
||||
"provider-claude",
|
||||
"claude:chat",
|
||||
"claude:messages",
|
||||
"sk-claude-endpoint-status",
|
||||
),
|
||||
],
|
||||
@@ -4540,8 +4540,8 @@ async fn gateway_handles_users_me_endpoint_status_locally_without_proxying_upstr
|
||||
let payload: serde_json::Value = response.json().await.expect("json body should parse");
|
||||
let items = payload.as_array().expect("payload should be an array");
|
||||
assert_eq!(items.len(), 2);
|
||||
assert_eq!(items[0]["api_format"], "claude:chat");
|
||||
assert_eq!(items[0]["display_name"], "Claude Chat");
|
||||
assert_eq!(items[0]["api_format"], "claude:messages");
|
||||
assert_eq!(items[0]["display_name"], "Claude Messages");
|
||||
assert_eq!(items[0]["health_score"], 1.0);
|
||||
assert_eq!(items[0]["timeline"].as_array().map(Vec::len), Some(100));
|
||||
assert!(items[0].get("total_endpoints").is_none());
|
||||
|
||||
@@ -245,8 +245,8 @@ async fn gateway_handles_admin_dashboard_stats_locally_without_proxying_upstream
|
||||
claude_usage.input_tokens = 900;
|
||||
claude_usage.output_tokens = 100;
|
||||
claude_usage.total_tokens = 1_000;
|
||||
claude_usage.api_format = Some("claude:chat".to_string());
|
||||
claude_usage.endpoint_api_format = Some("claude:chat".to_string());
|
||||
claude_usage.api_format = Some("claude:messages".to_string());
|
||||
claude_usage.endpoint_api_format = Some("claude:messages".to_string());
|
||||
claude_usage.cache_creation_input_tokens = 50;
|
||||
claude_usage.cache_creation_ephemeral_5m_input_tokens = 20;
|
||||
claude_usage.cache_creation_ephemeral_1h_input_tokens = 30;
|
||||
|
||||
Reference in New Issue
Block a user