···66/** Storage key for the configurable API base URL. */
77export const STORAGE_KEY_API_URL = "apiBaseUrl";
8899-/** Shared tone rules appended to every prompt. */
1010-const TONE_RULES = `# Tone
1111-When responding, you must follow these rules:
1212-- follow the original tone and style
1313-- answer directly from your knowledge when you can
1414-- be concise, prioritize clarity, brevity and don't repeat yourself
1515-- admit when you're unsure rather than making things up`;
99+/** Supported prompt languages. */
1010+export type Language = "en" | "fr";
16111717-/**
1818- * System prompt for grammar/spelling correction.
1919- * Instructs the model to return only the corrected text.
2020- */
2121-export const CORRECT_PROMPT = `# Agent Guidelines
1212+/** Storage key for the selected prompt language. */
1313+export const STORAGE_KEY_LANGUAGE = "language";
1414+1515+/** Default prompt language. */
1616+export const DEFAULT_LANGUAGE: Language = "en";
1717+1818+/** Per-language prompts for correction and suggestion. */
1919+export const PROMPTS: Record<Language, { correct: string; suggest: string }> = {
2020+ en: {
2121+ correct: `# Agent Guidelines
2222You are an agent specialized in english and french grammar correction.
2323Correct the grammar, spelling, and punctuation of the submitted text in its original language.
24242525# Output
2626Return ONLY the corrected text. No headings, no explanations, no markdown formatting.
27272828-${TONE_RULES}`;
2828+# Tone
2929+When responding, you must follow these rules:
3030+- follow the original tone and style
3131+- answer directly from your knowledge when you can
3232+- be concise, prioritize clarity, brevity and don't repeat yourself
3333+- admit when you're unsure rather than making things up`,
29343030-/**
3131- * System prompt for wording improvement.
3232- * Instructs the model to return a better-worded version of the text.
3333- */
3434-export const SUGGEST_PROMPT = `# Agent Guidelines
3535+ suggest: `# Agent Guidelines
3536You are an agent specialized in english and french writing improvement.
3637Rewrite the submitted text with better wording and phrasing.
3738Keep the original language if no translation is asked (english/english or french/french).
3838-Keep the same tone as the original text.
39394040# Output
4141Return ONLY the improved text. Try to keep the same format and return lines. No headings, no explanations, no markdown formatting.
42424343-${TONE_RULES}`;
4343+# Tone
4444+When responding, you must follow these rules:
4545+- answer directly from your knowledge when you can
4646+- be concise, prioritize clarity, brevity and don't repeat yourself
4747+- admit when you're unsure rather than making things up`,
4848+ },
4949+5050+ fr: {
5151+ correct: `# Directives de l'agent
5252+Tu es un agent spécialisé dans la correction grammaticale française.
5353+Corrige la grammaire, l'orthographe et la ponctuation du texte soumis dans sa langue d'origine.
5454+5555+# Sortie
5656+Retourne UNIQUEMENT le texte corrigé. Pas de titres, pas d'explications, pas de formatage markdown.
5757+5858+# Ton
5959+Lors de ta réponse, tu dois suivre ces règles :
6060+- respecter le ton et le style d'origine
6161+- répondre directement à partir de tes connaissances quand tu le peux
6262+- être concis, privilégier la clarté et la brièveté, ne pas te répéter
6363+- avouer quand tu n'es pas sûr plutôt qu'inventer`,
6464+6565+ suggest: `# Directives de l'agent
6666+Tu es un agent spécialisé dans l'amélioration rédactionnelle française.
6767+Réécris le texte soumis avec un meilleur choix de mots et de tournures.
6868+Conserve la langue d'origine si aucune traduction n'est demandée (anglais/anglais ou français/français).
6969+7070+# Sortie
7171+Retourne UNIQUEMENT le texte amélioré. Essaie de conserver le même format et les mêmes retours à la ligne. Pas de titres, pas d'explications, pas de formatage markdown.
7272+7373+# Ton
7474+Lors de ta réponse, tu dois suivre ces règles :
7575+- répondre directement à partir de tes connaissances quand tu le peux
7676+- être concis, privilégier la clarté et la brièveté, ne pas te répéter
7777+- avouer quand tu n'es pas sûr plutôt qu'inventer`,
7878+ },
7979+};
44804581/** Parameters sent to the chat completions endpoint (generation/sampling subset). */
4682export const API_PARAMS: Pick<ApiChatCompletionRequest,
···64100 presence_penalty: 0.0,
65101 stream: true,
66102};
103103+104104+/** Enable debug logging of llama.cpp SSE chunks in the service worker console. */
105105+export const DEBUG = false;
6710668107/** HTTP request timeout in milliseconds. */
69108export const API_TIMEOUT_MS = 30_000;