Enhance API key handling in settings and vocab services: Update key retrieval logic to improve validation and status reporting. Introduce new localization strings for key status messages in English, German, and Spanish. Update LanguageAssistantView to display key status dynamically, enhancing user feedback on API key management.

This commit is contained in:
Torsten Schulz (local)
2026-03-25 17:46:18 +01:00
parent af6e12d80a
commit c97c1bca8f
6 changed files with 44 additions and 9 deletions

View File

@@ -428,14 +428,16 @@ class SettingsService extends BaseService{
}
}
const hasKey = Boolean(keyRow && keyRow.value && String(keyRow.value).trim());
const hasStoredKey = Boolean(keyRow && keyRow.getDataValue('value') && String(keyRow.getDataValue('value')).trim());
const hasReadableKey = Boolean(keyRow && keyRow.value && String(keyRow.value).trim());
return {
enabled: parsed.enabled !== false,
baseUrl: parsed.baseUrl || '',
model: parsed.model || 'gpt-4o-mini',
hasKey,
keyLast4: parsed.keyLast4 || null
hasKey: hasStoredKey,
keyLast4: parsed.keyLast4 || null,
keyStatus: hasStoredKey ? (hasReadableKey ? 'stored' : 'invalid') : 'missing'
};
}