mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-09 12:40:20 +08:00
style(rust): apply workspace formatting
This commit is contained in:
@@ -631,10 +631,7 @@ mod tests {
|
||||
};
|
||||
|
||||
assert_eq!(status_code, 502);
|
||||
assert_eq!(
|
||||
body_json["error"]["code"],
|
||||
"MALFORMED_FUNCTION_CALL"
|
||||
);
|
||||
assert_eq!(body_json["error"]["code"], "MALFORMED_FUNCTION_CALL");
|
||||
assert_eq!(
|
||||
body_json["error"]["message"],
|
||||
"Malformed function call: Function call is empty - no input to parse."
|
||||
|
||||
@@ -71,6 +71,7 @@ use crate::ai_serving::api::{
|
||||
UPSTREAM_IS_STREAM_KEY,
|
||||
};
|
||||
use crate::ai_serving::is_openai_responses_family_format;
|
||||
use crate::ai_serving::record_local_runtime_candidate_skip_reason;
|
||||
use crate::api::response::{
|
||||
attach_control_metadata_headers, build_client_response, build_client_response_from_parts,
|
||||
};
|
||||
@@ -114,7 +115,6 @@ use crate::execution_runtime::{
|
||||
use crate::execution_runtime::{
|
||||
MAX_ERROR_BODY_BYTES, MAX_STREAM_PREFETCH_BYTES, MAX_STREAM_PREFETCH_FRAMES,
|
||||
};
|
||||
use crate::ai_serving::record_local_runtime_candidate_skip_reason;
|
||||
use crate::log_ids::short_request_id;
|
||||
use crate::orchestration::{
|
||||
apply_local_execution_effect, build_local_error_flow_metadata, classify_failure_disposition,
|
||||
@@ -8794,8 +8794,7 @@ mod tests {
|
||||
endpoint_id: format!("endpoint-{request_id}"),
|
||||
key_id: format!("key-{request_id}"),
|
||||
method: "POST".to_string(),
|
||||
url: "https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent"
|
||||
.to_string(),
|
||||
url: "https://cloudcode-pa.googleapis.com/v1internal:streamGenerateContent".to_string(),
|
||||
headers: BTreeMap::from([
|
||||
("content-type".to_string(), "application/json".to_string()),
|
||||
("accept".to_string(), "text/event-stream".to_string()),
|
||||
|
||||
@@ -34,6 +34,7 @@ use crate::ai_serving::api::{
|
||||
implicit_sync_finalize_report_kind, maybe_build_sync_finalize_outcome, LocalCoreSyncErrorKind,
|
||||
LocalCoreSyncFinalizeOutcome,
|
||||
};
|
||||
use crate::ai_serving::record_local_runtime_candidate_skip_reason;
|
||||
use crate::api::response::{
|
||||
attach_control_metadata_headers, build_client_response, build_client_response_from_parts,
|
||||
build_client_response_from_parts_with_mutator,
|
||||
@@ -69,7 +70,6 @@ use crate::execution_runtime::{
|
||||
local_failover_response_text, resolve_core_sync_error_finalize_report_kind,
|
||||
should_fallback_to_control_sync, should_finalize_sync_response, LocalFailoverDecision,
|
||||
};
|
||||
use crate::ai_serving::record_local_runtime_candidate_skip_reason;
|
||||
use crate::log_ids::short_request_id;
|
||||
use crate::orchestration::{
|
||||
apply_local_execution_effect, build_local_error_flow_metadata,
|
||||
|
||||
@@ -107,8 +107,10 @@ const AUTH_API_KEY_CONCURRENCY_LIMIT_REACHED_DETAIL: &str =
|
||||
"当前调用方 API Key 并发请求数已达上限,请稍后重试";
|
||||
const PROVIDER_KEY_CAPACITY_LIMIT_REACHED_DETAIL: &str =
|
||||
"所有可用上游账号当前均已达到并发或 RPM 上限,请稍后重试";
|
||||
const PROVIDER_KEY_CAPACITY_LIMIT_SKIP_REASONS: &[&str] =
|
||||
&["provider_key_concurrency_limit_reached", "key_rpm_exhausted"];
|
||||
const PROVIDER_KEY_CAPACITY_LIMIT_SKIP_REASONS: &[&str] = &[
|
||||
"provider_key_concurrency_limit_reached",
|
||||
"key_rpm_exhausted",
|
||||
];
|
||||
const LOCAL_EXECUTION_PLANNING_TIMEOUT_DETAIL: &str =
|
||||
"当前 AI 请求在本地执行规划阶段超时,请稍后重试";
|
||||
const EXECUTION_PATH_TUNNEL_AFFINITY_FORWARD: &str = "tunnel_affinity_forward";
|
||||
@@ -2380,8 +2382,7 @@ fn diagnostic_is_provider_key_capacity_limited(
|
||||
|| (diagnostic.candidate_count.is_some_and(|candidate_count| {
|
||||
candidate_count > 0
|
||||
&& diagnostic.skipped_candidate_count.unwrap_or(0) >= candidate_count
|
||||
})
|
||||
&& !diagnostic.skip_reasons.is_empty()
|
||||
}) && !diagnostic.skip_reasons.is_empty()
|
||||
&& diagnostic.skip_reasons.iter().all(|(reason, count)| {
|
||||
PROVIDER_KEY_CAPACITY_LIMIT_SKIP_REASONS.contains(&reason.as_str()) && *count > 0
|
||||
}))
|
||||
|
||||
@@ -372,10 +372,8 @@ pub(crate) async fn record_local_request_candidate_status(
|
||||
else {
|
||||
return;
|
||||
};
|
||||
record.skip_reason = local_request_candidate_skip_reason(
|
||||
record.status,
|
||||
record.error_type.as_deref(),
|
||||
);
|
||||
record.skip_reason =
|
||||
local_request_candidate_skip_reason(record.status, record.error_type.as_deref());
|
||||
persist_local_request_candidate_status_record(state, record).await;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user