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
@@ -27,6 +27,7 @@ fn enumerate_minimal_candidate_selection_inner(
let EnumerateMinimalCandidateSelectionInput {
rows,
normalized_api_format,
request_operation,
requested_model_name,
resolved_global_model_name,
require_streaming,
@@ -63,11 +64,12 @@ fn enumerate_minimal_candidate_selection_inner(
continue;
}
let Some((selected_provider_model_name, mapping_matched_model)) =
crate::resolve_provider_model_name_with_model_directives(
crate::resolve_provider_model_name_with_model_directives_and_request_operation(
&row,
requested_model_name,
normalized_api_format,
enable_model_directives,
request_operation,
)
else {
continue;
@@ -71,6 +71,7 @@ mod tests {
priority: 1,
api_formats: Some(vec!["openai:chat".to_string()]),
endpoint_ids: None,
operations: None,
}]),
model_supports_streaming: None,
model_is_active: true,
@@ -199,6 +200,7 @@ mod tests {
super::enumerate_minimal_candidate_selection(EnumerateMinimalCandidateSelectionInput {
rows: vec![sample_row("1"), disallowed],
normalized_api_format: "openai:chat",
request_operation: None,
requested_model_name: "gpt-5",
resolved_global_model_name: "gpt-5",
require_streaming: false,
@@ -221,6 +223,7 @@ mod tests {
super::enumerate_minimal_candidate_selection(EnumerateMinimalCandidateSelectionInput {
rows: vec![row],
normalized_api_format: "openai:chat",
request_operation: None,
requested_model_name: "gpt-5",
resolved_global_model_name: "gpt-5",
require_streaming: false,
@@ -244,6 +247,7 @@ mod tests {
super::enumerate_minimal_candidate_selection(EnumerateMinimalCandidateSelectionInput {
rows: vec![later_priority, earlier_priority],
normalized_api_format: "openai:chat",
request_operation: None,
requested_model_name: "gpt-5",
resolved_global_model_name: "gpt-5",
require_streaming: false,
@@ -295,6 +299,7 @@ mod tests {
super::enumerate_minimal_candidate_selection(EnumerateMinimalCandidateSelectionInput {
rows: vec![missing_capability, matching_capability],
normalized_api_format: "openai:chat",
request_operation: None,
requested_model_name: "gpt-5",
resolved_global_model_name: "gpt-5",
require_streaming: false,
@@ -32,6 +32,7 @@ pub struct SchedulerMinimalCandidateSelectionCandidate {
pub struct EnumerateMinimalCandidateSelectionInput<'a> {
pub rows: Vec<StoredMinimalCandidateSelectionRow>,
pub normalized_api_format: &'a str,
pub request_operation: Option<&'a str>,
pub requested_model_name: &'a str,
pub resolved_global_model_name: &'a str,
pub require_streaming: bool,