Problem/Motivation

The isUsable() method in MistralProvider.php incorrectly returns TRUE for the ChatWithImageVision capability even when no API key is configured. This causes Mistral to appear as an
available provider option in the AI settings UI (/admin/config/ai/settings) under "Chat with Image Vision" when it shouldn't be selectable.

Steps to reproduce

1. Install ai_provider_mistral module
2. Do NOT configure an API key at /admin/config/ai/providers/mistral
3. Go to /admin/config/ai/settings
4. Observe that "Mistral AI" appears in the "Chat with Image Vision" provider dropdown
5. Other capabilities correctly show no Mistral option available

Proposed resolution

Move the API key check before the capability checks
Also note: the comment says "No vision support" but the code returns TRUE, which is contradictory. Since beta3 added vision support (#3515048), the comment should be updated/removed.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

petar_basic created an issue. See original summary.

petar_basic’s picture

Issue summary: View changes
Status: Needs work » Needs review

Moved the API key check before the capability checks

petar_basic’s picture

Assigned: petar_basic » Unassigned

  • fago committed 05c31ba9 on 1.1.x authored by petar_basic
    fix: #3571491 ChatWithImageVision is available with missing API key
    
    By...
fago’s picture

Title: isUsable() returns TRUE for ChatWithImageVision even without API key configured » ChatWithImageVision is available with missing API key
Status: Needs review » Fixed

thx, straight-forward fix. Merged!

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.