fix: dynamically suggest video tools based on env configuration

This commit is contained in:
2026-06-04 11:21:23 +02:00
parent ab5a967fe4
commit ecd75a7fb5
+34 -7
View File
@@ -1,7 +1,20 @@
// System + user prompt construction for the LLM. Server-side only — the // System + user prompt construction for the LLM. Server-side only — the
// browser never sees these prompts. // 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 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. 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). 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, Recommended video tools (choose the best fit per prompt): ${tools}. Never recommend Sora.`;
Luma Dream Machine, Pika 2.0, Haiper. 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 The user has an existing song and wants to regenerate ONE section. Output ONLY
valid JSON — no markdown, no backticks, no preamble. 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 - style: comma-separated, max 120 words, include tempo + BPM range, never
name an artist, no "sounds like" phrases. name an artist, no "sounds like" phrases.
- video_prompts: 5-second seamless loops, 16:9. Include the "Negative" line - 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 → - youtube_description: follow the hook → description → divider → lyrics →
divider → CTA → hashtags structure.`; divider → CTA → hashtags structure.`;
}
export const SYSTEM_PROMPT_STYLE_NORMAL = `You are a Suno style-prompt generator. export const SYSTEM_PROMPT_STYLE_NORMAL = `You are a Suno style-prompt generator.
@@ -139,8 +166,8 @@ Rules:
export function buildSystemPrompt(req) { export function buildSystemPrompt(req) {
if (req.section === 'lyrics_partial') return SYSTEM_PROMPT_LYRICS_PARTIAL; if (req.section === 'lyrics_partial') return SYSTEM_PROMPT_LYRICS_PARTIAL;
if (req.section === 'all') return SYSTEM_PROMPT_ALL; if (req.section === 'all') return getSystemPromptAll();
return SYSTEM_PROMPT_PARTIAL; return getSystemPromptPartial();
} }
export function buildUserMessage(req) { export function buildUserMessage(req) {