Headless image-to-video UI queues jobs on the desktop ComfyUI instance with live SSE progress and Authentik SSO.
50 lines
1.5 KiB
TypeScript
50 lines
1.5 KiB
TypeScript
// Nitro bundles this JSON into the production server output.
|
|
import workflowTemplate from '../assets/workflow_api.json'
|
|
|
|
export interface GenerateParams {
|
|
prompt: string
|
|
imageName: string
|
|
width: number
|
|
height: number
|
|
steps: number
|
|
seed: number
|
|
turbo: boolean
|
|
length: number
|
|
}
|
|
|
|
type WorkflowGraph = Record<string, { class_type: string; inputs: Record<string, unknown>; _meta?: { title?: string } }>
|
|
|
|
export function buildWorkflow(params: GenerateParams) {
|
|
const graph = structuredClone(workflowTemplate) as WorkflowGraph
|
|
graph['1'].inputs.image = params.imageName
|
|
graph['8'].inputs.prompt = params.prompt
|
|
graph['8'].inputs.width = params.width
|
|
graph['8'].inputs.height = params.height
|
|
graph['8'].inputs.length = params.length
|
|
graph['9'].inputs.noise_seed = params.seed
|
|
graph['11'].inputs.steps = params.steps
|
|
graph['7'].inputs.switch = params.turbo
|
|
graph['6'].inputs.strength_model = params.turbo ? 1 : 0
|
|
return graph
|
|
}
|
|
|
|
export const NODE_LABELS: Record<string, string> = {
|
|
'1': 'Loading image',
|
|
'2': 'Loading Qwen3-VL encoder',
|
|
'3': 'Loading MiniMax H3 model',
|
|
'4': 'Loading video VAE',
|
|
'5': 'Loading audio VAE',
|
|
'6': 'Applying turbo LoRA',
|
|
'7': 'Selecting model path',
|
|
'8': 'Encoding prompt & latent',
|
|
'9': 'Preparing seed',
|
|
'10': 'Selecting sampler',
|
|
'11': 'Building schedule',
|
|
'12': 'Preparing guider',
|
|
'13': 'Sampling',
|
|
'14': 'Decoding video frames',
|
|
'15': 'Decoding audio',
|
|
'16': 'Encoding video',
|
|
'17': 'Saving MP4'
|
|
}
|