perf: use direct trace-thumb endpoint + fallback for face group thumbnails

- loadTraceThumb now uses /api/v1/trace-thumb/{uuid}/{tid} (~8ms)
- Face group imgs use direct trace-thumb URL with fallback
- Merge dialogs also use direct trace-thumb with fallback
- MAX_CONCURRENT increased to 32

Fallback chain:
1. c.rep_trace.file_uuid/trace_id (full trace data)
2. selectedFileUuid/representative_trace (group data only)
3. SVG silhouette
This commit is contained in:
2026-08-01 05:29:55 +08:00
parent 5be57aec7d
commit adc8d944c6
2 changed files with 150 additions and 89 deletions

View File

@@ -332,7 +332,7 @@ loadProgressCacheFromStorage()
const thumbQueue: (() => Promise<void>)[] = []
let activeThumbLoads = 0
const MAX_CONCURRENT = 16
const MAX_CONCURRENT = 32
const profileQueue: (() => Promise<void>)[] = []
let activeProfileLoads = 0
@@ -592,15 +592,14 @@ export function loadTraceThumb(t: any) {
loadingFaceThumbs.add(key)
queueThumb(async () => {
try {
const args: any = { uuid: t.file_uuid, frame: t.best_face_frame || t.start_frame || 0 }
if (t.best_face_bbox) {
args.bboxX = t.best_face_bbox.x
args.bboxY = t.best_face_bbox.y
args.bboxW = t.best_face_bbox.width
args.bboxH = t.best_face_bbox.height
// Use direct trace-thumb endpoint for fast keyFace.jpg loading (~8ms)
const url = `/api/v1/trace-thumb/${t.file_uuid}/${t.trace_id}`
const resp = await fetch(url)
if (resp.ok) {
const blob = await resp.blob()
const dataUrl = URL.createObjectURL(blob)
faceThumbsCache.value[key] = dataUrl
}
const result = await apiCall('get_face_thumbnail', args)
if (result) faceThumbsCache.value[key] = result
} catch (e) {
console.error('loadTraceThumb failed:', key, e)
} finally {