FIX EFFING EXTEND FILE

This commit is contained in:
2026-09-12 00:30:50 +00:00
parent 937e4d120c
commit c6451b10ce
+13 -9
View File
@@ -9,15 +9,17 @@ export function resolveSize(aspect, source, fallback = {width:1344,height:768})
} }
export function bindClip(form, clip, xaigen = false) { export function bindClip(form, clip, xaigen = false) {
if (!clip?.id) return form if (!clip?.id) return form
const saved = clip.studio2 || clip.job || {}, settings = saved.settings || clip.settings || clip const saved = clip.studio2 || clip.job || {}
const next = {...form, startClipId:clip.id, settings:{...form.settings}} const settings = saved.settings || clip.settings || {}
next.settings.aspect=['auto','16:9','9:16','1:1'].includes(settings.aspect)?settings.aspect:'auto' const next = {...form, startClipId:clip.id, mode:'extend', settings:{...form.settings}}
for (const key of ['duration','aspect','width','height','fps','loraStack','turbo','steps','cfg']) { next.settings.aspect=['auto','16:9','9:16','1:1'].includes(settings.aspect)?settings.aspect:(form.settings?.aspect || 'auto')
if (settings[key] != null && key!=='aspect') next.settings[key] = structuredClone(settings[key]) for (const key of ['duration','width','height','fps','loraStack','turbo','steps','cfg']) {
if (settings[key] == null) continue
try { next.settings[key] = typeof structuredClone === 'function' ? structuredClone(settings[key]) : JSON.parse(JSON.stringify(settings[key])) }
catch { next.settings[key] = settings[key] }
} }
next.engine = xaigen && (saved.engine || clip.engine)==='ltx' ? 'ltx' : 'minimax' next.engine = xaigen && (saved.engine || clip.engine)==='ltx' ? 'ltx' : 'minimax'
if (saved.identityStillId) next.identityStillId = saved.identityStillId if (saved.identityStillId) next.identityStillId = saved.identityStillId
// Missing legacy metadata must not reset a user's current choice.
for (const key of ['lockFace','lockOutfit']) if (typeof saved[key] === 'boolean') next[key] = saved[key] for (const key of ['lockFace','lockOutfit']) if (typeof saved[key] === 'boolean') next[key] = saved[key]
return next return next
} }
@@ -39,9 +41,11 @@ export function restoreAsset(form, item) {
return next return next
} }
export function extendSelected(form, clip, xaigen = false) { export function extendSelected(form, clip, xaigen = false) {
// Switching task on the already bound clip must preserve the user's overrides. const next = { ...form, mode: 'extend', engine: xaigen && form.engine === 'ltx' ? 'ltx' : 'minimax' }
const next=clip?.id && form.startClipId !== clip.id ? bindClip(form,clip,xaigen) : form const target = clip?.id ? clip : null
return {...next,mode:'extend',engine:xaigen && next.engine==='ltx'?'ltx':'minimax'} if (!target?.id) return next
try { return bindClip(next, target, xaigen) }
catch { return { ...next, startClipId: target.id } }
} }
export function changeSource(form) { export function changeSource(form) {
return form.mode==='extend' ? form : {...form,startClipId:'',settings:{...form.settings,aspect:'auto'}} return form.mode==='extend' ? form : {...form,startClipId:'',settings:{...form.settings,aspect:'auto'}}