Repository navigation
Conversation
convertMixedMessage discarded the image whenever a mixed (text+image) message contained any text, so the most common shape — a question plus a screenshot — reached the QA pipeline as text-only and the model never saw the image, despite the IM integration docs promising images are handled as QA attachments. Keep the first image as the message attachment and carry the text as its caption: the IM service already supports captioned images (prepareIMAttachments downloads the file while fileMessageQAContent preserves msg.Content as the query), so the adapter just has to emit MessageTypeImage with Content set instead of MessageTypeText. Text-only, image-only, and empty mixed messages keep their previous behavior. Multiple images still collapse to the first one; supporting several attachments requires a multi-attachment IncomingMessage and is left out of this minimal fix.
This branch has not been deployed
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.
Description
WeCom long-connection adapter dropped the image whenever a mixed (text+image) message contained any text. The most common mixed-message shape — a question plus a screenshot — reached the QA pipeline as text-only, so the model never saw the image, despite the IM integration docs stating images are handled as QA attachments.
convertMixedMessagenow keeps the first image as the message attachment and carries the text as its caption (MessageTypeImage+Content). The IM service already supports captioned images:prepareIMAttachmentsdownloads the file whilefileMessageQAContentpreservesmsg.Contentas the query, so no changes outside the wecom adapter are needed.Text-only, image-only, and empty mixed messages keep their previous behavior. Multiple images still collapse to the first one — supporting several attachments requires a multi-attachment
IncomingMessageand is left out of this minimal fix.Type of Change
Related Issue
Fixes #
Testing
internal/im/wecom/mixed_test.gocovering: text+image, multiple images with text, text-only, image-only, group-chat @mention stripping, and empty mixed messagego test ./internal/im/wecom/— passgo test ./internal/im/...(all platform adapters: feishu, slack, telegram, mattermost, qqbot, yunzhijia, wecom) — pass, no regressiongo vet ./internal/im/wecom/— cleangofmt -l internal/im/wecom/— cleangit diff --check origin/main...HEAD— cleanChecklist
git diff --check origin/main...HEADpassesgolangci-lint run --new-from-rev=origin/main ./...)website-docs/, Swagger annotations, etc.)Note: golangci-lint is not installed locally on this machine (network-restricted environment); the change is gofmt/go vet clean and covered by unit tests. The behavior now matches what
website-docs/03-features/12-im-integration.mdalready documents (fileMessageQAContentcaption path), so no doc update is needed.