mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-03 09:50:21 +08:00
refactor: 抽离 AI pipeline 与调度共享能力逻辑
This commit is contained in:
@@ -598,7 +598,7 @@ pub(crate) fn build_admin_provider_key_response(
|
||||
payload.insert(
|
||||
"created_at".to_string(),
|
||||
json!(unix_secs_to_rfc3339(
|
||||
key.created_at_unix_secs.unwrap_or(now_unix_secs)
|
||||
key.created_at_unix_ms.unwrap_or(now_unix_secs)
|
||||
)),
|
||||
);
|
||||
payload.insert(
|
||||
|
||||
@@ -39,7 +39,8 @@ pub(crate) use self::request_utils::{
|
||||
query_param_bool, query_param_optional_bool, query_param_value,
|
||||
request_enables_control_execute, rust_auth_terminates_provider_credentials,
|
||||
sanitize_upstream_path_and_query, should_strip_forwarded_provider_credential_header,
|
||||
should_strip_forwarded_trusted_admin_header, strip_query_param, unix_secs_to_rfc3339,
|
||||
should_strip_forwarded_trusted_admin_header, strip_query_param, unix_ms_to_rfc3339,
|
||||
unix_secs_to_rfc3339,
|
||||
};
|
||||
pub(crate) use self::system_config_values::{
|
||||
module_available_from_env, system_config_bool, system_config_string,
|
||||
|
||||
@@ -182,6 +182,15 @@ pub(crate) fn unix_secs_to_rfc3339(unix_secs: u64) -> Option<String> {
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn unix_ms_to_rfc3339(unix_ms: u64) -> Option<String> {
|
||||
let secs = i64::try_from(unix_ms / 1000).ok()?;
|
||||
let nanos = ((unix_ms % 1000) * 1_000_000) as u32;
|
||||
Some(
|
||||
chrono::DateTime::<Utc>::from_timestamp(secs, nanos)?
|
||||
.to_rfc3339_opts(SecondsFormat::Millis, true),
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) fn json_string_list(value: Option<&serde_json::Value>) -> Vec<String> {
|
||||
value
|
||||
.and_then(serde_json::Value::as_array)
|
||||
|
||||
Reference in New Issue
Block a user