Send V2 identity prompts to Reference to Video instead of Image to Video.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -73,7 +73,8 @@ export function buildWorkflow(params: GenerateParams) {
|
||||
const refs = Array.from({ length: 4 }, (_, index) => String(params.referenceImageNames?.[index] || '').trim())
|
||||
const extraPictures = refs.flatMap((name, index) => name ? [index + 2] : [])
|
||||
const useRefs = version === 'v2' && params.useIdentityRefs === true
|
||||
const graphPrompt = useRefs ? buildIdentityPrompt(params.prompt, extraPictures) : params.prompt
|
||||
const actionPrompt = params.prompt
|
||||
const graphPrompt = useRefs ? buildIdentityPrompt(actionPrompt, extraPictures) : actionPrompt
|
||||
|
||||
for (const [id, node] of Object.entries(graph)) {
|
||||
if (IMAGE_CLASSES.has(node.class_type) && 'image' in node.inputs && id === '114') {
|
||||
@@ -81,19 +82,20 @@ export function buildWorkflow(params: GenerateParams) {
|
||||
}
|
||||
|
||||
if (PROMPT_CLASSES.has(node.class_type) || node.class_type.includes('Qwen3')) {
|
||||
if ('prompt' in node.inputs) node.inputs.prompt = graphPrompt
|
||||
if ('text' in node.inputs) node.inputs.text = graphPrompt
|
||||
const nodePrompt = promptForNode(node.class_type, useRefs, actionPrompt, graphPrompt)
|
||||
if ('prompt' in node.inputs) node.inputs.prompt = nodePrompt
|
||||
if ('text' in node.inputs) node.inputs.text = nodePrompt
|
||||
}
|
||||
|
||||
if (node.class_type === 'MiniMaxH3ImageToVideo') {
|
||||
node.inputs.prompt = graphPrompt
|
||||
node.inputs.prompt = useRefs ? '' : actionPrompt
|
||||
if (typeof node.inputs.width === 'number') node.inputs.width = width
|
||||
if (typeof node.inputs.height === 'number') node.inputs.height = height
|
||||
if (typeof node.inputs.length === 'number') node.inputs.length = params.length
|
||||
}
|
||||
|
||||
if (node.class_type === 'MiniMaxH3ReferenceToVideo') {
|
||||
node.inputs.prompt = graphPrompt
|
||||
node.inputs.prompt = useRefs ? graphPrompt : actionPrompt
|
||||
if (!Array.isArray(node.inputs.length)) node.inputs.length = ['174', 1]
|
||||
}
|
||||
|
||||
@@ -206,6 +208,12 @@ export function buildWorkflow(params: GenerateParams) {
|
||||
return graph
|
||||
}
|
||||
|
||||
function promptForNode(classType: string, useRefs: boolean, actionPrompt: string, graphPrompt: string) {
|
||||
if (classType === 'MiniMaxH3ImageToVideo') return useRefs ? '' : actionPrompt
|
||||
if (classType === 'MiniMaxH3ReferenceToVideo') return useRefs ? graphPrompt : actionPrompt
|
||||
return graphPrompt
|
||||
}
|
||||
|
||||
function applyV2IdentityPath(
|
||||
graph: WorkflowGraph,
|
||||
params: GenerateParams,
|
||||
|
||||
Reference in New Issue
Block a user