Feature/add image to chat#32
Merged
Merged
Conversation
Enable users to attach images to chat messages via file picker button, clipboard paste, and drag-and-drop. Images are sent as base64 content parts to all provider APIs (OpenAI, Azure, Anthropic, Google, Foundry, Ollama) using each provider's native multimodal format.
There was a problem hiding this comment.
Pull request overview
Adds end-to-end support for attaching images to chat messages in the renderer UI and ensures provider adapters serialize mixed text+image message content into each provider’s expected request format.
Changes:
- Extended chat message typing to allow mixed content parts (text + base64 images).
- Added image attach UX in
ChatPopup(paste/drag-drop/file picker) and image rendering inChatMessage. - Updated provider request builders (OpenAI/Azure/Foundry/Anthropic/Google/Ollama) to map message content into provider-specific payloads, with new unit tests for conversion utilities and
useChatMessage.
Reviewed changes
Copilot reviewed 16 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/types/chat.d.ts | Introduces content-part types and expands message content typing (needs tightening to avoid TS breakage). |
| src/services/providers/core/messageUtils.ts | New utilities to extract text and convert mixed content into provider-specific message payloads. |
| src/services/providers/adapters/openaiRequestBuilder.ts | Maps message content through OpenAI-compatible mixed-content conversion. |
| src/services/providers/adapters/azureRequestBuilder.ts | Maps message content through OpenAI-compatible mixed-content conversion for Azure. |
| src/services/providers/adapters/foundryRequestBuilder.ts | Adds mixed-content support for both OpenAI and Anthropic paths. |
| src/services/providers/adapters/anthropicRequestBuilder.ts | Adds mixed-content support and extracts system prompt safely. |
| src/services/providers/adapters/googleRequestBuilder.ts | Converts messages into Gemini “parts” including inline image data, with safer system prompt prepend logic. |
| src/services/providers/adapters/ollamaRequestBuilder.ts | Maps message content into Ollama { content, images } shape. |
| src/services/providers/tests/messageUtils.test.ts | Adds unit tests for mixed-content conversion utilities. |
| src/pages/ChatPopup/ChatPopup.tsx | Adds image attachment UX and builds user messages as mixed content parts. |
| src/pages/ChatMessage/ChatMessage.tsx | Renders attached images alongside message text. |
| src/hooks/useChatMessage.ts | Supports extracting text from mixed content before parsing thinking blocks. |
| src/hooks/tests/useChatMessage.test.ts | Adds coverage for useChatMessage with mixed content. |
| src/pages/Settings/SettingsChat.tsx | UI layout tweak to prevent horizontal overflow. |
| src/pages/Settings/SettingsAppearance.tsx | UI layout tweak to prevent horizontal overflow. |
| src/components/Icon.tsx | Adds an “image” icon used by the new attach button. |
| package.json | Version bump to 0.5.3-beta.1. |
| package-lock.json | Lockfile version bump to match package version. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request Template
Description
Support add images to chat.
Related Issue
Closes #30
Type of Change
Checklist
Screenshots