refactor: 抽离 AI pipeline 与调度共享能力逻辑

This commit is contained in:
fawney19
2026-04-10 01:46:14 +08:00
parent b901a6ffc7
commit 5014e2f5fd
255 changed files with 15057 additions and 3115 deletions

View File

@@ -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(

View File

@@ -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,

View File

@@ -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)