Problem/Motivation
When the Gemini key is not installed or incorrect, Drupal complains and throws an error that the API key is not installed. This actually prevents any other provider from being used. While it's ideal to have Gemini set up correctly, sometimes we move onto other providers and a lapse occurs with Gemini. This should not prevent us from moving on to other providers.
Steps to reproduce
1. Set up Gemini as provider using Drupal AI for something like a basic chat.
2. Install Search API and Search AI modules.
3. Change the Gemini key to something that won't work.
4. Add a different provider other than Gemini.
Proposed resolution
Make sure that it gracefully catches the provider error and still allows other types of Search API servers to be created.
Comments
Comment #2
ronraney commentedComment #3
jibla commentedComment #4
jibla commentedLooking at the current codebase, this issue appears to be resolved
1. GeminiProvider::isUsable() returns FALSE when no API key is configured, preventing any API calls
2. GeminiProvider::getConfiguredModels() checks isUsable() first and returns an empty array if the provider isn't properly set up
3. The AI module's AiProviderPluginManager, AiSettingsForm, and AiProviderFormHelper all wrap getConfiguredModels() calls in try/catch blocks, so even if an unexpected exception occurs, other providers continue functioning