Stop Use as input from trapping you on the Image tab.

Loading a library still as input now only fills the start-still slot and stays on Video. Video/Image cards switch mode directly instead of relying on fragile query links.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-09-03 23:53:27 -05:00
co-authored by Cursor
parent a9c2c01b35
commit 249af0b7b8
4 changed files with 61 additions and 54 deletions
+42 -45
View File
@@ -8,7 +8,7 @@
/>
<main class="mx-auto min-w-0 max-w-7xl space-y-6 px-4 py-6 sm:px-6">
<StudioKindCards :current="imageStudio ? 'image' : 'video'" />
<StudioKindCards :current="imageStudio ? 'image' : 'video'" @select="selectStudioKind" />
<div class="grid min-w-0 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] lg:items-stretch">
<section id="studio-input" class="glass min-w-0 max-w-full space-y-5 rounded-3xl p-5 sm:p-6">
<div>
@@ -2594,10 +2594,14 @@ function selectStudioKind(kind: 'video' | 'image') {
if (kind === 'video') {
studioMode.value = 'video'
outputFocus.value = 'video'
return
} else {
studioMode.value = 'editv2'
outputFocus.value = 'edit'
}
const studio = kind === 'video' ? 'video' : 'image'
if (String(route.query.studio || '') !== studio) {
void router.replace({ path: '/', query: { ...route.query, studio } })
}
studioMode.value = 'editv2'
outputFocus.value = 'edit'
}
function applyStudioQueryFromRoute() {
@@ -3974,7 +3978,7 @@ onMounted(async () => {
await refreshStudioQueue()
await refreshLiveQueue()
await loadPromptPresets()
if (route.query.clip || route.query.still) applyIncomingLibraryItem()
if (route.query.clip || route.query.still) await applyIncomingLibraryItem()
else applyIncomingDirectorScript()
await applyIncomingQueuedJob()
applyStudioQueryFromRoute()
@@ -4386,21 +4390,28 @@ async function deleteDirectorScript() {
}
}
function applyIncomingLibraryItem() {
async function applyIncomingLibraryItem() {
const clipId = String(route.query.clip || '').trim()
const stillId = String(route.query.still || '').trim()
const use = String(route.query.use || '') === '1'
const studio = String(route.query.studio || '').toLowerCase()
if (clipId) {
const clip = clips.value.find(item => item.id === clipId)
if (clip) {
if (use) void useClipAsInput(clip)
if (use) await useClipAsInput(clip)
else openClip(clip)
}
} else if (stillId) {
const still = stills.value.find(item => item.id === stillId)
if (still) {
if (use) void useStillAsInput(still)
else openStill(still)
if (use) {
await useStillAsInput(still)
// Prefer Video for "use as input" unless the link explicitly asked for Image.
if (studio === 'image') selectStudioKind('image')
else selectStudioKind('video')
} else {
openStill(still)
}
}
}
void router.replace({ path: '/', query: {} })
@@ -6267,19 +6278,29 @@ async function loadStillAsEditRef(stillId: string) {
setEditRef(new File([blob], stillFileName(still) || 'still-b.png', { type: blob.type || 'image/png' }))
}
function stillUseAsInputMessage(still: LibraryStill) {
const dest = inferStillPipeline(still)
const mode = still.settings?.mode
if (dest === 'imagev2' && mode === 'generate') return 'Generate settings loaded. Tweak and generate.'
if (dest === 'imagev2' && mode === 'compose') {
return still.settings?.referenceStillId
? 'Compose settings loaded. Tweak and generate.'
: 'Compose settings loaded. Re-add still B, then generate.'
function stillUseAsInputMessage(_still: LibraryStill) {
return 'Loaded as input. Switch to Image only if you want to edit it there.'
}
async function useStillAsInput(still: LibraryStill) {
try {
// Use as input = put pixels in the start-still slot. Do NOT jump to Image studio
// or overwrite video settings — that trapped people on the Image tab.
folderId.value = still.folderId
browseFolderId.value = still.folderId
const generateOnly = inferStillPipeline(still) === 'imagev2' && still.settings?.mode === 'generate'
if (generateOnly) {
toast('That still is text-to-image only (no canvas to reuse). Pick a different image.')
return
}
const blob = await $fetch<Blob>(`/api/library/stills/${still.id}`, { responseType: 'blob' })
if (still.hideInput && showPrivacyToggles.value) hideInputPreview.value = true
readFile(new File([blob], stillFileName(still), { type: blob.type || 'image/png' }), { stillId: still.id })
scrollToStudioInput()
toast(stillUseAsInputMessage(still))
} catch (error: any) {
toast(error?.data?.statusMessage || 'Could not load that still')
}
if (dest === 'imagev2' && mode === 'refine') return 'Refine settings loaded. Paint a mask, then generate.'
if (dest === 'imagev2') return 'Image v2 settings loaded. Tweak and generate.'
if (dest === 'image' && still.settings) return 'Image edit settings loaded. Tweak and generate.'
return 'Loaded as input. It stays in Output, not the upload library.'
}
async function sendOutputStillToBackup() {
@@ -6342,30 +6363,6 @@ async function saveEditAsInput() {
}
}
async function useStillAsInput(still: LibraryStill) {
try {
applyStillSettings(still)
const dest = inferStillPipeline(still)
const generate = dest === 'imagev2' && still.settings?.mode === 'generate'
if (!generate) {
const blob = await $fetch<Blob>(`/api/library/stills/${still.id}`, { responseType: 'blob' })
if (still.hideInput && showPrivacyToggles.value) hideInputPreview.value = true
readFile(new File([blob], stillFileName(still), { type: blob.type || 'image/png' }), { stillId: still.id })
}
if (dest === 'imagev2' && still.settings?.mode === 'compose' && still.settings.referenceStillId) {
try {
await loadStillAsEditRef(still.settings.referenceStillId)
} catch {
toast('Compose settings loaded, but still B is missing. Re-add it.')
}
}
scrollToStudioInput()
toast(stillUseAsInputMessage(still))
} catch (error: any) {
toast(error?.data?.statusMessage || 'Could not load that still')
}
}
async function useClipAsInput(item: LibraryClip, collection = false) {
await rerun(item, collection)
scrollToStudioInput()
+2 -2
View File
@@ -1054,11 +1054,11 @@ function openInStudio(entry: LibraryEntry) {
function useInStudio(entry: LibraryEntry) {
if (entry.kind === 'clip' && entry.group) {
navigateTo({ path: '/', query: { clip: focusedPartId.value || entry.group.head.id, use: '1' } })
navigateTo({ path: '/', query: { clip: focusedPartId.value || entry.group.head.id, use: '1', studio: 'video' } })
return
}
if (entry.stillGroup) {
navigateTo({ path: '/', query: { still: focusedPartId.value || entry.stillGroup.head.id, use: '1' } })
navigateTo({ path: '/', query: { still: focusedPartId.value || entry.stillGroup.head.id, use: '1', studio: 'video' } })
}
}
+5 -1
View File
@@ -7,7 +7,7 @@
/>
<main class="mx-auto min-w-0 max-w-7xl space-y-6 px-4 py-6 sm:px-6">
<StudioKindCards current="music" />
<StudioKindCards current="music" @select="goStudio" />
<div class="grid min-w-0 gap-6 lg:grid-cols-[minmax(0,1fr)_minmax(0,1fr)] lg:items-stretch">
<section class="glass min-w-0 max-w-full space-y-5 rounded-3xl p-5 sm:p-6">
<div>
@@ -327,6 +327,10 @@ function selectEngineFamily(family: 'ace' | 'yue') {
}
}
function goStudio(kind: 'video' | 'image') {
void navigateTo({ path: '/', query: { studio: kind } })
}
function applyEngine(engine: MusicEngine) {
if (engine === 'yue') {
engineFamily.value = 'yue'