mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
feat: scope model mappings by endpoint
This commit is contained in:
@@ -9,6 +9,7 @@ use super::request::{
|
||||
classify_antigravity_safe_request_body, AntigravityEnvelopeRequestType,
|
||||
AntigravityRequestEnvelopeUnsupportedReason,
|
||||
};
|
||||
use crate::rules::{body_rules_have_enabled_rules, header_rules_have_enabled_rules};
|
||||
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub struct AntigravityRequestSideSpec {
|
||||
@@ -76,12 +77,12 @@ pub fn classify_local_antigravity_request_support(
|
||||
AntigravityRequestSideUnsupportedReason::UnsupportedCustomPath,
|
||||
);
|
||||
}
|
||||
if transport.endpoint.header_rules.is_some() {
|
||||
if header_rules_have_enabled_rules(transport.endpoint.header_rules.as_ref()) {
|
||||
return AntigravityRequestSideSupport::Unsupported(
|
||||
AntigravityRequestSideUnsupportedReason::UnsupportedHeaderRules,
|
||||
);
|
||||
}
|
||||
if transport.endpoint.body_rules.is_some() {
|
||||
if body_rules_have_enabled_rules(transport.endpoint.body_rules.as_ref()) {
|
||||
return AntigravityRequestSideSupport::Unsupported(
|
||||
AntigravityRequestSideUnsupportedReason::UnsupportedBodyRules,
|
||||
);
|
||||
|
||||
@@ -6,6 +6,7 @@ use crate::auth::{build_passthrough_headers_with_auth, resolve_local_gemini_auth
|
||||
use crate::policy::local_gemini_transport_unsupported_reason_with_network;
|
||||
use crate::rules::{
|
||||
apply_local_body_rules_with_request_headers, apply_local_header_rules_with_request_headers,
|
||||
body_rules_have_enabled_rules,
|
||||
};
|
||||
use crate::snapshot::GatewayProviderTransportSnapshot;
|
||||
use crate::url::build_gemini_files_passthrough_url;
|
||||
@@ -87,7 +88,7 @@ pub fn build_gemini_files_request_body(
|
||||
} else {
|
||||
None
|
||||
};
|
||||
if provider_request_body_base64.is_some() && body_rules.is_some() {
|
||||
if provider_request_body_base64.is_some() && body_rules_have_enabled_rules(body_rules) {
|
||||
return Err(GeminiFilesRequestBodyError::BodyRulesUnsupportedForBinaryUpload);
|
||||
}
|
||||
if let Some(body) = provider_request_body.as_mut() {
|
||||
|
||||
@@ -77,7 +77,8 @@ pub use request_url::{
|
||||
pub use rules::{
|
||||
apply_local_body_rules, apply_local_body_rules_with_request_headers, apply_local_header_rules,
|
||||
apply_local_header_rules_with_request_headers, body_rules_are_locally_supported,
|
||||
body_rules_handle_path, header_rules_are_locally_supported,
|
||||
body_rules_handle_path, body_rules_have_enabled_rules, header_rules_are_locally_supported,
|
||||
header_rules_have_enabled_rules,
|
||||
};
|
||||
pub use same_format_provider::{
|
||||
build_same_format_provider_headers, build_same_format_provider_request_body,
|
||||
|
||||
Reference in New Issue
Block a user