Keep family pre/post text on shot queues and wrap the mid prompt at Comfy time.
Later shots were starting a new job without those wrappers, so only the first clip got them. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+15
-5
@@ -15,6 +15,11 @@ export function composePromptParts(pre: string, prompt: string, post: string) {
|
||||
.join('\n\n')
|
||||
}
|
||||
|
||||
export type PromptWrapperFields = {
|
||||
promptPre?: string
|
||||
promptPost?: string
|
||||
}
|
||||
|
||||
/** Combine wrappers for Comfy. If mid already includes pre/post, do not wrap twice. */
|
||||
export function joinPromptParts(pre?: string, mid?: string, post?: string) {
|
||||
const parts = restorePromptParts(mid || '', {
|
||||
@@ -25,6 +30,16 @@ 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. */
|
||||
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)
|
||||
}
|
||||
|
||||
export function applyPromptParts(parts: PromptParts, middle: string) {
|
||||
return composePromptParts(parts.pre, middle, parts.post)
|
||||
}
|
||||
@@ -46,11 +61,6 @@ export function restorePromptParts(saved: string, stored?: Partial<PromptParts>
|
||||
}
|
||||
}
|
||||
|
||||
export type PromptWrapperFields = {
|
||||
promptPre?: string
|
||||
promptPost?: string
|
||||
}
|
||||
|
||||
function hasWrapperKey(item: object | null | undefined, key: 'promptPre' | 'promptPost') {
|
||||
return Boolean(item && Object.prototype.hasOwnProperty.call(item, key))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user