feat: improve generation analytics and maintenance

This commit is contained in:
2026-04-19 09:03:40 +08:00
parent d5a173aa0d
commit 5318de670f
21 changed files with 1155 additions and 57 deletions

View File

@@ -42,15 +42,23 @@ export interface GenerationProviderStat {
export interface GenerationProviderStats {
story_id: number
window_days: number | null
capability: string | null
total_calls: number
successful_calls: number
failed_calls: number
avg_latency_ms: number | null
estimated_cost_usd: number
by_provider: GenerationProviderStat[]
failure_reasons: Array<{
reason: string
count: number
}>
}
export interface GenerationProviderAnalytics {
window_days: number | null
capability: string | null
total_calls: number
successful_calls: number
failed_calls: number
@@ -59,4 +67,30 @@ export interface GenerationProviderAnalytics {
job_count: number
story_count: number
by_provider: GenerationProviderStat[]
failure_reasons: Array<{
reason: string
count: number
}>
}
export interface GenerationRecentFailure {
job_id: string
story_id: number | null
story_title: string | null
output_mode: string
current_step: string
error_message: string | null
failure_label: string
updated_at: string
}
export interface GenerationOpsSummary {
window_hours: number
stale_threshold_minutes: number
active_jobs: number
stale_running_jobs: number
failed_jobs: number
degraded_jobs: number
asset_retry_jobs: number
recent_failures: GenerationRecentFailure[]
}