Use content-hash names for Qwen VL still uploads too.
Keeps the same overwrite behavior as video/image Comfy uploads so prompt jobs do not leave unique copies in Shared input. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
|
import { comfyInputFilename } from '~/server/utils/comfy'
|
||||||
import { getSidecarImageHost } from '~/server/utils/imageComfy'
|
import { getSidecarImageHost } from '~/server/utils/imageComfy'
|
||||||
import { ensureSidecarReady } from '~/server/utils/imageComfyLifecycle'
|
import { ensureSidecarReady } from '~/server/utils/imageComfyLifecycle'
|
||||||
import { buildVisionPromptWorkflow } from '~/server/utils/promptWorkflow'
|
import { buildVisionPromptWorkflow } from '~/server/utils/promptWorkflow'
|
||||||
import { normalizeShotScript } from '~/utils/parseRecommend'
|
import { normalizeShotScript } from '~/utils/parseRecommend'
|
||||||
import { comfyJobPrefix } from '~/utils/outputNames'
|
|
||||||
|
|
||||||
export type PromptJobStatus = 'queued' | 'running' | 'complete' | 'error'
|
export type PromptJobStatus = 'queued' | 'running' | 'complete' | 'error'
|
||||||
|
|
||||||
@@ -42,18 +42,10 @@ async function promptComfyFetch(path: string, init?: RequestInit) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function promptInputFilename(original: string, jobId?: string) {
|
|
||||||
const raw = String(original || 'still.png')
|
|
||||||
const dot = raw.lastIndexOf('.')
|
|
||||||
const ext = (dot >= 0 ? raw.slice(dot) : '.png').replace(/[^.a-zA-Z0-9]/g, '') || '.png'
|
|
||||||
const base = (dot >= 0 ? raw.slice(0, dot) : raw).replace(/[^a-zA-Z0-9._-]+/g, '_').slice(0, 48) || 'still'
|
|
||||||
return `${comfyJobPrefix(jobId)}_${base}${ext}`
|
|
||||||
}
|
|
||||||
|
|
||||||
async function uploadPromptImage(file: { filename: string; data: Buffer; type?: string }, jobId?: string) {
|
async function uploadPromptImage(file: { filename: string; data: Buffer; type?: string }, jobId?: string) {
|
||||||
const body = new FormData()
|
const body = new FormData()
|
||||||
const blob = new Blob([new Uint8Array(file.data)], { type: file.type || 'application/octet-stream' })
|
const blob = new Blob([new Uint8Array(file.data)], { type: file.type || 'application/octet-stream' })
|
||||||
const filename = promptInputFilename(file.filename, jobId)
|
const filename = comfyInputFilename(file.filename, file.data, jobId)
|
||||||
body.append('image', blob, filename)
|
body.append('image', blob, filename)
|
||||||
body.append('overwrite', 'true')
|
body.append('overwrite', 'true')
|
||||||
body.append('type', 'input')
|
body.append('type', 'input')
|
||||||
|
|||||||
Reference in New Issue
Block a user