refactor(gateway): 重构 ai pipeline 规划链路

This commit is contained in:
fawney19
2026-04-14 01:27:04 +08:00
parent 37bb120d20
commit 53acfbabf6
74 changed files with 7357 additions and 4380 deletions

View File

@@ -5,7 +5,10 @@ use axum::http::Uri;
use sha2::{Digest, Sha256};
use url::form_urlencoded;
use crate::headers::{header_value_str, is_json_request};
use crate::{
ai_pipeline::extract_gemini_model_from_path,
headers::{header_value_str, is_json_request},
};
use super::super::GatewayControlDecision;
use super::types::{
@@ -108,20 +111,6 @@ pub(super) fn build_auth_context_cache_key(
))
}
fn extract_gemini_model_from_path(path: &str) -> Option<String> {
let (_, suffix) = path.split_once("/models/")?;
let model = suffix
.split_once(':')
.map(|(value, _)| value)
.unwrap_or(suffix);
let model = model.trim();
if model.is_empty() {
None
} else {
Some(model.to_string())
}
}
fn extract_trusted_auth_headers(headers: &http::HeaderMap) -> Option<GatewayTrustedAuthHeaders> {
if !has_trusted_gateway_marker(headers) {
return None;