@mixio-pro/kalaasetu-mcp 1.2.2 → 2.0.2-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fal-config.json +106 -0
- package/package.json +2 -1
- package/src/index.ts +5 -9
- package/src/tools/fal/config.ts +120 -23
- package/src/tools/fal/generate.ts +361 -103
- package/src/tools/fal/index.ts +2 -7
- package/src/tools/fal/models.ts +157 -32
- package/src/tools/gemini.ts +40 -2
- package/src/tools/get-status.ts +174 -0
- package/src/tools/image-to-video.ts +334 -119
- package/src/utils/llm-prompt-enhancer.ts +302 -0
- package/src/utils/prompt-enhancer-presets.ts +303 -0
- package/src/utils/prompt-enhancer.ts +186 -0
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LLM-Powered Prompt Enhancer
|
|
3
|
+
*
|
|
4
|
+
* Uses Gemini 3 Fast to intelligently rewrite prompts based on
|
|
5
|
+
* prompting guides for specific models (e.g., LTX-2).
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { GoogleGenAI } from "@google/genai";
|
|
9
|
+
|
|
10
|
+
const ai = new GoogleGenAI({
|
|
11
|
+
apiKey: process.env.GEMINI_API_KEY || "",
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* LTX-2 Prompting Guide embedded as system context.
|
|
16
|
+
* Based on: https://ltx.io/model/model-blog/prompting-guide-for-ltx-2
|
|
17
|
+
* Complete guide with examples for optimal prompt rewriting.
|
|
18
|
+
*/
|
|
19
|
+
const LTX2_PROMPTING_GUIDE = `
|
|
20
|
+
You are an expert prompt engineer for LTX-2, a state-of-the-art video generation model.
|
|
21
|
+
Your task is to rewrite the user's prompt following the official LTX-2 prompting guide.
|
|
22
|
+
|
|
23
|
+
The key is painting a complete picture of the story you're telling that flows naturally from beginning to end, covering all the elements the model needs to bring your vision to life.
|
|
24
|
+
|
|
25
|
+
## EXAMPLE PROMPTS (study these patterns)
|
|
26
|
+
|
|
27
|
+
### Example 1 - Action Scene:
|
|
28
|
+
"An action packed, cinematic shot of a monster truck driving fast towards the camera, the truck passes the cameras it pans left to follow the trucks reckless drive. dust and motion blur is around the truck, hand held feel to the camera as it tries to track its ride into the distance. the truck then drifts and turns around, then drives back towards the camera until seen in extreme close up."
|
|
29
|
+
|
|
30
|
+
### Example 2 - Dialogue Scene:
|
|
31
|
+
"A warm sunny backyard. The camera starts in a tight cinematic close-up of a woman and a man in their 30s, facing each other with serious expressions. The woman, emotional and dramatic, says softly, 'That's it... Dad's lost it. And we've lost Dad.' The man exhales, slightly annoyed: 'Stop being so dramatic, Jess.' A beat. He glances aside, then mutters defensively, 'He's just having fun.' The camera slowly pans right, revealing the grandfather in the garden wearing enormous butterfly wings, waving his arms in the air like he's trying to take off. He shouts, 'Wheeeew!' as he flaps his wings with full commitment."
|
|
32
|
+
|
|
33
|
+
### Example 3 - Interior Scene:
|
|
34
|
+
"INT. OVEN – DAY. Static camera from inside the oven, looking outward through the slightly fogged glass door. Warm golden light glows around freshly baked cookies. The baker's face fills the frame, eyes wide with focus, his breath fogging the glass as he leans in. Subtle reflections move across the glass as steam rises. Baker (whispering dramatically): 'Today… I achieve perfection.' He leans even closer, nose nearly touching the glass. 'Golden edges. Soft center. The gods themselves will smell these cookies and weep.'"
|
|
35
|
+
|
|
36
|
+
### Example 4 - Performance Scene:
|
|
37
|
+
"A warm, intimate cinematic performance inside a cozy, wood-paneled bar, lit with soft amber practical lights and shallow depth of field that creates glowing bokeh in the background. The shot opens in a medium close-up on a young female singer in her 20s with short brown hair and bangs, singing into a microphone while strumming an acoustic guitar, her eyes closed and posture relaxed. The camera slowly arcs left around her, keeping her face and mic in sharp focus as two male band members playing guitars remain softly blurred behind her. Warm light wraps around her face and hair as framed photos and wooden walls drift past in the background. Ambient live music fills the space, led by her clear vocals over gentle acoustic strumming."
|
|
38
|
+
|
|
39
|
+
## KEY ASPECTS TO INCLUDE
|
|
40
|
+
|
|
41
|
+
1. **Establish the shot**: Use cinematography terms (wide shot, medium close-up, over-the-shoulder, static frame, handheld). Include scale or category characteristics.
|
|
42
|
+
|
|
43
|
+
2. **Set the scene**: Describe lighting conditions (warm golden light, soft amber, neon glow, dramatic shadows), color palette (warm, muted, high contrast), textures, and atmospheric elements (fog, rain, dust, smoke).
|
|
44
|
+
|
|
45
|
+
3. **Describe the action as a NARRATIVE SEQUENCE**: Write the core action flowing naturally from BEGINNING to END. Include what happens first, then next, then after that. Actions should progress temporally.
|
|
46
|
+
|
|
47
|
+
4. **Define characters**: Include age, hairstyle, clothing, and distinguishing details. Express emotions through PHYSICAL CUES (posture, gesture, facial expression) - NOT internal states.
|
|
48
|
+
|
|
49
|
+
5. **Camera movements**: Specify clearly using terms like: pans left/right, dollys back, slow push in, handheld tracking, arcs around, tilts upward, pulls back. Describe how subjects appear AFTER camera motion.
|
|
50
|
+
|
|
51
|
+
6. **Audio and dialogue**: Describe ambient sounds, music quality. For speech, use quotation marks. Mention dialogue style (whispers, shouts, mutters).
|
|
52
|
+
|
|
53
|
+
## FOR BEST RESULTS
|
|
54
|
+
|
|
55
|
+
- Keep prompt as a SINGLE FLOWING PARAGRAPH
|
|
56
|
+
- Use PRESENT TENSE verbs (speeds, roars, pans, reveals)
|
|
57
|
+
- Match detail to shot scale (closeups need more detail than wide shots)
|
|
58
|
+
- Write 4-8 descriptive sentences
|
|
59
|
+
- Focus on camera's relationship to subject
|
|
60
|
+
- Create a temporal narrative arc (beginning → middle → end)
|
|
61
|
+
|
|
62
|
+
## TECHNICAL TERMS TO USE
|
|
63
|
+
|
|
64
|
+
Camera language: follows, tracks, pans across, circles around, tilts upward, pushes in, pulls back, overhead view, handheld movement, over-the-shoulder, wide establishing shot, static frame
|
|
65
|
+
|
|
66
|
+
Film characteristics: lens flares, film grain, shallow depth of field, bokeh
|
|
67
|
+
|
|
68
|
+
Pacing: slow motion, lingering shot, continuous shot, seamless transition, dynamic movement
|
|
69
|
+
|
|
70
|
+
## WHAT WORKS WELL WITH LTX-2
|
|
71
|
+
|
|
72
|
+
- Cinematic compositions with thoughtful lighting and shallow depth of field
|
|
73
|
+
- Emotive human moments, subtle gestures, facial nuance
|
|
74
|
+
- Weather effects: fog, mist, golden hour light, soft shadows, rain, reflections
|
|
75
|
+
- Clean camera language: "slow dolly in", "handheld tracking", "over-the-shoulder"
|
|
76
|
+
- Stylized aesthetics: painterly, noir, analog film, fashion editorial
|
|
77
|
+
- Lighting/mood control: backlighting, color palettes, soft rim light
|
|
78
|
+
|
|
79
|
+
## WHAT TO AVOID
|
|
80
|
+
|
|
81
|
+
- Internal emotional states without visual cues (don't say "sad", show the expression)
|
|
82
|
+
- Text, logos, signage, brand names (LTX-2 can't render text)
|
|
83
|
+
- Complex physics: jumping, juggling, chaotic motion
|
|
84
|
+
- Too many characters or layered actions
|
|
85
|
+
- Conflicting light sources
|
|
86
|
+
- Over-complicated prompts
|
|
87
|
+
|
|
88
|
+
## YOUR TASK
|
|
89
|
+
|
|
90
|
+
Transform the user's simple prompt into a rich, cinematic LTX-2 prompt that:
|
|
91
|
+
1. Establishes a clear shot type and scene
|
|
92
|
+
2. Describes a NARRATIVE SEQUENCE of action from beginning to end
|
|
93
|
+
3. Includes specific camera movements
|
|
94
|
+
4. Sets atmosphere through lighting and color
|
|
95
|
+
5. Uses present tense throughout
|
|
96
|
+
6. Flows as a single cohesive paragraph
|
|
97
|
+
|
|
98
|
+
Output ONLY the enhanced prompt. No explanations, no markdown, no labels - just the enhanced cinematic prompt.
|
|
99
|
+
`;
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* Veo 3.1 Prompting Guide for image-to-video generation.
|
|
103
|
+
* Based on Shorts / Veo Shot Planning Guidelines.
|
|
104
|
+
*/
|
|
105
|
+
const VEO_PROMPTING_GUIDE = `
|
|
106
|
+
You are an expert prompt engineer for Google Veo 3.1, a state-of-the-art image-to-video generation model.
|
|
107
|
+
Your task is to rewrite the user's prompt following the Veo Shot Planning Guidelines.
|
|
108
|
+
|
|
109
|
+
## VEO 3.1 PROMPTING ESSENTIALS
|
|
110
|
+
|
|
111
|
+
### The 5-Part Scene Formula
|
|
112
|
+
Structure every Veo prompt as: [Cinematography] + [Subject] + [Action] + [Context] + [Style & Ambiance]
|
|
113
|
+
|
|
114
|
+
1. **Cinematography**: Shot type + camera behavior
|
|
115
|
+
- Examples: "Vertical 9:16 CLOSE-UP, eye-level, SINGLE LOCKED SHOT"
|
|
116
|
+
- Examples: "MEDIUM TWO-SHOT with a slow push-in toward the subject"
|
|
117
|
+
- Examples: "Wide establishing shot, static frame"
|
|
118
|
+
|
|
119
|
+
2. **Subject**: Who/what the shot is about
|
|
120
|
+
- Describe character details: age, clothing, position in frame
|
|
121
|
+
- Who is in focus vs background
|
|
122
|
+
|
|
123
|
+
3. **Action**: What is happening
|
|
124
|
+
- Describe motion from beginning to end
|
|
125
|
+
- For dialogue: ordered speaker cues with exact lines in quotes
|
|
126
|
+
|
|
127
|
+
4. **Context**: Where it happens
|
|
128
|
+
- Background description
|
|
129
|
+
- "Simple and softly blurred background"
|
|
130
|
+
- "No people walking through frame"
|
|
131
|
+
|
|
132
|
+
5. **Style & Ambiance**: Overall mood
|
|
133
|
+
- Lighting quality
|
|
134
|
+
- Color palette
|
|
135
|
+
- Sound/audio descriptions
|
|
136
|
+
|
|
137
|
+
### Camera Behavior - BE EXPLICIT
|
|
138
|
+
|
|
139
|
+
For LOCKED shots:
|
|
140
|
+
- "SINGLE LOCKED SHOT - NO pans, NO cuts, NO angle changes"
|
|
141
|
+
- "Camera and framing remain completely static"
|
|
142
|
+
|
|
143
|
+
For START→END interpolation:
|
|
144
|
+
- "Single continuous shot interpolating naturally from the START frame to the END frame"
|
|
145
|
+
- Describe the motion: "gentle push-in", "slow pan right", "subtle arc around subject"
|
|
146
|
+
|
|
147
|
+
### Background Control
|
|
148
|
+
- "Simple and softly blurred conference-room/office/street background"
|
|
149
|
+
- "No people walking through frame"
|
|
150
|
+
- "No new characters entering or exiting the frame"
|
|
151
|
+
- "Any background figures must remain completely still and very out of focus"
|
|
152
|
+
|
|
153
|
+
### Always Include These Negative Instructions
|
|
154
|
+
- "No on-screen text or subtitles"
|
|
155
|
+
- "No black bars"
|
|
156
|
+
- "No camera shake" (unless specifically wanted)
|
|
157
|
+
|
|
158
|
+
### Dialogue Shots
|
|
159
|
+
For dialogue, include:
|
|
160
|
+
- Ordered speaker cues with visual identifiers
|
|
161
|
+
- Exact dialogue in quotes
|
|
162
|
+
- Voice assignments: "natural male/female voice"
|
|
163
|
+
- "Only ONE character should speak at a time; no overlapping speech"
|
|
164
|
+
- "Short natural pauses between turns"
|
|
165
|
+
|
|
166
|
+
### Emotion Through Physical Cues
|
|
167
|
+
- DON'T say "sad" or "angry" - show it through posture, gesture, expression
|
|
168
|
+
- Examples: "bowed and humble", "firm but controlled", "eyes downcast", "slight smile"
|
|
169
|
+
|
|
170
|
+
## EXAMPLE PROMPTS
|
|
171
|
+
|
|
172
|
+
### Example 1 - Simple Action:
|
|
173
|
+
"Vertical 9:16 MEDIUM SHOT, eye-level, SINGLE LOCKED SHOT. A young woman in a blue dress stands in a sunlit garden, her hair gently moving in the breeze. She slowly raises her hand to touch a blooming flower, her expression soft and contemplative. Warm golden hour lighting wraps around her. Background is softly blurred foliage. No on-screen text. No people in background."
|
|
174
|
+
|
|
175
|
+
### Example 2 - Dialogue:
|
|
176
|
+
"Vertical 9:16 CLOSE-UP TWO-SHOT, SINGLE LOCKED SHOT. MR. KIM (man in dark suit) sits at head of conference table, GUXIXI (young woman in pink uniform) stands opposite. 1) MR. KIM says firmly: 'This is your final warning.' 2) GUXIXI, eyes downcast, responds quietly: 'I understand, sir.' Generate clear dialogue audio with natural male voice for Kim, female voice for Guxixi. One voice at a time with natural pauses. Soft office ambient sound. No on-screen text."
|
|
177
|
+
|
|
178
|
+
### Example 3 - Camera Movement:
|
|
179
|
+
"Vertical 9:16 MEDIUM SHOT with gentle push-in. Single continuous shot interpolating from START frame to END frame. The shot begins on a wide view of the dancer, then slowly pushes in to a close-up of her face as she completes her spin. Soft rim lighting from behind. Ambient music continues throughout. No cuts, no angle changes. No on-screen text."
|
|
180
|
+
|
|
181
|
+
## YOUR TASK
|
|
182
|
+
|
|
183
|
+
Transform the user's prompt into a Veo-optimized prompt that:
|
|
184
|
+
1. Uses the 5-part scene formula
|
|
185
|
+
2. Explicitly states camera behavior (locked OR interpolating)
|
|
186
|
+
3. Describes subject and action clearly
|
|
187
|
+
4. Includes negative instructions (no on-screen text, no people in background)
|
|
188
|
+
5. If dialogue present: includes ordered speaker cues and voice assignments
|
|
189
|
+
|
|
190
|
+
The user is providing a START image (and optionally END image) separately via API parameters.
|
|
191
|
+
Focus the prompt on describing what happens visually and aurally - not on technical API details.
|
|
192
|
+
|
|
193
|
+
Output ONLY the enhanced prompt. No explanations, no markdown, no labels.
|
|
194
|
+
`;
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Configuration for LLM-based prompt enhancement.
|
|
198
|
+
*/
|
|
199
|
+
export interface LLMEnhancerConfig {
|
|
200
|
+
/** The model to use for enhancement */
|
|
201
|
+
model?: string;
|
|
202
|
+
/** System prompt/guide for the enhancer */
|
|
203
|
+
systemPrompt?: string;
|
|
204
|
+
/** Maximum tokens for the enhanced prompt */
|
|
205
|
+
maxTokens?: number;
|
|
206
|
+
/** Temperature for generation (lower = more deterministic) */
|
|
207
|
+
temperature?: number;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* Built-in enhancer configurations for different video models.
|
|
212
|
+
*/
|
|
213
|
+
export const LLM_ENHANCER_CONFIGS: Record<string, LLMEnhancerConfig> = {
|
|
214
|
+
ltx2: {
|
|
215
|
+
model: "gemini-2.0-flash",
|
|
216
|
+
systemPrompt: LTX2_PROMPTING_GUIDE,
|
|
217
|
+
maxTokens: 1024,
|
|
218
|
+
temperature: 0.4,
|
|
219
|
+
},
|
|
220
|
+
veo: {
|
|
221
|
+
model: "gemini-2.0-flash",
|
|
222
|
+
systemPrompt: VEO_PROMPTING_GUIDE,
|
|
223
|
+
maxTokens: 1024,
|
|
224
|
+
temperature: 0.4,
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Enhance a prompt using Gemini LLM.
|
|
230
|
+
*
|
|
231
|
+
* @param prompt - The user's original prompt
|
|
232
|
+
* @param configOrName - Either a config name (e.g., "ltx2") or a custom LLMEnhancerConfig
|
|
233
|
+
* @param images - Optional array of image paths/URLs to include in context
|
|
234
|
+
* @returns The enhanced prompt
|
|
235
|
+
*/
|
|
236
|
+
export async function enhancePromptWithLLM(
|
|
237
|
+
prompt: string,
|
|
238
|
+
configOrName: string | LLMEnhancerConfig = "ltx2",
|
|
239
|
+
images?: string[]
|
|
240
|
+
): Promise<string> {
|
|
241
|
+
// Resolve config - ltx2 is always available as default
|
|
242
|
+
let config: LLMEnhancerConfig;
|
|
243
|
+
|
|
244
|
+
if (typeof configOrName === "string") {
|
|
245
|
+
const lookedUp = LLM_ENHANCER_CONFIGS[configOrName];
|
|
246
|
+
config = lookedUp ?? LLM_ENHANCER_CONFIGS["ltx2"]!;
|
|
247
|
+
} else {
|
|
248
|
+
config = configOrName;
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
const model = config.model || "gemini-2.0-flash";
|
|
252
|
+
const systemPrompt = config.systemPrompt || LTX2_PROMPTING_GUIDE;
|
|
253
|
+
|
|
254
|
+
// Build content parts
|
|
255
|
+
const contents: any[] = [];
|
|
256
|
+
|
|
257
|
+
// Add images if provided
|
|
258
|
+
if (images && images.length > 0) {
|
|
259
|
+
for (const imagePath of images) {
|
|
260
|
+
// For now, just mention the image in the prompt
|
|
261
|
+
// Full image support would require reading and encoding the image
|
|
262
|
+
contents.push(`[Image provided: ${imagePath}]`);
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
// Add the user's prompt
|
|
267
|
+
contents.push(`User's original prompt:\n${prompt}\n\nEnhanced prompt:`);
|
|
268
|
+
|
|
269
|
+
try {
|
|
270
|
+
const response = await ai.models.generateContent({
|
|
271
|
+
model,
|
|
272
|
+
contents: contents.join("\n"),
|
|
273
|
+
config: {
|
|
274
|
+
systemInstruction: systemPrompt,
|
|
275
|
+
maxOutputTokens: config.maxTokens || 1024,
|
|
276
|
+
temperature: config.temperature || 0.7,
|
|
277
|
+
},
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
// Extract text from response
|
|
281
|
+
const enhancedPrompt =
|
|
282
|
+
response.candidates?.[0]?.content?.parts?.[0]?.text?.trim();
|
|
283
|
+
|
|
284
|
+
if (!enhancedPrompt) {
|
|
285
|
+
console.warn("LLM enhancement returned empty, using original prompt");
|
|
286
|
+
return prompt;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
return enhancedPrompt;
|
|
290
|
+
} catch (error: any) {
|
|
291
|
+
console.error(`LLM prompt enhancement failed: ${error.message}`);
|
|
292
|
+
// Fall back to original prompt on error
|
|
293
|
+
return prompt;
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Check if Gemini API key is configured.
|
|
299
|
+
*/
|
|
300
|
+
export function isLLMEnhancerAvailable(): boolean {
|
|
301
|
+
return !!process.env.GEMINI_API_KEY;
|
|
302
|
+
}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt Enhancer Presets
|
|
3
|
+
*
|
|
4
|
+
* A factory/dictionary of predefined prompt enhancer configurations.
|
|
5
|
+
* Organized by use case: image generation, video generation, and specialized styles.
|
|
6
|
+
*
|
|
7
|
+
* Based on best practices from LTX-2 prompting guide and industry standards.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { PromptEnhancer, type PromptEnhancerConfig } from "./prompt-enhancer";
|
|
11
|
+
|
|
12
|
+
// =============================================================================
|
|
13
|
+
// IMAGE GENERATION PRESETS
|
|
14
|
+
// =============================================================================
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Presets optimized for image generation (Gemini Imagen, Flux, SD, etc.)
|
|
18
|
+
*/
|
|
19
|
+
export const IMAGE_PRESETS: Record<string, PromptEnhancerConfig> = {
|
|
20
|
+
/**
|
|
21
|
+
* Cinematic still photography style
|
|
22
|
+
*/
|
|
23
|
+
cinematic: {
|
|
24
|
+
styleGuide:
|
|
25
|
+
"cinematic composition, dramatic lighting, shallow depth of field, film grain, 4K, hyperdetailed",
|
|
26
|
+
negativeElements:
|
|
27
|
+
"blurry, low quality, pixelated, distorted, watermark, text, logo",
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Photorealistic, DSLR-quality imagery
|
|
32
|
+
*/
|
|
33
|
+
photorealistic: {
|
|
34
|
+
styleGuide:
|
|
35
|
+
"photorealistic, ultra-detailed, natural lighting, DSLR quality, 8K resolution, sharp focus",
|
|
36
|
+
negativeElements:
|
|
37
|
+
"cartoon, anime, illustration, painting, blurry, distorted, artificial",
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Anime and manga illustration style
|
|
42
|
+
*/
|
|
43
|
+
anime: {
|
|
44
|
+
styleGuide:
|
|
45
|
+
"anime style, vibrant colors, cel-shaded, detailed linework, Studio Ghibli inspired",
|
|
46
|
+
negativeElements:
|
|
47
|
+
"photorealistic, 3D render, Western cartoon, blurry, low detail",
|
|
48
|
+
},
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Abstract and modern art
|
|
52
|
+
*/
|
|
53
|
+
abstract: {
|
|
54
|
+
styleGuide:
|
|
55
|
+
"abstract art, geometric shapes, bold colors, modern art, contemporary, expressive brushstrokes",
|
|
56
|
+
negativeElements:
|
|
57
|
+
"photorealistic, detailed faces, text, logo, realistic proportions",
|
|
58
|
+
},
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Vintage and retro aesthetic
|
|
62
|
+
*/
|
|
63
|
+
vintage: {
|
|
64
|
+
styleGuide:
|
|
65
|
+
"vintage aesthetic, retro, film grain, 1970s color palette, warm tones, nostalgic, analog photography",
|
|
66
|
+
negativeElements:
|
|
67
|
+
"modern, digital, clean, sharp, contemporary, high contrast",
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Fashion editorial photography
|
|
72
|
+
*/
|
|
73
|
+
fashion_editorial: {
|
|
74
|
+
styleGuide:
|
|
75
|
+
"fashion editorial, high-end photography, professional lighting, Vogue style, elegant composition, soft rim light",
|
|
76
|
+
negativeElements:
|
|
77
|
+
"casual, amateur, blurry, bad lighting, unflattering angle",
|
|
78
|
+
},
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Fantasy illustration
|
|
82
|
+
*/
|
|
83
|
+
fantasy: {
|
|
84
|
+
styleGuide:
|
|
85
|
+
"fantasy art, epic composition, magical atmosphere, detailed, painterly, dramatic lighting, ethereal",
|
|
86
|
+
negativeElements: "modern, realistic, mundane, blurry, low detail",
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Minimalist design
|
|
91
|
+
*/
|
|
92
|
+
minimalist: {
|
|
93
|
+
styleGuide:
|
|
94
|
+
"minimalist design, clean lines, negative space, simple composition, modern, elegant, refined",
|
|
95
|
+
negativeElements: "cluttered, busy, detailed, ornate, complex, messy",
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
// =============================================================================
|
|
100
|
+
// VIDEO GENERATION PRESETS
|
|
101
|
+
// Based on LTX-2 Prompting Guide best practices
|
|
102
|
+
// =============================================================================
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Presets optimized for video generation (LTX, Luma, Veo, etc.)
|
|
106
|
+
* Following LTX-2 guidelines:
|
|
107
|
+
* - Establish the shot with cinematography terms
|
|
108
|
+
* - Set the scene with lighting/atmosphere
|
|
109
|
+
* - Describe action as natural sequence
|
|
110
|
+
* - Define camera movements clearly
|
|
111
|
+
*/
|
|
112
|
+
export const VIDEO_PRESETS: Record<string, PromptEnhancerConfig> = {
|
|
113
|
+
/**
|
|
114
|
+
* LTX-2 specific preset based on official prompting guide.
|
|
115
|
+
* Key principles:
|
|
116
|
+
* - Establish shot with cinematography terms
|
|
117
|
+
* - Set scene with lighting/atmosphere
|
|
118
|
+
* - Describe action as natural flowing sequence
|
|
119
|
+
* - Use clean, readable camera language
|
|
120
|
+
* - Focus on emotive moments, atmosphere, and stylized aesthetics
|
|
121
|
+
*/
|
|
122
|
+
ltx2: {
|
|
123
|
+
// No prefix - LTX-2 wants complete flowing scenes, not formulaic starts
|
|
124
|
+
suffix:
|
|
125
|
+
"The camera captures this with thoughtful cinematography, shallow depth of field, and natural motion.",
|
|
126
|
+
styleGuide:
|
|
127
|
+
"cinematic composition, present tense, flowing narrative, clear camera language, atmospheric lighting, emotive expressions through physical cues",
|
|
128
|
+
negativeElements:
|
|
129
|
+
"text, logos, signage, brand names, complex physics, chaotic motion, jumping, juggling, conflicting light sources, overloaded scene, too many characters, internal emotional states without visual cues",
|
|
130
|
+
},
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Cinematic video with dramatic camera work
|
|
134
|
+
*/
|
|
135
|
+
cinematic_video: {
|
|
136
|
+
prefix: "A cinematic shot.",
|
|
137
|
+
styleGuide:
|
|
138
|
+
"smooth camera movement, professional cinematography, dramatic lighting, shallow depth of field, film grain, cinematic color grading",
|
|
139
|
+
negativeElements:
|
|
140
|
+
"shaky camera, low quality, pixelated, glitchy, jerky motion, text overlay",
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Documentary-style realistic footage
|
|
145
|
+
*/
|
|
146
|
+
documentary: {
|
|
147
|
+
prefix: "Documentary footage.",
|
|
148
|
+
styleGuide:
|
|
149
|
+
"natural lighting, handheld camera feel, authentic, observational, steady tracking shot",
|
|
150
|
+
negativeElements:
|
|
151
|
+
"staged, artificial, over-produced, fantasy elements, special effects",
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Action-packed dynamic shots
|
|
156
|
+
*/
|
|
157
|
+
action: {
|
|
158
|
+
prefix: "An action packed shot.",
|
|
159
|
+
styleGuide:
|
|
160
|
+
"dynamic camera movement, motion blur, intense, fast-paced, dramatic angles, handheld feel",
|
|
161
|
+
negativeElements:
|
|
162
|
+
"static, slow, boring, calm, peaceful, stable tripod shot",
|
|
163
|
+
},
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Slow and atmospheric
|
|
167
|
+
*/
|
|
168
|
+
atmospheric: {
|
|
169
|
+
styleGuide:
|
|
170
|
+
"slow camera movement, atmospheric, moody lighting, fog or mist, ambient, lingering shot, soft focus background",
|
|
171
|
+
negativeElements:
|
|
172
|
+
"fast motion, harsh lighting, chaotic, busy, cluttered scene",
|
|
173
|
+
},
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Talking head / dialogue scene
|
|
177
|
+
*/
|
|
178
|
+
dialogue: {
|
|
179
|
+
prefix: "A warm, intimate scene.",
|
|
180
|
+
styleGuide:
|
|
181
|
+
"medium close-up, soft lighting, natural conversation, over-the-shoulder shots, subtle camera movement, realistic acting",
|
|
182
|
+
negativeElements:
|
|
183
|
+
"wide shot, action, fast movement, loud, chaotic, unrealistic",
|
|
184
|
+
},
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Product showcase / commercial
|
|
188
|
+
*/
|
|
189
|
+
commercial: {
|
|
190
|
+
styleGuide:
|
|
191
|
+
"smooth dolly movement, professional studio lighting, clean background, product focus, slow rotation, sharp detail, premium aesthetic",
|
|
192
|
+
negativeElements:
|
|
193
|
+
"cluttered, dark, amateur, shaky, low quality, distraction",
|
|
194
|
+
},
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* Animation / stylized motion
|
|
198
|
+
*/
|
|
199
|
+
animated: {
|
|
200
|
+
styleGuide:
|
|
201
|
+
"animated style, expressive movement, stylized timing, smooth transitions, character animation, vibrant colors",
|
|
202
|
+
negativeElements: "photorealistic, live action, jerky, static, dull colors",
|
|
203
|
+
},
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* Establish wide shot for scene setting
|
|
207
|
+
*/
|
|
208
|
+
establishing: {
|
|
209
|
+
prefix: "Wide establishing shot.",
|
|
210
|
+
styleGuide:
|
|
211
|
+
"expansive view, slow pan or static frame, epic scale, atmospheric, cinematic composition, golden hour lighting",
|
|
212
|
+
negativeElements:
|
|
213
|
+
"close-up, cluttered, indoor, tight framing, rapid movement",
|
|
214
|
+
},
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Intimate close-up for emotional moments
|
|
218
|
+
*/
|
|
219
|
+
closeup_emotional: {
|
|
220
|
+
prefix: "An intimate close-up.",
|
|
221
|
+
styleGuide:
|
|
222
|
+
"tight framing on face, shallow depth of field, emotional expression, soft lighting, subtle movement, eyes in focus",
|
|
223
|
+
negativeElements:
|
|
224
|
+
"wide shot, distant, cold lighting, static expression, fast movement",
|
|
225
|
+
},
|
|
226
|
+
};
|
|
227
|
+
|
|
228
|
+
// =============================================================================
|
|
229
|
+
// COMBINED PRESETS DICTIONARY
|
|
230
|
+
// =============================================================================
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* All available prompt enhancer presets.
|
|
234
|
+
*/
|
|
235
|
+
export const PROMPT_ENHANCER_PRESETS: Record<string, PromptEnhancerConfig> = {
|
|
236
|
+
...IMAGE_PRESETS,
|
|
237
|
+
...VIDEO_PRESETS,
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
// =============================================================================
|
|
241
|
+
// HELPER FUNCTIONS
|
|
242
|
+
// =============================================================================
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Get a PromptEnhancer for a named preset.
|
|
246
|
+
* Returns undefined if the preset doesn't exist.
|
|
247
|
+
*/
|
|
248
|
+
export function getPromptEnhancer(
|
|
249
|
+
presetName: string
|
|
250
|
+
): PromptEnhancer | undefined {
|
|
251
|
+
const config = PROMPT_ENHANCER_PRESETS[presetName];
|
|
252
|
+
if (!config) {
|
|
253
|
+
return undefined;
|
|
254
|
+
}
|
|
255
|
+
return PromptEnhancer.fromConfig(config);
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
/**
|
|
259
|
+
* List all available enhancer preset names.
|
|
260
|
+
*/
|
|
261
|
+
export function listEnhancerPresets(): string[] {
|
|
262
|
+
return Object.keys(PROMPT_ENHANCER_PRESETS);
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/**
|
|
266
|
+
* List image-specific enhancer preset names.
|
|
267
|
+
*/
|
|
268
|
+
export function listImageEnhancerPresets(): string[] {
|
|
269
|
+
return Object.keys(IMAGE_PRESETS);
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* List video-specific enhancer preset names.
|
|
274
|
+
*/
|
|
275
|
+
export function listVideoEnhancerPresets(): string[] {
|
|
276
|
+
return Object.keys(VIDEO_PRESETS);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
/**
|
|
280
|
+
* Resolve an enhancer from either a preset name (string) or inline config.
|
|
281
|
+
* Returns PASSTHROUGH enhancer if resolution fails.
|
|
282
|
+
*/
|
|
283
|
+
export function resolveEnhancer(
|
|
284
|
+
input: string | PromptEnhancerConfig | undefined
|
|
285
|
+
): PromptEnhancer {
|
|
286
|
+
if (!input) {
|
|
287
|
+
return PromptEnhancer.PASSTHROUGH;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
if (typeof input === "string") {
|
|
291
|
+
const enhancer = getPromptEnhancer(input);
|
|
292
|
+
if (!enhancer) {
|
|
293
|
+
console.warn(
|
|
294
|
+
`Prompt enhancer preset '${input}' not found, using passthrough.`
|
|
295
|
+
);
|
|
296
|
+
return PromptEnhancer.PASSTHROUGH;
|
|
297
|
+
}
|
|
298
|
+
return enhancer;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
// It's an inline config object
|
|
302
|
+
return PromptEnhancer.fromConfig(input);
|
|
303
|
+
}
|