diff --git a/src/components/settings/sections/GeneralSettings.test.tsx b/src/components/settings/sections/GeneralSettings.test.tsx index 80c756e..c744b97 100644 --- a/src/components/settings/sections/GeneralSettings.test.tsx +++ b/src/components/settings/sections/GeneralSettings.test.tsx @@ -178,7 +178,7 @@ describe('GeneralSettings', () => { it('renders and persists the auto-compact threshold', async () => { renderSettings(); - const select = await screen.findByLabelText('Auto-Compact Threshold'); + const select = await screen.findByLabelText(translate('settings.general.autoCompactThreshold.label', undefined, 'en_us')); expect((select as HTMLSelectElement).value).toBe('90'); fireEvent.change(select, { target: { value: '80' } }); @@ -188,6 +188,14 @@ describe('GeneralSettings', () => { }); }); + it('renders the auto-compact threshold label from the zh_cn catalog', async () => { + renderSettings('zh_cn'); + + expect( + await screen.findByLabelText(translate('settings.general.autoCompactThreshold.label', undefined, 'zh_cn')), + ).toBeTruthy(); + }); + it('renders and persists local runtime download URLs', async () => { renderSettings(); diff --git a/src/components/settings/sections/GeneralSettings.tsx b/src/components/settings/sections/GeneralSettings.tsx index 2c15d8e..9d937af 100644 --- a/src/components/settings/sections/GeneralSettings.tsx +++ b/src/components/settings/sections/GeneralSettings.tsx @@ -426,7 +426,7 @@ const GeneralSettings: React.FC = () => {
- Compact the conversation before the next request when estimated context usage reaches this level. + {t('settings.general.autoCompactThreshold.help')}
diff --git a/src/i18n/messages/en_us.ts b/src/i18n/messages/en_us.ts index 4ebd7d9..7ad4dd0 100644 --- a/src/i18n/messages/en_us.ts +++ b/src/i18n/messages/en_us.ts @@ -44,6 +44,11 @@ export const enUsMessages: TranslationMessages = { 'settings.general.llmProvider.openaiCompatible': 'OpenAI Compatible (e.g. OpenRouter, Ollama)', 'settings.general.persistKeys.label': 'Persist API Keys on Non-Localhost', 'settings.general.persistKeys.help': 'When enabled, API keys will be saved to browser storage even on non-localhost environments. Warning: This may increase security vulnerability to XSS attacks.', + 'settings.general.autoCompactThreshold.label': 'Auto-Compact Threshold', + 'settings.general.autoCompactThreshold.help': 'Compact the conversation before the next request when estimated context usage reaches this level.', + 'settings.general.autoCompactThreshold.conservative': 'Conservative (95%)', + 'settings.general.autoCompactThreshold.standard': 'Standard (90%)', + 'settings.general.autoCompactThreshold.early': 'Early (80%)', 'settings.general.localRuntime.cachedStatus': 'Cached Model Status', 'settings.general.localRuntime.cacheChecking': 'Checking local model cache...', 'settings.general.localRuntime.cacheDownloaded': 'Downloaded in browser cache.', diff --git a/src/i18n/messages/fr_fr.ts b/src/i18n/messages/fr_fr.ts index 42b77a8..ba8a647 100644 --- a/src/i18n/messages/fr_fr.ts +++ b/src/i18n/messages/fr_fr.ts @@ -41,6 +41,11 @@ export const frFrMessages: TranslationMessages = { 'settings.general.llmProvider.openaiCompatible': 'Serveur compatible OpenAI (ex. OpenRouter, Ollama)', 'settings.general.persistKeys.label': 'Conserver les clés API hors localhost', 'settings.general.persistKeys.help': 'Si cette option est activée, les clés API sont enregistrées dans le stockage du navigateur même hors localhost. Attention : cela peut augmenter le risque lié aux attaques XSS.', + 'settings.general.autoCompactThreshold.label': 'Seuil d’auto-compactage', + 'settings.general.autoCompactThreshold.help': 'Compacte la conversation avant la prochaine requête lorsque l’utilisation estimée du contexte atteint ce niveau.', + 'settings.general.autoCompactThreshold.conservative': 'Prudent (95 %)', + 'settings.general.autoCompactThreshold.standard': 'Standard (90 %)', + 'settings.general.autoCompactThreshold.early': 'Précoce (80 %)', 'settings.general.localRuntime.cachedStatus': 'État du modèle en cache', 'settings.general.localRuntime.cacheChecking': 'Vérification du cache du modèle local...', 'settings.general.localRuntime.cacheDownloaded': 'Téléchargé dans le cache du navigateur.', diff --git a/src/i18n/messages/zh_cn.ts b/src/i18n/messages/zh_cn.ts index fd1f896..34210c0 100644 --- a/src/i18n/messages/zh_cn.ts +++ b/src/i18n/messages/zh_cn.ts @@ -42,6 +42,11 @@ export const zhCnMessages: TranslationMessages = { 'settings.general.llmProvider.openaiCompatible': 'OpenAI 兼容服务(例如 OpenRouter、Ollama)', 'settings.general.persistKeys.label': '在非 localhost 环境持久化 API Key', 'settings.general.persistKeys.help': '启用后,即使在非 localhost 环境下,API Key 也会保存到浏览器存储中。警告:这可能增加 XSS 攻击带来的安全风险。', + 'settings.general.autoCompactThreshold.label': '自动压缩阈值', + 'settings.general.autoCompactThreshold.help': '当预估上下文使用量达到此级别时,在下一次请求前压缩对话。', + 'settings.general.autoCompactThreshold.conservative': '保守(95%)', + 'settings.general.autoCompactThreshold.standard': '标准(90%)', + 'settings.general.autoCompactThreshold.early': '提前(80%)', 'settings.general.localRuntime.cachedStatus': '缓存模型状态', 'settings.general.localRuntime.cacheChecking': '正在检查本地模型缓存...', 'settings.general.localRuntime.cacheDownloaded': '已下载到浏览器缓存。', diff --git a/src/i18n/messages/zh_hk.ts b/src/i18n/messages/zh_hk.ts index fdcc596..0da2485 100644 --- a/src/i18n/messages/zh_hk.ts +++ b/src/i18n/messages/zh_hk.ts @@ -42,6 +42,11 @@ export const zhHkMessages: TranslationMessages = { 'settings.general.llmProvider.openaiCompatible': 'OpenAI 兼容服務(例如 OpenRouter、Ollama)', 'settings.general.persistKeys.label': '在非 localhost 環境持久化 API Key', 'settings.general.persistKeys.help': '啟用後,即使在非 localhost 環境下,API Key 也會儲存到瀏覽器儲存空間中。警告:這可能增加 XSS 攻擊帶來的安全風險。', + 'settings.general.autoCompactThreshold.label': '自動壓縮閾值', + 'settings.general.autoCompactThreshold.help': '當預估上下文使用量達到此級別時,在下一次請求前壓縮對話。', + 'settings.general.autoCompactThreshold.conservative': '保守(95%)', + 'settings.general.autoCompactThreshold.standard': '標準(90%)', + 'settings.general.autoCompactThreshold.early': '提前(80%)', 'settings.general.localRuntime.cachedStatus': '緩存模型狀態', 'settings.general.localRuntime.cacheChecking': '正在檢查本地模型緩存...', 'settings.general.localRuntime.cacheDownloaded': '已下載到瀏覽器緩存。',