feat(codex): 按操作语义路由 Responses V2 压缩

(cherry picked from commit 2fc604e047)
This commit is contained in:
MMEXA
2026-07-16 00:34:42 +08:00
committed by elky
parent 598b2fb374
commit 20b27a13b2
75 changed files with 732 additions and 50 deletions
@@ -678,6 +678,7 @@ fn parse_embedded_provider_model_mappings(
priority: 1,
api_formats: None,
endpoint_ids: None,
operations: None,
}]))
}
@@ -698,6 +699,7 @@ fn parse_provider_model_mappings_array(
priority: 1,
api_formats: None,
endpoint_ids: None,
operations: None,
});
}
_ => {}
@@ -742,6 +744,11 @@ fn parse_provider_model_mapping_object_lenient(
object.get("endpoint_ids").cloned(),
"models.provider_model_mappings.endpoint_ids",
)?;
let operations = parse_string_list(
object.get("operations").cloned(),
"models.provider_model_mappings.operations",
)?
.and_then(normalize_request_operations);
Ok(Some(StoredProviderModelMapping {
name: name.to_string(),
@@ -752,9 +759,19 @@ fn parse_provider_model_mapping_object_lenient(
})?,
api_formats,
endpoint_ids,
operations,
}))
}
fn normalize_request_operations(values: Vec<String>) -> Option<Vec<String>> {
let operations = values
.into_iter()
.map(|value| value.trim().to_ascii_lowercase())
.filter(|value| !value.is_empty())
.collect::<Vec<_>>();
(!operations.is_empty()).then_some(operations)
}
fn api_format_aliases(api_format: &str) -> Vec<String> {
aether_ai_formats::api_format_storage_aliases(api_format)
}