Join pre/prompt/post into the first MiniMax prompt, not only later shots.
The motion prompt field is what Comfy actually runs. Wrappers are now composed into that string on submit, and shot 1 falls back to it if the separate pre/post fields do not arrive. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+33
-3
@@ -30,14 +30,44 @@ export function joinPromptParts(pre?: string, mid?: string, post?: string) {
|
||||
return composePromptParts(parts.pre, parts.prompt, parts.post)
|
||||
}
|
||||
|
||||
/** Prefer stored mid so an already-joined prompt is not the source of truth. */
|
||||
/** Prefer stored mid when wrappers exist. If wrappers are missing, use the already-joined fallback. */
|
||||
export function wrappedPromptForComfy(
|
||||
wrappers?: PromptWrapperFields | null,
|
||||
mid?: string,
|
||||
fallback?: string
|
||||
) {
|
||||
const body = sanitizePromptPart(mid || '').trim() || sanitizePromptPart(fallback || '').trim()
|
||||
return joinPromptParts(wrappers?.promptPre, body, wrappers?.promptPost)
|
||||
const pre = sanitizePromptPart(wrappers?.promptPre || '').trim()
|
||||
const post = sanitizePromptPart(wrappers?.promptPost || '').trim()
|
||||
const fallbackText = sanitizePromptPart(fallback || '').trim()
|
||||
const midText = sanitizePromptPart(mid || '').trim()
|
||||
if (pre || post) {
|
||||
return composePromptParts(pre, peelPromptWrappers(midText || fallbackText, pre, post), post)
|
||||
}
|
||||
return fallbackText || midText
|
||||
}
|
||||
|
||||
export function ingestPromptParts(fields: {
|
||||
prompt?: unknown
|
||||
promptMid?: unknown
|
||||
promptPre?: unknown
|
||||
promptPost?: unknown
|
||||
}) {
|
||||
const promptPre = sanitizePromptPart(fields.promptPre).trim()
|
||||
const promptPost = sanitizePromptPart(fields.promptPost).trim()
|
||||
const postedPrompt = sanitizePromptPart(fields.prompt).trim()
|
||||
const postedMid = sanitizePromptPart(fields.promptMid).trim()
|
||||
const promptMid = postedMid || restorePromptParts(postedPrompt, {
|
||||
pre: promptPre,
|
||||
prompt: postedPrompt,
|
||||
post: promptPost
|
||||
}).prompt
|
||||
const fromParts = composePromptParts(promptPre, promptMid, promptPost)
|
||||
return {
|
||||
promptPre,
|
||||
promptPost,
|
||||
promptMid,
|
||||
prompt: (promptPre || promptPost) ? fromParts : (postedPrompt || fromParts)
|
||||
}
|
||||
}
|
||||
|
||||
export function applyPromptParts(parts: PromptParts, middle: string) {
|
||||
|
||||
Reference in New Issue
Block a user