feat(text chat): expose image input via repeatable --image (multimodal M3, multi-image) - #225
Open
shoemoney wants to merge 1 commit into
Open
feat(text chat): expose image input via repeatable --image (multimodal M3, multi-image)#225shoemoney wants to merge 1 commit into
shoemoney wants to merge 1 commit into
Conversation
MiniMax-M3 is multimodal, but `text chat` had no way to send an image —
users had to hand-write a base64 messages JSON file, and the obvious
OpenAI `image_url` shape is rejected because the CLI posts to the
Anthropic-compatible /messages endpoint.
- `--image <path-or-url>` on `text chat`, repeatable, so multi-image
compare/diff works in one call
- new `toImageBlock()` in utils/image reuses `toDataUri()` (local paths,
http(s) URLs, existing data URIs) and emits the Anthropic block shape
`{ type: 'image', source: { type: 'base64', media_type, data } }`
- images append to the last user message, promoting string content to a
block array; with no `--message` they become the user message
- images force `MiniMax-M3` when `--model` is unset, so a text-only
`defaultTextModel` in config can't silently break the request
- docs: README, README_CN, skill/SKILL.md (incl. the OpenAI-vs-Anthropic
block-shape gotcha)
Closes MiniMax-AI#224
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.
Closes #224.
What
mmx text chatnow takes a repeatable--image <path-or-url>:Why
M3 is multimodal and already accepts multiple images through
--messages-file, but there was no CLI path to it — you had to hand-write a base64 messages JSON. Worse, the documented OpenAI shape ({"type":"image_url", ...}) is rejected, becausetext chatposts to the Anthropic-compatible/anthropic/v1/messagesendpoint and needs{"type":"image","source":{"type":"base64",...}}.--imageemits the right shape for you.How
toImageBlock()insrc/utils/image.tswraps the existingtoDataUri()(local paths,http(s)URLs, and pre-made data URIs all work) and returns an Anthropic image block.src/commands/text/chat.tsappends the blocks to the last user message, promotingcontentfrom a string to a block array. Text goes first so the model reads the instruction before the pixels. With no--message, the images become the user message.ContentBlockgains theimagevariant.--imageis present and--modelis not, the model resolves toMiniMax-M3— otherwise a text-onlydefaultTextModelin config would silently break every image request. An explicit--modelstill wins.README.md,README_CN.md, andskill/SKILL.md(which also now calls out the OpenAI-vs-Anthropic block-shape gotcha).Verification
Dry run of the built binary:
That is byte-for-byte the payload shape I confirmed M3 answers correctly in #224.
Six new tests in
test/commands/text/chat.test.tscover block shape, multi-image, image-without-message, the model override, explicit--modelwinning, and the missing-file error.bun test455 pass / 0 fail;bun run typecheckandbun run lintclean.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.