fix: increase reformulate word limit to 2000 + i18n error messages
Some checks failed
Deploy to Production / Build and Deploy (push) Failing after 4s

- Raise MAX_WORDS from 500 to 2000 for text reformulation
- Error messages now use i18n keys (ai.wordCountMin/Max) instead of
  hardcoded English strings
- Client translates server errors using the user's UI language

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
2026-04-30 21:09:13 +02:00
parent fa72672aac
commit 907dcf33d6
5 changed files with 24 additions and 6 deletions

View File

@@ -205,7 +205,13 @@ export function ContextualAIChat({
body: JSON.stringify(action.body(noteContent, undefined, language)),
})
const data = await res.json()
if (!res.ok) throw new Error(data.error || t('ai.genericError'))
if (!res.ok) {
// Use i18n key if provided by the server
if (data.errorKey) {
throw new Error(t(data.errorKey, data.params || {}))
}
throw new Error(data.error || t('ai.genericError'))
}
const result = data[action.resultKey] || ''
setActionPreview({ label: t(action.i18nKey), text: result })
} catch (e: any) {