mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 09:20:22 +08:00
migrate ai format conversion to responses adapters
This commit is contained in:
@@ -5,8 +5,8 @@ use crate::ai_pipeline_api::{
|
||||
build_local_image_sync_plan_and_reports_for_kind,
|
||||
build_local_openai_chat_stream_plan_and_reports_for_kind,
|
||||
build_local_openai_chat_sync_plan_and_reports_for_kind,
|
||||
build_local_openai_cli_stream_plan_and_reports_for_kind,
|
||||
build_local_openai_cli_sync_plan_and_reports_for_kind,
|
||||
build_local_openai_responses_stream_plan_and_reports_for_kind,
|
||||
build_local_openai_responses_sync_plan_and_reports_for_kind,
|
||||
build_local_same_format_stream_plan_and_reports, build_local_same_format_sync_plan_and_reports,
|
||||
build_local_video_sync_plan_and_reports_for_kind,
|
||||
build_standard_family_stream_plan_and_reports, build_standard_family_sync_plan_and_reports,
|
||||
@@ -110,7 +110,7 @@ pub(crate) async fn maybe_execute_stream_via_local_decision(
|
||||
Ok(outcome)
|
||||
}
|
||||
|
||||
pub(crate) async fn maybe_execute_sync_via_local_openai_cli_decision(
|
||||
pub(crate) async fn maybe_execute_sync_via_local_openai_responses_decision(
|
||||
state: &AppState,
|
||||
parts: &http::request::Parts,
|
||||
trace_id: &str,
|
||||
@@ -119,7 +119,7 @@ pub(crate) async fn maybe_execute_sync_via_local_openai_cli_decision(
|
||||
plan_kind: &str,
|
||||
) -> Result<LocalExecutionRequestOutcome, GatewayError> {
|
||||
let plan_and_reports: Vec<LocalSyncPlanAndReport> =
|
||||
build_local_openai_cli_sync_plan_and_reports_for_kind(
|
||||
build_local_openai_responses_sync_plan_and_reports_for_kind(
|
||||
state, parts, trace_id, decision, body_json, plan_kind,
|
||||
)
|
||||
.await?;
|
||||
@@ -138,7 +138,7 @@ pub(crate) async fn maybe_execute_sync_via_local_openai_cli_decision(
|
||||
.await
|
||||
}
|
||||
|
||||
pub(crate) async fn maybe_execute_stream_via_local_openai_cli_decision(
|
||||
pub(crate) async fn maybe_execute_stream_via_local_openai_responses_decision(
|
||||
state: &AppState,
|
||||
parts: &http::request::Parts,
|
||||
trace_id: &str,
|
||||
@@ -147,7 +147,7 @@ pub(crate) async fn maybe_execute_stream_via_local_openai_cli_decision(
|
||||
plan_kind: &str,
|
||||
) -> Result<LocalExecutionRequestOutcome, GatewayError> {
|
||||
let plan_and_reports: Vec<LocalStreamPlanAndReport> =
|
||||
build_local_openai_cli_stream_plan_and_reports_for_kind(
|
||||
build_local_openai_responses_stream_plan_and_reports_for_kind(
|
||||
state, parts, trace_id, decision, body_json, plan_kind,
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -1112,8 +1112,8 @@ mod tests {
|
||||
candidate: skipped_candidate,
|
||||
provider_name: Some("openai".to_string()),
|
||||
key_name: Some("prod".to_string()),
|
||||
client_api_format: Some("openai:cli".to_string()),
|
||||
provider_api_format: Some("openai:cli".to_string()),
|
||||
client_api_format: Some("openai:responses".to_string()),
|
||||
provider_api_format: Some("openai:responses".to_string()),
|
||||
global_model_name: Some("gpt-5".to_string()),
|
||||
selected_provider_model_name: Some("gpt-5-upstream".to_string()),
|
||||
endpoint_url: Some("https://api.openai.example/v1/responses".to_string()),
|
||||
|
||||
@@ -24,7 +24,7 @@ pub(crate) fn should_bypass_execution_runtime_decision(
|
||||
.to_ascii_lowercase();
|
||||
if !matches!(
|
||||
provider_api_format.as_str(),
|
||||
"openai:cli" | "openai:compact"
|
||||
"openai:responses" | "openai:cli" | "openai:compact" | "openai:responses:compact"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ pub(crate) fn should_bypass_execution_runtime_plan(plan: &ExecutionPlan) -> bool
|
||||
let provider_api_format = plan.provider_api_format.trim().to_ascii_lowercase();
|
||||
if !matches!(
|
||||
provider_api_format.as_str(),
|
||||
"openai:cli" | "openai:compact"
|
||||
"openai:responses" | "openai:cli" | "openai:compact" | "openai:responses:compact"
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,7 @@ use super::{
|
||||
build_direct_plan_bypass_cache_key, execute_stream_plan_and_reports,
|
||||
maybe_execute_stream_via_local_decision, maybe_execute_stream_via_local_gemini_files_decision,
|
||||
maybe_execute_stream_via_local_image_decision,
|
||||
maybe_execute_stream_via_local_openai_cli_decision,
|
||||
maybe_execute_stream_via_local_openai_responses_decision,
|
||||
maybe_execute_stream_via_local_same_format_provider_decision,
|
||||
maybe_execute_stream_via_local_standard_decision, maybe_execute_stream_via_plan_fallback,
|
||||
maybe_execute_stream_via_remote_decision, parse_local_request_body, should_skip_direct_plan,
|
||||
@@ -90,7 +90,7 @@ pub(crate) async fn maybe_execute_via_stream_decision_path(
|
||||
LocalExecutionRequestOutcome::NoPath => {}
|
||||
}
|
||||
|
||||
match maybe_execute_stream_via_local_openai_cli_decision(
|
||||
match maybe_execute_stream_via_local_openai_responses_decision(
|
||||
state, parts, trace_id, decision, &body_json, plan_kind,
|
||||
)
|
||||
.await?
|
||||
|
||||
@@ -16,7 +16,8 @@ use crate::{AppState, GatewayError, GatewayFallbackReason};
|
||||
use super::{
|
||||
build_direct_plan_bypass_cache_key, execute_sync_plan_and_reports,
|
||||
maybe_execute_sync_via_local_decision, maybe_execute_sync_via_local_gemini_files_decision,
|
||||
maybe_execute_sync_via_local_image_decision, maybe_execute_sync_via_local_openai_cli_decision,
|
||||
maybe_execute_sync_via_local_image_decision,
|
||||
maybe_execute_sync_via_local_openai_responses_decision,
|
||||
maybe_execute_sync_via_local_same_format_provider_decision,
|
||||
maybe_execute_sync_via_local_standard_decision, maybe_execute_sync_via_local_video_decision,
|
||||
maybe_execute_sync_via_plan_fallback, maybe_execute_sync_via_remote_decision,
|
||||
@@ -113,7 +114,7 @@ pub(crate) async fn maybe_execute_via_sync_decision_path(
|
||||
LocalExecutionRequestOutcome::NoPath => {}
|
||||
}
|
||||
|
||||
match maybe_execute_sync_via_local_openai_cli_decision(
|
||||
match maybe_execute_sync_via_local_openai_responses_decision(
|
||||
state, parts, trace_id, decision, &body_json, plan_kind,
|
||||
)
|
||||
.await?
|
||||
|
||||
Reference in New Issue
Block a user