Skip to content

feat: Vision Support with Pixtral Models and Clipboard Integration - #22724

Merged
raycastbot merged 5 commits into
raycast:mainfrom
koalazub:feature/mistral-vision-support
Nov 12, 2025
Merged

raycastbot merged 5 commits into
raycast:mainfrom
koalazub:feature/mistral-vision-support

Conversation

@koalazub

@koalazub koalazub commented Nov 7, 2025 •

Copy link
Copy Markdown
Contributor

This update introduces full vision capabilities to the extension through Pixtral 12B and Pixtral Large models, with intelligent model switching that automatically upgrades to vision-capable models when images are detected. Since Mistral's TypeScript SDK doesn't yet support vision APIs, this implementation uses direct REST API integration with a custom SSE stream parser. The system automatically converts HEIC/HEIF images (common from iPhone screenshots) to JPEG using macOS's native sips command.

The UI has been redesigned from Form to List view to support real-time image previews in the detail panel alongside the Mistral logo. Users can now browse their clipboard history (Cmd+Shift+I) to quickly select from the last 5 items, with smart discrimination between images (showing thumbnails) and text (showing 100-character previews). Selecting an image automatically attaches it to the query, while selecting text pastes it into the question field. Quick Look support (Cmd+Y) enables full-screen image verification before submission.

Performance improvements include character-based streaming (100-char chunks) that reduces UI jitter during response rendering. Although I still wasn't able to fix the jitteriness here. If someone has an idea on how to fix this, I'm all ears because React isn't my strong suit here.

This vision integration streamlines the workflow by eliminating the need to manually switch models or leave Raycast to attach images, making visual analysis with Mistral AI more frictionless.

pixtral_vision.mov
Screen.Recording.2025-11-07.at.22.12.20.mov

Conversations continuing with the ability to add images too:

 

This update introduces full vision capabilities to the extension through Pixtral 12B and Pixtral Large models, with intelligent model switching that automatically upgrades to vision-capable models when images are detected. Since Mistral's TypeScript SDK doesn't yet support vision APIs, this implementation uses direct REST API integration with a custom SSE stream parser. The system automatically converts HEIC/HEIF images (common from iPhone screenshots) to JPEG using macOS's native sips command for seamless compatibility.
The UI has been redesigned from Form to List view to support real-time image previews in the detail panel alongside the Mistral logo. Users can now browse their clipboard history (Cmd+Shift+I) to quickly select from the last 5 items, with smart discrimination between images (showing thumbnails) and text (showing 100-character previews). Selecting an image automatically attaches it to the query, while selecting text pastes it into the question field. Quick Look support (Cmd+Y) enables full-screen image verification before submission.
Performance improvements include character-based streaming (100-char chunks) that significantly reduces UI jitter during response rendering. This vision integration streamlines the workflow by eliminating the need to manually switch models or leave Raycast to attach images, making visual analysis with Mistral AI as frictionless as text queries.
@raycastbot raycastbot added extension fix / improvement Label for PRs with extension's fix improvements extension: mistral Issues related to the mistral extension platform: macOS labels Nov 7, 2025
@raycastbot

ghost commented Nov 7, 2025 •

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! 🎉

🔔 @colinlienard you might want to have a look.

You can use this guide to learn how to check out the Pull Request locally in order to test it.

You can expect an initial review within five business days.

@koalazub
koalazub force-pushed the feature/mistral-vision-support branch 2 times, most recently from 01679d6 to 9e43700 Compare November 7, 2025 05:45
@koalazub
koalazub force-pushed the feature/mistral-vision-support branch from 9e43700 to afc061b Compare November 7, 2025 05:47
…nent

Created useClipboardHistory hook and ClipboardSelector component to eliminate code duplication between ask.tsx and conversation.tsx. Added visual feedback for attached images in conversations with search bar indicator and Clear Image action.
@koalazub
koalazub marked this pull request as ready for review November 7, 2025 11:19

ghost left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This PR introduces comprehensive vision capabilities to the Mistral extension by integrating Pixtral 12B and Pixtral Large models. The update completely redesigns the UI from Form to List view to support real-time image previews, adds intelligent model switching that automatically upgrades to vision-capable models when images are detected, and implements clipboard integration for browsing recent images and text. Since Mistral's TypeScript SDK doesn't support vision APIs, the implementation uses direct REST API calls with a custom SSE stream parser. The system includes automatic HEIC/HEIF to JPEG conversion using macOS's native sips command and provides Quick Look support for image verification.

PR Description Notes:

  • The changelog entry uses an actual date (2025-11-07) instead of the required template string {PR_MERGE_DATE}

Important Files Changed

Filename Score Overview
extensions/mistral/src/hooks/use-conversations.ts 5/5 Added optional images field to chat type for vision support
extensions/mistral/CHANGELOG.md 4/5 Added comprehensive vision support changelog entry with incorrect date format
extensions/mistral/package.json 5/5 Added Pixtral vision models to user preferences dropdown
extensions/mistral/src/utils/models.ts 5/5 Added vision capability detection and new Pixtral model definitions
extensions/mistral/src/hooks/use-clipboard-history.ts 4/5 New hook for clipboard history with image/text discrimination
extensions/mistral/src/components/conversation.tsx 3/5 Major refactor adding vision API integration and image processing
extensions/mistral/src/components/clipboard-selector.tsx 4/5 New component for clipboard item selection with keyboard shortcuts
extensions/mistral/src/ask.tsx 3/5 Complete UI redesign from Form to List with image preview capabilities

