41 lines
2.0 KiB
TypeScript
41 lines
2.0 KiB
TypeScript
function extraPictureNumbers(extraRefs: number | number[]) {
|
|
if (Array.isArray(extraRefs)) {
|
|
return [...new Set(extraRefs.map(Number).filter(n => n >= 2 && n <= 5))].sort((a, b) => a - b)
|
|
}
|
|
const extras = Math.max(0, Math.min(4, extraRefs))
|
|
return Array.from({ length: extras }, (_, i) => i + 2)
|
|
}
|
|
|
|
export function identityBoilerplate(extraRefs: number | number[] = 0) {
|
|
const extras = extraPictureNumbers(extraRefs)
|
|
const secondary = extras.length === 0
|
|
? ''
|
|
: extras.length === 1
|
|
? ` <Picture ${extras[0]}> is a secondary reference angle for profile details.`
|
|
: ` ${extras.map(n => `<Picture ${n}>`).join(' and ')} are secondary reference angles for profile features only.`
|
|
return `<Picture 1> is the primary identity anchor defining exact facial geometry, hairstyle, and body proportions.${secondary} Strictly maintain the structural proportions of <Picture 1> with high fidelity when moving.`
|
|
}
|
|
|
|
export function looksLikeIdentityPrompt(text: string) {
|
|
return /^<Picture 1> is the (primary identity anchor|exact facial identity)/i.test(String(text || '').trim())
|
|
}
|
|
|
|
export function buildIdentityPrompt(actionPrompt: string, extraRefs: number | number[] = 0) {
|
|
const action = String(actionPrompt || '').trim()
|
|
if (looksLikeIdentityPrompt(action)) return action
|
|
const boilerplate = identityBoilerplate(extraRefs)
|
|
return action ? `${boilerplate}\n\n${action}` : boilerplate
|
|
}
|
|
|
|
export const IDENTITY_ACTION_TEMPLATE = `[SHOT CONFIGURATION]
|
|
- Shot Type: Medium close-up, 50mm lens, eye-level
|
|
- Camera Movement: Slow tracking dolly-in following the subject
|
|
- Lighting: Warm golden-hour rim lighting with soft directional fill from screen left
|
|
- Environment/Scenery: Dense pine forest, soft ambient ground mist
|
|
|
|
[SUBJECT DIRECTION & ACTION]
|
|
The subject from <Picture 1> walks slowly through the path, glancing toward camera-left in awe. She turns slightly, speaking softly: "Look at the way the light hits the trees."
|
|
|
|
[AUDIO CUES]
|
|
Ambient forest breeze, soft footsteps on twigs, warm cinematic background strings.`
|