migrate ai format conversion to responses adapters

This commit is contained in:
fawney19
2026-04-26 20:32:55 +08:00
parent e36fb8c07a
commit 5b914aa78c
183 changed files with 13539 additions and 3401 deletions

View File

@@ -48,16 +48,27 @@ impl StoredMinimalCandidateSelectionRow {
}
pub fn key_supports_api_format(&self, api_format: &str) -> bool {
let target = api_format.trim();
match self.key_api_formats.as_deref() {
None => true,
Some(formats) => formats
.iter()
.any(|value| value.eq_ignore_ascii_case(target)),
.any(|value| api_format_matches(value, api_format)),
}
}
}
fn normalize_api_format(value: &str) -> String {
match value.trim().to_ascii_lowercase().as_str() {
"openai:cli" => "openai:responses".to_string(),
"openai:compact" => "openai:responses:compact".to_string(),
other => other.to_string(),
}
}
fn api_format_matches(left: &str, right: &str) -> bool {
normalize_api_format(left) == normalize_api_format(right)
}
#[async_trait]
pub trait MinimalCandidateSelectionReadRepository: Send + Sync {
async fn list_for_exact_api_format(