a
This commit is contained in:
@@ -29,35 +29,15 @@ export function useCheckpointLoader(
|
||||
stripSelEndOverride.value ?? Math.max(0, checkpointFrames.value.length - 1),
|
||||
)
|
||||
|
||||
// Cache job_id → timeline_id mappings
|
||||
const timelineCache = new Map<string, string>()
|
||||
|
||||
// Track current frame from SSE
|
||||
source.on<{ frame_ref: number; jpeg_b64: string }>('frame_update', (e) => {
|
||||
currentFrameImage.value = e.jpeg_b64
|
||||
currentFrameRef.value = e.frame_ref
|
||||
})
|
||||
|
||||
async function resolveTimelineId(job: string): Promise<string | null> {
|
||||
if (timelineCache.has(job)) return timelineCache.get(job)!
|
||||
|
||||
try {
|
||||
const resp = await fetch(`/api/detect/timeline/${job}`)
|
||||
if (!resp.ok) return null
|
||||
const data = await resp.json()
|
||||
const tid = data.timeline_id
|
||||
if (tid) timelineCache.set(job, tid)
|
||||
return tid
|
||||
} catch {
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
async function loadCheckpoint(job: string, stage: string) {
|
||||
try {
|
||||
// Resolve timeline_id from job_id
|
||||
const timelineId = await resolveTimelineId(job)
|
||||
const lookupId = timelineId ?? job
|
||||
const lookupId = pipeline.timelineId || job
|
||||
|
||||
const resp = await fetch(`/api/detect/checkpoints/${lookupId}/${stage}`)
|
||||
if (!resp.ok) return
|
||||
|
||||
Reference in New Issue
Block a user