diff --git a/public/src/uncloseai-embed-modal.js b/public/src/uncloseai-embed-modal.js index d1844e6..79c5249 100644 --- a/public/src/uncloseai-embed-modal.js +++ b/public/src/uncloseai-embed-modal.js @@ -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 = [