Fix library thumbnails and let clips keep a display name.
Extract a poster frame when a still-thumb is missing, and show the clip name in the library with the prompt on the info icon. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -135,6 +135,29 @@ export function extractPromptFromHistory(entry: unknown) {
|
||||
return ''
|
||||
}
|
||||
|
||||
export function extractClipMetaFromHistory(entry: unknown) {
|
||||
const prompt = (entry as { prompt?: unknown[] })?.prompt
|
||||
const graph = Array.isArray(prompt) ? prompt[2] : null
|
||||
const meta = { width: 0, height: 0, steps: 0, seed: 0 }
|
||||
if (!graph || typeof graph !== 'object') return meta
|
||||
for (const node of Object.values(graph as Record<string, { class_type?: string; inputs?: Record<string, unknown> }>)) {
|
||||
const inputs = node?.inputs || {}
|
||||
if (node?.class_type === 'MiniMaxH3ImageToVideo') {
|
||||
meta.width = Number(inputs.width || meta.width)
|
||||
meta.height = Number(inputs.height || meta.height)
|
||||
}
|
||||
if (node?.class_type === 'BasicScheduler' || node?.class_type === 'PrimitiveInt') {
|
||||
const steps = Number(inputs.steps || 0)
|
||||
if (steps > 0) meta.steps = steps
|
||||
}
|
||||
if (node?.class_type === 'RandomNoise' || node?.class_type === 'SamplerMiniMax' || node?.class_type === 'KSampler') {
|
||||
const seed = Number(inputs.noise_seed ?? inputs.seed ?? 0)
|
||||
if (seed) meta.seed = seed
|
||||
}
|
||||
}
|
||||
return meta
|
||||
}
|
||||
|
||||
export function inspectHistory(history: Record<string, unknown> | null, promptId: string) {
|
||||
const video = extractVideo(history, promptId)
|
||||
if (!history) return { video: null, completed: false, error: null as string | null }
|
||||
|
||||
Reference in New Issue
Block a user