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

@@ -335,7 +335,7 @@ impl GeminiVideoTaskSeed {
next_poll_at_unix_secs,
poll_count: 0,
max_poll_count: DEFAULT_VIDEO_TASK_MAX_POLL_COUNT,
created_at_unix_secs: now_unix_secs,
created_at_unix_ms: now_unix_secs,
submitted_at_unix_secs: Some(now_unix_secs),
completed_at_unix_secs: None,
updated_at_unix_secs: now_unix_secs,
@@ -401,7 +401,7 @@ mod tests {
next_poll_at_unix_secs: None,
poll_count: 0,
max_poll_count: 360,
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
submitted_at_unix_secs: Some(1712345678),
completed_at_unix_secs: None,
updated_at_unix_secs: 1712345679,

View File

@@ -40,7 +40,7 @@ fn build_openai_stored_task_body(task: StoredVideoTask, status: VideoTaskStatus)
"object": "video",
"status": map_openai_stored_task_status(status),
"progress": task.progress_percent,
"created_at": task.created_at_unix_secs,
"created_at": task.created_at_unix_ms,
});
if let Some(model) = task.model {
@@ -247,7 +247,7 @@ impl OpenAiVideoTaskSeed {
"object": "video",
"status": map_openai_task_status(self.status),
"progress": self.progress_percent,
"created_at": self.created_at_unix_secs,
"created_at": self.created_at_unix_ms,
});
if let Some(model) = &self.model {
@@ -575,7 +575,7 @@ impl OpenAiVideoTaskSeed {
LocalVideoTaskStatus::Submitted
| LocalVideoTaskStatus::Queued
| LocalVideoTaskStatus::Processing => Some(
self.created_at_unix_secs
self.created_at_unix_ms
.saturating_add(u64::from(DEFAULT_VIDEO_TASK_POLL_INTERVAL_SECONDS)),
),
_ => None,
@@ -613,8 +613,8 @@ impl OpenAiVideoTaskSeed {
next_poll_at_unix_secs,
poll_count: 0,
max_poll_count: DEFAULT_VIDEO_TASK_MAX_POLL_COUNT,
created_at_unix_secs: self.created_at_unix_secs,
submitted_at_unix_secs: Some(self.created_at_unix_secs),
created_at_unix_ms: self.created_at_unix_ms,
submitted_at_unix_secs: Some(self.created_at_unix_ms),
completed_at_unix_secs: self.completed_at_unix_secs,
updated_at_unix_secs: self.completed_at_unix_secs.unwrap_or(now_unix_secs),
error_code: self.error_code.clone(),
@@ -665,7 +665,7 @@ mod tests {
next_poll_at_unix_secs: None,
poll_count: 0,
max_poll_count: 360,
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
submitted_at_unix_secs: Some(1712345678),
completed_at_unix_secs: Some(1712345688),
updated_at_unix_secs: 1712345688,

View File

@@ -36,7 +36,7 @@ impl LocalVideoTaskSnapshot {
Some(Self::OpenAi(OpenAiVideoTaskSeed {
local_task_id: task.id.clone(),
upstream_task_id,
created_at_unix_secs: task.created_at_unix_secs,
created_at_unix_ms: task.created_at_unix_ms,
user_id: task.user_id.clone(),
api_key_id: task.api_key_id.clone(),
model: non_empty_owned(task.model.as_ref()),

View File

@@ -30,7 +30,7 @@ impl LocalVideoTaskSeed {
local_task_id: context_text(report_context, "local_task_id")
.unwrap_or_else(|| Uuid::new_v4().to_string()),
upstream_task_id: upstream_id.to_string(),
created_at_unix_secs: context_u64(report_context, "local_created_at")
created_at_unix_ms: context_u64(report_context, "local_created_at")
.unwrap_or_else(current_unix_timestamp_secs),
user_id: context_text(report_context, "user_id"),
api_key_id: context_text(report_context, "api_key_id"),
@@ -61,7 +61,7 @@ impl LocalVideoTaskSeed {
local_task_id: context_text(report_context, "local_task_id")
.unwrap_or_else(|| Uuid::new_v4().to_string()),
upstream_task_id: upstream_id.to_string(),
created_at_unix_secs: context_u64(report_context, "local_created_at")
created_at_unix_ms: context_u64(report_context, "local_created_at")
.unwrap_or_else(current_unix_timestamp_secs),
user_id: context_text(report_context, "user_id"),
api_key_id: context_text(report_context, "api_key_id"),
@@ -130,7 +130,7 @@ impl LocalVideoTaskSeed {
);
report_context.insert(
"local_created_at".to_string(),
Value::Number(seed.created_at_unix_secs.into()),
Value::Number(seed.created_at_unix_ms.into()),
);
}
Self::GeminiCreate(seed) => {

View File

@@ -135,7 +135,7 @@ pub struct LocalVideoTaskPersistence {
pub struct OpenAiVideoTaskSeed {
pub local_task_id: String,
pub upstream_task_id: String,
pub created_at_unix_secs: u64,
pub created_at_unix_ms: u64,
pub user_id: Option<String>,
pub api_key_id: Option<String>,
pub model: Option<String>,