Add explicit CRITICAL language instruction for intro generation

This commit is contained in:
Russell Ballestrini 2026-01-03 14:06:37 -05:00
parent 2fecc5848a
commit e1366fe2c7

View file

@ -1915,7 +1915,12 @@ You have complete knowledge of this page content and can reference any details,
// Get user's preferred language and localize the system prompt
const userLang = getUserLanguagePreference();
const languageName = NATIVE_LANGUAGE_NAMES[userLang] || "English";
// Build explicit language instruction for non-English languages
const langInstruction = userLang !== "en"
? `\n\nCRITICAL: You MUST write your ENTIRE response in ${languageName}. Do NOT write in English. Every word of your introduction must be in ${languageName}.`
: "";
const introSystemPrompt = `${getUIText("systemPromptIntro")}
PAGE INFORMATION:
@ -1930,9 +1935,11 @@ ${getUIText("systemPromptTask1")}
${getUIText("systemPromptTask2")}
${getUIText("systemPromptTask3")}
${getUIText("systemPromptInstructions")} ${languageName}.`;
${getUIText("systemPromptInstructions")} ${languageName}.${langInstruction}`;
const introPrompt = "Generate the welcoming introduction message now.";
const introPrompt = userLang !== "en"
? `Generate the welcoming introduction message now. Remember: Write ONLY in ${languageName}, not English.`
: "Generate the welcoming introduction message now.";
// Create temporary chat history for intro generation
const introHistory = [