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

@@ -44,6 +44,8 @@ pub(super) fn sample_auth_context() -> GatewayControlAuthContext {
GatewayControlAuthContext {
user_id: "user-123".to_string(),
api_key_id: "key-123".to_string(),
username: None,
api_key_name: None,
balance_remaining: None,
access_allowed: true,
user_rate_limit: None,

View File

@@ -13,7 +13,7 @@ fn rust_authoritative_service_builds_openai_cancel_follow_up_plan() {
service.record_snapshot(LocalVideoTaskSnapshot::OpenAi(OpenAiVideoTaskSeed {
local_task_id: "task-local-123".to_string(),
upstream_task_id: "ext-video-task-123".to_string(),
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
user_id: Some("user-123".to_string()),
api_key_id: Some("key-123".to_string()),
model: Some("sora-2".to_string()),
@@ -70,7 +70,7 @@ fn rust_authoritative_service_builds_openai_remix_follow_up_plan() {
service.record_snapshot(LocalVideoTaskSnapshot::OpenAi(OpenAiVideoTaskSeed {
local_task_id: "task-local-123".to_string(),
upstream_task_id: "ext-video-task-123".to_string(),
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
user_id: Some("user-123".to_string()),
api_key_id: Some("key-123".to_string()),
model: Some("sora-2".to_string()),
@@ -131,7 +131,7 @@ fn rust_authoritative_service_builds_openai_delete_follow_up_plan() {
service.record_snapshot(LocalVideoTaskSnapshot::OpenAi(OpenAiVideoTaskSeed {
local_task_id: "task-local-123".to_string(),
upstream_task_id: "ext-video-task-123".to_string(),
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
user_id: Some("user-123".to_string()),
api_key_id: Some("key-123".to_string()),
model: Some("sora-2".to_string()),
@@ -238,7 +238,7 @@ fn rust_authoritative_service_builds_openai_read_refresh_plan() {
service.record_snapshot(LocalVideoTaskSnapshot::OpenAi(OpenAiVideoTaskSeed {
local_task_id: "task-local-123".to_string(),
upstream_task_id: "ext-video-task-123".to_string(),
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
user_id: Some("user-123".to_string()),
api_key_id: Some("key-123".to_string()),
model: Some("sora-2".to_string()),
@@ -313,7 +313,7 @@ fn rust_authoritative_service_builds_poll_refresh_batch_for_active_tasks_only()
service.record_snapshot(LocalVideoTaskSnapshot::OpenAi(OpenAiVideoTaskSeed {
local_task_id: "task-active-123".to_string(),
upstream_task_id: "ext-video-task-123".to_string(),
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
user_id: Some("user-123".to_string()),
api_key_id: Some("key-123".to_string()),
model: Some("sora-2".to_string()),
@@ -334,7 +334,7 @@ fn rust_authoritative_service_builds_poll_refresh_batch_for_active_tasks_only()
service.record_snapshot(LocalVideoTaskSnapshot::OpenAi(OpenAiVideoTaskSeed {
local_task_id: "task-completed-123".to_string(),
upstream_task_id: "ext-video-task-999".to_string(),
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
user_id: Some("user-123".to_string()),
api_key_id: Some("key-123".to_string()),
model: Some("sora-2".to_string()),
@@ -373,7 +373,7 @@ fn file_video_task_store_persists_snapshots_across_service_rebuilds() {
service.record_snapshot(LocalVideoTaskSnapshot::OpenAi(OpenAiVideoTaskSeed {
local_task_id: "task-file-123".to_string(),
upstream_task_id: "ext-video-task-123".to_string(),
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
user_id: Some("user-123".to_string()),
api_key_id: Some("key-123".to_string()),
model: Some("sora-2".to_string()),

View File

@@ -12,7 +12,7 @@ fn rust_authoritative_service_projects_openai_status_into_local_read_response()
service.record_snapshot(LocalVideoTaskSnapshot::OpenAi(OpenAiVideoTaskSeed {
local_task_id: "task-local-123".to_string(),
upstream_task_id: "ext-video-task-123".to_string(),
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
user_id: Some("user-123".to_string()),
api_key_id: Some("key-123".to_string()),
model: Some("sora-2".to_string()),
@@ -89,7 +89,7 @@ fn rust_authoritative_service_builds_openai_content_stream_plan_from_direct_vide
service.record_snapshot(LocalVideoTaskSnapshot::OpenAi(OpenAiVideoTaskSeed {
local_task_id: "task-local-123".to_string(),
upstream_task_id: "ext-video-task-123".to_string(),
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
user_id: Some("user-123".to_string()),
api_key_id: Some("key-123".to_string()),
model: Some("sora-2".to_string()),
@@ -133,7 +133,7 @@ fn rust_authoritative_service_returns_processing_content_response_for_pending_op
service.record_snapshot(LocalVideoTaskSnapshot::OpenAi(OpenAiVideoTaskSeed {
local_task_id: "task-local-123".to_string(),
upstream_task_id: "ext-video-task-123".to_string(),
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
user_id: Some("user-123".to_string()),
api_key_id: Some("key-123".to_string()),
model: Some("sora-2".to_string()),

View File

@@ -220,7 +220,7 @@ fn rust_authoritative_service_reads_openai_task_from_local_registry() {
let snapshot = LocalVideoTaskSnapshot::OpenAi(OpenAiVideoTaskSeed {
local_task_id: "task-local-123".to_string(),
upstream_task_id: "ext-video-task-123".to_string(),
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
user_id: Some("user-123".to_string()),
api_key_id: Some("key-123".to_string()),
model: Some("sora-2".to_string()),
@@ -261,7 +261,7 @@ fn rust_authoritative_service_applies_cancel_and_delete_mutations() {
service.record_snapshot(LocalVideoTaskSnapshot::OpenAi(OpenAiVideoTaskSeed {
local_task_id: "task-local-123".to_string(),
upstream_task_id: "ext-video-task-123".to_string(),
created_at_unix_secs: 1712345678,
created_at_unix_ms: 1712345678,
user_id: Some("user-123".to_string()),
api_key_id: Some("key-123".to_string()),
model: Some("sora-2".to_string()),