Show Krea in Image v2 sampler progress instead of Flux.2 Klein.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -244,10 +244,13 @@ export async function waitForImageEdit(opts: {
|
||||
promptId: string
|
||||
clientId: string
|
||||
timeoutMs?: number
|
||||
engineLabel?: string
|
||||
nodeLabel?: (node: string) => string | undefined
|
||||
onProgress?: (event: { message: string; progress: number; step?: number; maxStep?: number; node?: string | null }) => void
|
||||
isCancelled?: () => boolean
|
||||
}) {
|
||||
const timeoutMs = opts.timeoutMs || 180_000
|
||||
const engineLabel = String(opts.engineLabel || 'Flux.2 Klein').trim() || 'Flux.2 Klein'
|
||||
const started = Date.now()
|
||||
let settled = false
|
||||
let lastError: string | null = null
|
||||
@@ -281,19 +284,21 @@ export async function waitForImageEdit(opts: {
|
||||
if (payload.type === 'progress' && payload.data) {
|
||||
const max = Math.max(1, Number(payload.data.max || 4))
|
||||
const value = Number(payload.data.value || 0)
|
||||
const node = payload.data.node || null
|
||||
opts.onProgress?.({
|
||||
message: 'Sampling Flux.2 Klein...',
|
||||
message: `Sampling ${engineLabel}...`,
|
||||
progress: Math.min(90, 20 + Math.round((value / max) * 60)),
|
||||
step: value,
|
||||
maxStep: max,
|
||||
node: payload.data.node || null
|
||||
node
|
||||
})
|
||||
}
|
||||
if (payload.type === 'executing' && payload.data?.node) {
|
||||
const node = payload.data.node
|
||||
opts.onProgress?.({
|
||||
message: 'Running Flux.2 Klein...',
|
||||
progress: payload.data.node === '9' || payload.data.node === '94' || payload.data.node === '21' ? 92 : 30,
|
||||
node: payload.data.node
|
||||
message: opts.nodeLabel?.(node) || `Running ${engineLabel}...`,
|
||||
progress: node === '9' || node === '94' || node === '21' ? 92 : 30,
|
||||
node
|
||||
})
|
||||
}
|
||||
if (payload.type === 'execution_error') {
|
||||
@@ -327,7 +332,7 @@ export async function waitForImageEdit(opts: {
|
||||
if (result) return result
|
||||
throw createError({
|
||||
statusCode: 502,
|
||||
statusMessage: lastError || 'Image edit timed out waiting for Flux.2 Klein to finish'
|
||||
statusMessage: lastError || `Image edit timed out waiting for ${engineLabel} to finish`
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user