-
Notifications
You must be signed in to change notification settings - Fork 2.7k
feat: add support for image file @mentions #10189
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add resolveImageMentions to convert @/path/to/image.png mentions to base64 data URLs - Integrate image resolution for newTask, askResponse, editMessageConfirm, queueMessage - Add binary file detection to skip including binary content as text context - Support png, jpg, jpeg, webp formats with 20 image limit per message - Add unit and integration tests for image mention handling
Re-review complete. No new issues found in the latest commit; remaining follow-ups below.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| text, | ||
| images, | ||
| cwd: getCurrentCwd(), | ||
| rooIgnoreController: currentTask?.rooIgnoreController, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
resolveIncomingImages uses the task's rooIgnoreController but falls back to provider.cwd when there is no current task. That means image mentions in the initial newTask message do not get .rooignore enforcement (unless provider.getCurrentTask() already exists), which is a behavior difference from text mention expansion. Consider using a provider-level RooIgnoreController for the fallback path as well.
Fix it with Roo Code or mention @roomote and request a fix.
- Add support for all 11 image formats (.gif, .svg, .bmp, .ico, .tiff, .tif, .avif) - Add per-file size validation using validateImageForProcessing - Add total memory tracking with ImageMemoryTracker - Add supportsImages check for model compatibility - Reuse IMAGE_MIME_TYPES and SUPPORTED_IMAGE_FORMATS from imageHelpers - Add JSDoc for resolveIncomingImages helper - Update integration tests to use os.tmpdir() instead of process.cwd() - Add comprehensive test coverage for new validation behavior
| images, | ||
| cwd, | ||
| rooIgnoreController, | ||
| supportsImages = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
supportsImages defaults to true here, so if a caller forgets to pass the real model capability this will still read and base64-encode image mentions for non-vision models (extra memory + large payloads). Consider deriving/passing supportsImages from the active model info (or defaulting this to false so callers must opt-in explicitly).
Fix it with Roo Code or mention @roomote and request a fix.
|
A couple spots where we could reuse existing helpers from
const buffer = await fs.readFile(absPath)
const base64 = buffer.toString("base64")
newImages.push(`data:${mimeType};base64,${base64}`)
const { dataUrl } = await readImageAsDataUrlWithBuffer(absPath)
newImages.push(dataUrl)Minor stuff, but keeps things aligned with existing patterns. |
- Use isSupportedImageFormat() from imageHelpers instead of local isSupportedImageExtension() - Use readImageAsDataUrlWithBuffer() instead of manual fs.readFile + base64 conversion - Remove local getMimeType() as readImageAsDataUrlWithBuffer handles MIME type internally - Update tests to mock the new dependencies
|
|
||
| import { resolveImageMentions } from "../resolveImageMentions" | ||
|
|
||
| const SUPPORTED_IMAGE_FORMATS = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The constant SUPPORTED_IMAGE_FORMATS (lines 5–17) is declared but never used. Consider removing it to keep the test file clean.
Summary
Add support for resolving image file @mentions into inline images, and align edit-dialog test expectations with current behavior (empty-array images for submits; undefined for edit-dialog payload).
Changes
Important
Adds support for resolving image file mentions into inline images and updates related tests and message handling.
resolveImageMentionsfunction inresolveImageMentions.tsto convert image file mentions into inline images.resolveImageMentionsintowebviewMessageHandler.tsto handle image mentions in messages.editMessageConfirmandaskResponsecases inwebviewMessageHandler.tsto use resolved images.resolveImageMentions.spec.tsfor various image formats and scenarios.webviewMessageHandler.imageMentions.integration.spec.tsfornewTaskandaskResponsemessage types.ClineProvider.spec.tsandwebviewMessageHandler.edit.spec.tsto align with new image payload expectations.getFileOrFolderContentinindex.tsto omit binary files from text context.This description was created by
for f2d1554. You can customize this summary. It will automatically update as commits are pushed.