Confidence score: 3/5

  • This PR requires careful review due to platform-specific dependencies and potential runtime errors
  • Score lowered due to missing Clipboard import in conversation.tsx, macOS-specific sips command usage that will fail on other platforms, automatic model switching that overrides user preferences, and synchronous file operations in the main thread that could cause performance issues
  • Pay close attention to extensions/mistral/src/components/conversation.tsx and extensions/mistral/src/ask.tsx for file system operations and error handling

Additional Comments (2)

  1. extensions/mistral/src/components/conversation.tsx, line 72-78 (link)

    syntax: Missing import for Clipboard from @raycast/api - these functions will throw runtime errors

  2. extensions/mistral/src/components/conversation.tsx, line 267 (link)

    logic: The newChat object doesn't include the images property, which might cause inconsistencies in conversation history with vision-enabled chats.

8 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

@pernielsentikaer

ghost commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

Hi @koalazub👋

Thanks for your contribution 🔥

Do you need help fixing the CI errors mentioned here

@colinlienard do you want to check this?

@pernielsentikaer
pernielsentikaer marked this pull request as draft November 7, 2025 11:27
@koalazub
koalazub force-pushed the feature/mistral-vision-support branch from c8e7711 to ff50239 Compare November 7, 2025 11:39
@koalazub

ghost commented Nov 7, 2025

Copy link
Copy Markdown
Contributor Author

Hi @koalazub👋

Thanks for your contribution 🔥

Do you need help fixing the CI errors mentioned here

@colinlienard do you want to check this?

Hey @pernielsentikaer appreciate that. I think I've sorted it out. I just wanted to know how to trigger reptile again to check greptile again to verify the correctness if possible?

…only

Changed clipboard history logic to only treat files without extensions as images if they match the macOS clipboard pattern (path contains "/Image "). This prevents false positives where arbitrary extensionless files would be incorrectly treated as images. Also added missing Clipboard import and images property to conversation history.
@koalazub
koalazub force-pushed the feature/mistral-vision-support branch from ff50239 to ed41f1c Compare November 7, 2025 11:44
@koalazub
koalazub marked this pull request as ready for review November 7, 2025 11:51

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Overview

Greptile Summary

This review covers only the changes made since the last review, not the entire PR. The recent changes are minor refinements to the vision support implementation: fixing title case consistency in the clipboard selector UI by changing "No items in clipboard history" to "No Items in Clipboard History", and adding specific logic to detect macOS clipboard images that lack file extensions. The macOS clipboard image detection addresses a system-specific behavior where screenshots are stored in clipboard with paths containing "/Image " but no file extension. These changes complement the broader vision capabilities already implemented with Pixtral models and clipboard integration.

Important Files Changed

Filename Score Overview
extensions/mistral/src/components/clipboard-selector.tsx 5/5 Minor UI text capitalization fix for better consistency
extensions/mistral/src/hooks/use-clipboard-history.ts 4/5 Added clipboard history functionality with macOS image detection logic
extensions/mistral/src/components/conversation.tsx 4/5 Implemented vision support with image handling and SSE streaming

Confidence score: 4/5

  • This PR requires careful review due to complex image handling logic and potential edge cases in file type detection
  • Score reflects thorough implementation of vision features but deducted due to the previous concern about files without extensions being treated as images, and potential issues with the HEIC/HEIF conversion logic that assumes empty extensions indicate convertible image formats
  • Pay close attention to the image detection logic in use-clipboard-history.ts and the file extension handling in conversation.tsx, particularly around the empty string extension handling

3 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@pernielsentikaer

ghost commented Nov 7, 2025

Copy link
Copy Markdown
Contributor

You have the greptile review now @koalazub - do you want a full one too?

Created shared image-formats.ts module with typed constants for supported formats (JPEG, PNG, WebP) and formats requiring conversion (HEIC/HEIF). Removed unsupported formats (SVG, JXL) that don't render in Raycast markdown. Updated CHANGELOG to reflect all vision support changes including clipboard refactoring and format support.
@koalazub
koalazub force-pushed the feature/mistral-vision-support branch from 394471b to aed238e Compare November 8, 2025 09:03
@koalazub

ghost commented Nov 8, 2025

Copy link
Copy Markdown
Contributor Author

You have the greptile review now @koalazub - do you want a full one too?

All good! I think I've managed to structure and address the main points.

@koalazub

ghost commented Nov 11, 2025

Copy link
Copy Markdown
Contributor Author

@pernielsentikaer this is now ready

ghost left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, approved 🔥

@raycastbot
raycastbot merged commit 9dac3f6 into raycast:main Nov 12, 2025
@github-actions

ghost commented Nov 12, 2025

Copy link
Copy Markdown
Contributor

@raycastbot

ghost commented Nov 12, 2025

Copy link
Copy Markdown
Collaborator

🎉 🎉 🎉

We've rewarded your Raycast account with some credits. You will soon be able to exchange them for some swag.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension fix / improvement Label for PRs with extension's fix improvements extension: mistral Issues related to the mistral extension platform: macOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants