mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-05 00:47:48 +08:00
feat(codex): 按操作语义路由 Responses V2 压缩
(cherry picked from commit 2fc604e047)
This commit is contained in:
@@ -15,7 +15,7 @@ use serde_json::json;
|
||||
use std::collections::{BTreeMap, BTreeSet};
|
||||
use uuid::Uuid;
|
||||
|
||||
fn normalize_provider_model_mappings_api_formats(
|
||||
fn normalize_provider_model_mapping_scopes(
|
||||
value: Option<serde_json::Value>,
|
||||
) -> Option<serde_json::Value> {
|
||||
let Some(mut value) = value else {
|
||||
@@ -36,6 +36,9 @@ fn normalize_provider_model_mappings_api_formats(
|
||||
normalize_provider_model_mapping_string_array_field(object, "endpoint_ids", |value| {
|
||||
value.trim().to_string()
|
||||
});
|
||||
normalize_provider_model_mapping_string_array_field(object, "operations", |value| {
|
||||
value.trim().to_ascii_lowercase()
|
||||
});
|
||||
}
|
||||
Some(value)
|
||||
}
|
||||
@@ -155,7 +158,7 @@ impl<'a> AdminAppState<'a> {
|
||||
"price_per_request",
|
||||
)?;
|
||||
let tiered_pricing = normalize_json_object(payload.tiered_pricing, "tiered_pricing")?;
|
||||
let provider_model_mappings = normalize_provider_model_mappings_api_formats(
|
||||
let provider_model_mappings = normalize_provider_model_mapping_scopes(
|
||||
normalize_json_array(payload.provider_model_mappings, "provider_model_mappings")?,
|
||||
);
|
||||
let config = normalize_json_object(payload.config, "config")?;
|
||||
@@ -241,7 +244,7 @@ impl<'a> AdminAppState<'a> {
|
||||
existing.tiered_pricing.clone()
|
||||
};
|
||||
let provider_model_mappings = if fields.contains("provider_model_mappings") {
|
||||
normalize_provider_model_mappings_api_formats(normalize_json_array(
|
||||
normalize_provider_model_mapping_scopes(normalize_json_array(
|
||||
payload.provider_model_mappings,
|
||||
"provider_model_mappings",
|
||||
)?)
|
||||
|
||||
Reference in New Issue
Block a user