fix: dynamically suggest video tools based on env configuration
This commit is contained in:
+34
-7
@@ -1,7 +1,20 @@
|
||||
// System + user prompt construction for the LLM. Server-side only — the
|
||||
// browser never sees these prompts.
|
||||
|
||||
export const SYSTEM_PROMPT_ALL = `You are a music production assistant specializing in Suno AI song creation.
|
||||
export function getSystemPromptAll() {
|
||||
let tools = 'Runway Gen-3 Alpha, Kling AI, Luma Dream Machine, Pika 2.0, Haiper';
|
||||
const envLinks = process.env.VIDEO_AI_LINKS || '';
|
||||
if (envLinks.trim()) {
|
||||
const names = envLinks.split(',').map(part => {
|
||||
const idx = part.indexOf('=');
|
||||
return idx > 0 ? part.slice(0, idx).trim() : null;
|
||||
}).filter(Boolean);
|
||||
if (names.length > 0) {
|
||||
tools = names.join(', ');
|
||||
}
|
||||
}
|
||||
|
||||
return `You are a music production assistant specializing in Suno AI song creation.
|
||||
|
||||
The user will describe a music idea. Generate all song assets as a single JSON
|
||||
object. Output ONLY valid JSON — no markdown, no backticks, no preamble.
|
||||
@@ -49,10 +62,23 @@ REQUIRED JSON STRUCTURE:
|
||||
}
|
||||
|
||||
Keep each video_prompts[].prompt under 900 characters (excluding the Negative line).
|
||||
Recommended video tools (choose the best fit per prompt): Runway Gen-3 Alpha, Kling AI,
|
||||
Luma Dream Machine, Pika 2.0, Haiper. Never recommend Sora.`;
|
||||
Recommended video tools (choose the best fit per prompt): ${tools}. Never recommend Sora.`;
|
||||
}
|
||||
|
||||
const SYSTEM_PROMPT_PARTIAL = `You are a music production assistant specializing in Suno AI song creation.
|
||||
export function getSystemPromptPartial() {
|
||||
let tools = 'Runway Gen-3 Alpha, Kling AI, Luma Dream Machine, Pika 2.0, Haiper';
|
||||
const envLinks = process.env.VIDEO_AI_LINKS || '';
|
||||
if (envLinks.trim()) {
|
||||
const names = envLinks.split(',').map(part => {
|
||||
const idx = part.indexOf('=');
|
||||
return idx > 0 ? part.slice(0, idx).trim() : null;
|
||||
}).filter(Boolean);
|
||||
if (names.length > 0) {
|
||||
tools = names.join(', ');
|
||||
}
|
||||
}
|
||||
|
||||
return `You are a music production assistant specializing in Suno AI song creation.
|
||||
|
||||
The user has an existing song and wants to regenerate ONE section. Output ONLY
|
||||
valid JSON — no markdown, no backticks, no preamble.
|
||||
@@ -80,9 +106,10 @@ QUALITY CONSTRAINTS:
|
||||
- style: comma-separated, max 120 words, include tempo + BPM range, never
|
||||
name an artist, no "sounds like" phrases.
|
||||
- video_prompts: 5-second seamless loops, 16:9. Include the "Negative" line
|
||||
inside each prompt. Keep prompts under 900 characters.
|
||||
inside each prompt. Keep prompts under 900 characters. Recommended tools: ${tools}. Never recommend Sora.
|
||||
- youtube_description: follow the hook → description → divider → lyrics →
|
||||
divider → CTA → hashtags structure.`;
|
||||
}
|
||||
|
||||
export const SYSTEM_PROMPT_STYLE_NORMAL = `You are a Suno style-prompt generator.
|
||||
|
||||
@@ -139,8 +166,8 @@ Rules:
|
||||
|
||||
export function buildSystemPrompt(req) {
|
||||
if (req.section === 'lyrics_partial') return SYSTEM_PROMPT_LYRICS_PARTIAL;
|
||||
if (req.section === 'all') return SYSTEM_PROMPT_ALL;
|
||||
return SYSTEM_PROMPT_PARTIAL;
|
||||
if (req.section === 'all') return getSystemPromptAll();
|
||||
return getSystemPromptPartial();
|
||||
}
|
||||
|
||||
export function buildUserMessage(req) {
|
||||
|
||||
Reference in New Issue
Block a user