feat: section Profil (langue) + ghost text lie a la langue
- Section Profil dans Configuration: langue (fr/en/es/de), nom - Persistance localStorage (obsigate-lang, obsigate-name) - Ghost text adapte le prompt a la langue du profil - CSS profile-form, config-select stylise
This commit is contained in:
@@ -1822,19 +1822,24 @@ body { font-family: var(--sans); background: var(--bg); color: var(--text); heig
|
||||
var lastChar = fullText.slice(-1);
|
||||
var midWord = /[a-zA-Z0-9\u00C0-\u024F]$/.test(lastChar);
|
||||
|
||||
// Get user's preferred language
|
||||
var lang = 'fr';
|
||||
try { lang = localStorage.getItem('obsigate-lang') || 'fr'; } catch(e) {}
|
||||
var langNames = { fr: 'French', en: 'English', es: 'Spanish', de: 'German' };
|
||||
var langName = langNames[lang] || 'French';
|
||||
|
||||
var prompt, inputText;
|
||||
if (midWord) {
|
||||
var wordMatch = fullText.match(/([\w\u00C0-\u024F]+)$/);
|
||||
var partialWord = wordMatch ? wordMatch[1] : fullText;
|
||||
inputText = partialWord;
|
||||
// Provide surrounding context so the model can guess the word
|
||||
var context = fullText.slice(0, -partialWord.length).trim();
|
||||
prompt = 'Complete this French word. The word is: "' + partialWord +
|
||||
prompt = 'Complete this ' + langName + ' word. The word is: "' + partialWord +
|
||||
'". Context: "' + (context || '(start of line)') +
|
||||
'". Return ONLY the remaining letters of the word. Example: if word is "famil" return "ial" for "familial". Do NOT add spaces.';
|
||||
'". Return ONLY the remaining letters. Do NOT add spaces. Example: "famil" → "ial" for "familial".';
|
||||
} else {
|
||||
inputText = fullText;
|
||||
prompt = 'Continue this text. Return ONLY the new text (do NOT repeat what is already written):\n' + fullText;
|
||||
prompt = 'Continue this ' + langName + ' text naturally. Return ONLY the new text (do NOT repeat):\n' + fullText;
|
||||
}
|
||||
|
||||
fetch('/api/ai/inline-complete', {
|
||||
|
||||
Reference in New Issue
Block a user