feat(ask-code): send attached images to an image-capable MiniMax model - #262
Open
octo-patch wants to merge 1 commit into
Open
feat(ask-code): send attached images to an image-capable MiniMax model#262octo-patch wants to merge 1 commit into
octo-patch wants to merge 1 commit into
Conversation
The inline code Q&A resolved pasted images to temp file paths, but the MiniMax backend only ever sent a text prompt, so the image was dropped. Requests now carry image paths, the user message becomes text plus image_url content parts when images are attached, and such requests go to a model whose catalog input modalities include images. Text-only requests keep the previous payload and model. Image input is validated and capped separately from the prompt length limit.
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.
Reason: The inline code Q&A already resolves pasted images to temp file paths, but the MiniMax provider could only send a text prompt, so an attached image never reached a model that accepts image input.
What changed
electron/ipc/ask-code-minimax.ts— a request can now carryimagePaths. When images are attached, the user message is sent as content parts (atextpart plus oneimage_urldata URL per image) instead of a plain string, and the request is routed to a model whose catalog input modalities include images (MiniMax-M3, which accepts text, image and video input).MiniMax-M2.7is text-only and stays the default for text questions, so text-only requests send exactly the same payload as before. Image input is validated and capped separately from the 50,000-character prompt limit, since the bytes never count against it: at most 4 images per question, 10 MB each,.png/.jpg/.jpeg/.webp/.gif. Unsupported or excessive input is rejected before a request slot is taken, and an unreadable file is reported on the response channel.electron/ipc/ask-code.ts,electron/ipc/register.ts— forward the newimagePathsargument and validate it, running every entry through the existing absolute-path check. The other Q&A backend is unchanged and still receives a text prompt only.src/components/InlineInput.tsx— pasting an image into the inline Ask input attaches it, reusing the existingresolve_clipboard_pastehandler that the terminal already uses, so no new IPC channel is added. The affordance is only active in Ask mode while the MiniMax provider is selected, and a small chip shows the attachment and clears it.src/components/ReviewProvider.tsx,src/components/ScrollingDiffView.tsx,src/components/PlanViewerDialog.tsx,src/components/AskCodeCard.tsx— thread the attached paths from the inline input through the question to the request. Both Ask surfaces share the same input, so both gain the capability.New tests in
electron/ipc/ask-code-minimax.test.tscover the model modality lookup, the unchanged text-only payload, image parts sent as data URLs to the image-capable model, a rejected image type, the per-question image cap, and an unreadable image surfacing as an error without a request being sent.Checks
npx vitest run— 115 files passed, 1873 tests passed, 22 skippednpx vitest run --config vitest.client.config.ts— 2 files passed, 9 tests passednpx tsc --noEmitandnpx tsc -p electron/tsconfig.json— cleannpx eslint . --max-warnings 0— cleannpx prettier --check .— cleannpm run lint:arch— no dependency violationsnpm run lint:dead— clean