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.

See related issue proposed in Drupal AI.

Comments

ronraney created an issue. See original summary.

ronraney’s picture

Issue summary: View changes
jibla’s picture

jibla’s picture

Status: Active » Fixed

Looking 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

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.