discourse/app/assets/javascripts/discourse-markdown-it
Keegan George 85de78b428
DEV: Conditionally show AI image caption button (#35463)
## 🔍 Overview

None of the vision capable LLMs currently support captioning SVGs, and
attempting to caption images results in some odd behavior. On the server
side, we already [only allow specific
extensions](e2eb9fe93f/plugins/discourse-ai/lib/completions/upload_encoder.rb (L13-L19))
before captioning, but the client side we still were showing the image
caption button.

This update hides the image caption button on image extensions that are
not supported for AI image captioning. To achieve this, we also update
the plugin API method: `api.addComposerImageWrapperButton` so that it
supports an optional `includeCondition` param to conditionally show the
button based on the image source URL.

## 📹 Preview


https://github.com/user-attachments/assets/c9507475-ae3d-4356-8586-3fcc5d070b83
2025-10-17 08:16:25 -07:00
..
src DEV: Conditionally show AI image caption button (#35463) 2025-10-17 08:16:25 -07:00
addon-main.cjs FIX: Hide secret admin fields by default (#33255) 2025-06-24 13:36:59 -05:00
package.json Build(deps): Bump ember-auto-import from 2.11.0 to 2.11.1 (#35240) 2025-10-07 20:09:59 +02:00