mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
Fix format checks and local error messages
This commit is contained in:
@@ -1371,7 +1371,6 @@ pub(crate) async fn proxy_request(
|
|||||||
http::StatusCode::SERVICE_UNAVAILABLE,
|
http::StatusCode::SERVICE_UNAVAILABLE,
|
||||||
local_execution_runtime_miss_client_message(
|
local_execution_runtime_miss_client_message(
|
||||||
local_execution_runtime_miss_detail.as_str(),
|
local_execution_runtime_miss_detail.as_str(),
|
||||||
local_execution_runtime_miss_diagnostic.as_ref(),
|
|
||||||
)
|
)
|
||||||
.as_str(),
|
.as_str(),
|
||||||
)?;
|
)?;
|
||||||
@@ -1440,15 +1439,8 @@ fn local_execution_runtime_miss_detail(
|
|||||||
local_execution_runtime_miss_route_detail(decision).map(ToOwned::to_owned)
|
local_execution_runtime_miss_route_detail(decision).map(ToOwned::to_owned)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn local_execution_runtime_miss_client_message(
|
fn local_execution_runtime_miss_client_message(detail: &str) -> String {
|
||||||
detail: &str,
|
beautify_local_execution_client_error_message(detail)
|
||||||
diagnostic: Option<&LocalExecutionRuntimeMissDiagnostic>,
|
|
||||||
) -> String {
|
|
||||||
if diagnostic.is_some_and(|diagnostic| diagnostic.reason.as_str() == "candidate_list_empty") {
|
|
||||||
beautify_local_execution_client_error_message(detail)
|
|
||||||
} else {
|
|
||||||
detail.to_string()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn local_execution_runtime_miss_diagnostic_detail(
|
fn local_execution_runtime_miss_diagnostic_detail(
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ pub use crate::stream::{CanonicalStreamEvent, CanonicalStreamFrame};
|
|||||||
pub(crate) const OPENAI_RESPONSES_EXTENSION_NAMESPACE: &str = "openai_responses";
|
pub(crate) const OPENAI_RESPONSES_EXTENSION_NAMESPACE: &str = "openai_responses";
|
||||||
pub(crate) const OPENAI_RESPONSES_LEGACY_EXTENSION_NAMESPACE: &str = "openai_cli";
|
pub(crate) const OPENAI_RESPONSES_LEGACY_EXTENSION_NAMESPACE: &str = "openai_cli";
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Default, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum CanonicalRole {
|
pub enum CanonicalRole {
|
||||||
User,
|
User,
|
||||||
@@ -18,15 +18,10 @@ pub enum CanonicalRole {
|
|||||||
System,
|
System,
|
||||||
Developer,
|
Developer,
|
||||||
Tool,
|
Tool,
|
||||||
|
#[default]
|
||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for CanonicalRole {
|
|
||||||
fn default() -> Self {
|
|
||||||
Self::Unknown
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
pub enum CanonicalStopReason {
|
pub enum CanonicalStopReason {
|
||||||
@@ -2606,14 +2601,14 @@ pub(crate) fn gemini_response_format_to_canonical(
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn gemini_tools_to_canonical(
|
pub(crate) type GeminiCanonicalTools = (
|
||||||
value: Option<&Value>,
|
|
||||||
) -> Option<(
|
|
||||||
Vec<CanonicalToolDefinition>,
|
Vec<CanonicalToolDefinition>,
|
||||||
Vec<Value>,
|
Vec<Value>,
|
||||||
Option<Value>,
|
Option<Value>,
|
||||||
Option<Value>,
|
Option<Value>,
|
||||||
)> {
|
);
|
||||||
|
|
||||||
|
pub(crate) fn gemini_tools_to_canonical(value: Option<&Value>) -> Option<GeminiCanonicalTools> {
|
||||||
let Some(value) = value else {
|
let Some(value) = value else {
|
||||||
return Some((Vec::new(), Vec::new(), None, None));
|
return Some((Vec::new(), Vec::new(), None, None));
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user