Merge pull request #410 from Entropy-Xu/codex/codex-image-progress-heartbeat

Add Codex image progress heartbeat
This commit is contained in:
fawney19
2026-05-10 17:57:33 +08:00
committed by GitHub
48 changed files with 3232 additions and 221 deletions

View File

@@ -9,6 +9,19 @@ export interface CandidateRankingMetadata {
demoted_by?: string
}
export interface ImageProgress {
phase?: 'upstream_connecting' | 'upstream_streaming' | 'upstream_completed' | 'failed' | string
upstream_ttfb_ms?: number | null
upstream_sse_frame_count?: number | null
last_upstream_event?: string | null
last_upstream_frame_at_unix_ms?: number | null
partial_image_count?: number | null
last_client_visible_event?: string | null
downstream_heartbeat_count?: number | null
last_downstream_heartbeat_at_unix_ms?: number | null
downstream_heartbeat_interval_ms?: number | null
}
export interface CandidateResponseBoundary {
source?: string
status_code?: number | null
@@ -55,8 +68,10 @@ export interface CandidateRecord {
latency_ms?: number
concurrent_requests?: number
ranking?: CandidateRankingMetadata | null
image_progress?: ImageProgress | null
extra_data?: Record<string, unknown> & {
upstream_response?: CandidateResponseBoundary
image_progress?: ImageProgress | null
}
created_at: string
started_at?: string

View File

@@ -1,6 +1,7 @@
import apiClient from './client'
import { cachedRequest, dedupedRequest, buildCacheKey } from '@/utils/cache'
import type { ActivityHeatmap } from '@/types/activity'
import type { ImageProgress } from './requestTrace'
const ACTIVITY_HEATMAP_CACHE_TTL_MS = 30 * 60 * 1000
@@ -321,6 +322,7 @@ export const usageApi = {
has_format_conversion?: boolean | null
has_fallback?: boolean | null
target_model?: string | null
image_progress?: ImageProgress | null
}>
}> {
const params: Record<string, string | number> = {}