Name outputs from the input, engine, and LoRA keys instead of aigen_0001. Image-edit presets now store prompts, and aspect fill pads stills without stretching.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Towsty
2026-08-30 16:24:49 -05:00
co-authored by Cursor
parent 4d411f83d4
commit 0e1222d035
23 changed files with 668 additions and 93 deletions
+16 -3
View File
@@ -7,6 +7,7 @@ import { ensureComfyLoraNames } from '~/server/utils/loras'
import { imageDimensions } from '~/server/utils/resolution'
import { emitChainJob } from '~/server/utils/watch'
import { saveStill, stillChainName } from '~/server/utils/library'
import { comfyJobPrefix } from '~/utils/outputNames'
export type EditImageFile = { filename: string; data: Buffer; type?: string }
@@ -19,6 +20,7 @@ export type EditRunParams = {
steps: number
seed: number
cfg: number
aspect?: string
loraName?: string
loraStack?: import('~/utils/loras').LoraStackItem[]
scaleToTotalPixels?: boolean
@@ -46,12 +48,22 @@ export async function runEdit(job: Job, params: EditRunParams) {
job.imageComfyHost = getComfyHost()
await withImageComfyHost(job.imageComfyHost, async () => {
let current = params.image
const { applyImageFill } = await import('~/server/utils/imagePad')
const { composeFillPrompt } = await import('~/utils/imageAspect')
const filled = await applyImageFill({ image: params.image, aspect: params.aspect || 'auto' })
if (filled.padded) {
emitChainJob(job, {
type: 'status',
message: `Filling to ${filled.aspect} without stretching...`,
progress: 7
})
}
let current = filled.image
let parentStillId: string | undefined
for (let index = 0; index < prompts.length; index++) {
if (job.status === 'cancelled') throw new Error('Job interrupted.')
if (index > 0 && library.stopAfterCurrent === true) break
const prompt = prompts[index]
const prompt = index === 0 ? composeFillPrompt(prompts[index], filled.padded) : prompts[index]
const last = index === prompts.length - 1
if (index > 0) {
await ensureComfyReady((status) => {
@@ -104,7 +116,7 @@ export async function runEdit(job: Job, params: EditRunParams) {
steps: params.steps,
seed,
cfg: params.cfg,
filenamePrefix: `aigen_edit_${job.id.slice(0, 8)}_p${index + 1}`,
filenamePrefix: `${comfyJobPrefix(job.id)}_p${index + 1}`,
loraStack: params.loraStack || params.loraName,
scaleToTotalPixels: params.scaleToTotalPixels,
scaleMegapixels: params.scaleMegapixels
@@ -161,6 +173,7 @@ export async function runEdit(job: Job, params: EditRunParams) {
seed,
scaleToTotalPixels: params.scaleToTotalPixels === true,
scaleMegapixels: params.scaleMegapixels,
aspect: params.aspect || 'auto',
loraName: params.loraName,
loraStack: params.loraStack,
sourceStillId: library.stillId