From ceaf533b0580436e4adbf11333da02ceff6e67e2 Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 18 Feb 2026 16:01:42 +0000 Subject: [PATCH 1/2] fix: translate template section headings to target language for non-English users Co-Authored-By: john@hyprnote.com --- crates/template-app/assets/enhance.system.md.jinja | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/template-app/assets/enhance.system.md.jinja b/crates/template-app/assets/enhance.system.md.jinja index d7c468090a..cae2a1fc01 100644 --- a/crates/template-app/assets/enhance.system.md.jinja +++ b/crates/template-app/assets/enhance.system.md.jinja @@ -34,6 +34,7 @@ You are an expert at creating structured, comprehensive meeting summaries in {{ - Pay close attention to emphasized text in raw notes. Users highlight information using four styles: bold(**text**), italic(_text_), underline(text), strikethrough(~~text~~). - Recognize H3 headers (### Header) in raw notes—these indicate highly important topics that the user wants to retain no matter what. {% if !(language|is_english) %} +- Translate all section headings to {{ language | language }}. Template section titles are provided in English for reference only — always output them in {{ language | language }}. - Keep technical terms (e.g., API, SDK, frontend, backend) and globally recognized product names (e.g., React, Vue.js, Django) in English. - When using technical terms in sentences, follow the grammatical rules of {{ language | language }}. {% endif %} From f61fc60384141eff937c6c99276e4e6e60291420 Mon Sep 17 00:00:00 2001 From: ComputelessComputer Date: Thu, 19 Feb 2026 16:51:55 +0900 Subject: [PATCH 2/2] feat: improve AI language support for section generation Add language parameter to createTemplatePrompt and createValidator functions to enable proper localization of generated content. Update template prompt to include language-specific instructions when non-English language is specified. Modify validator logic to skip template section validation for non-English languages to allow proper localization. Enhance system prompt to explicitly require section headings in target language without English fallbacks, ensuring cleaner output for international users. --- .../ai-task/task-configs/enhance-workflow.ts | 32 +++++++++++++------ .../assets/enhance.system.md.jinja | 2 +- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/apps/desktop/src/store/zustand/ai-task/task-configs/enhance-workflow.ts b/apps/desktop/src/store/zustand/ai-task/task-configs/enhance-workflow.ts index d7640a9cd3..8ccdd48b50 100644 --- a/apps/desktop/src/store/zustand/ai-task/task-configs/enhance-workflow.ts +++ b/apps/desktop/src/store/zustand/ai-task/task-configs/enhance-workflow.ts @@ -143,7 +143,7 @@ async function generateTemplateIfNeeded(params: { model, schema, signal, - prompt: createTemplatePrompt(userPrompt, schema), + prompt: createTemplatePrompt(userPrompt, schema, args.language), }); if (!result) { @@ -162,11 +162,16 @@ async function generateTemplateIfNeeded(params: { function createTemplatePrompt( userPrompt: string, schema: z.ZodObject, + language: string | null, ): string { + const languageInstruction = language + ? `\n IMPORTANT: Generate all section titles in ${language} language.` + : ""; + return `Analyze this meeting content and suggest appropriate section headings for a comprehensive summary. The sections should cover the main themes and topics discussed. Generate around 5-7 sections based on the content depth. - Give me in bullet points. + Give me in bullet points.${languageInstruction} Content: --- @@ -237,7 +242,7 @@ async function* generateSummary(params: { onProgress({ type: "generating" }); - const validator = createValidator(args.template); + const validator = createValidator(args.template, args.language); yield* withEarlyValidationRetry( (retrySignal, { previousFeedback }) => { @@ -285,17 +290,24 @@ IMPORTANT: Previous attempt failed. ${previousFeedback}`; ); } -function createValidator(template: EnhanceTemplate | null): EarlyValidatorFn { +function createValidator( + template: EnhanceTemplate | null, + language: string | null, +): EarlyValidatorFn { + const isNonEnglish = + language != null && language !== "en" && !language.startsWith("en-"); + return (textSoFar: string) => { const normalized = textSoFar.trim(); - if (!template?.sections || template.sections.length === 0) { - if (!normalized.startsWith("# ")) { - const feedback = - "Output must start with a markdown h1 heading (# Title)."; - return { valid: false, feedback }; - } + if (!normalized.startsWith("# ")) { + return { + valid: false, + feedback: "Output must start with a markdown h1 heading (# Title).", + }; + } + if (isNonEnglish || !template?.sections || template.sections.length === 0) { return { valid: true }; } diff --git a/crates/template-app/assets/enhance.system.md.jinja b/crates/template-app/assets/enhance.system.md.jinja index cae2a1fc01..08d1eb0d41 100644 --- a/crates/template-app/assets/enhance.system.md.jinja +++ b/crates/template-app/assets/enhance.system.md.jinja @@ -34,7 +34,7 @@ You are an expert at creating structured, comprehensive meeting summaries in {{ - Pay close attention to emphasized text in raw notes. Users highlight information using four styles: bold(**text**), italic(_text_), underline(text), strikethrough(~~text~~). - Recognize H3 headers (### Header) in raw notes—these indicate highly important topics that the user wants to retain no matter what. {% if !(language|is_english) %} -- Translate all section headings to {{ language | language }}. Template section titles are provided in English for reference only — always output them in {{ language | language }}. +- Section headings must be written entirely in {{ language | language }}. Do not include the original English title. For example, if in Korean, use "재무 및 운영 현황" instead of "Company Performance - 재무 및 운영 현황". - Keep technical terms (e.g., API, SDK, frontend, backend) and globally recognized product names (e.g., React, Vue.js, Django) in English. - When using technical terms in sentences, follow the grammatical rules of {{ language | language }}. {% endif %}