fix(hooks): extract text from multimodal input for UserPromptSubmit prompt field#1813
Open
kevinWangSheng wants to merge 1 commit intoMoonshotAI:mainfrom
Open
fix(hooks): extract text from multimodal input for UserPromptSubmit prompt field#1813kevinWangSheng wants to merge 1 commit intoMoonshotAI:mainfrom
kevinWangSheng wants to merge 1 commit intoMoonshotAI:mainfrom
Conversation
…rompt field When user_input is a list of ContentPart (multimodal input with images, videos, etc.), the hook payload's prompt field was always set to an empty string. Now we join the text from all TextPart items in the list so hook scripts receive the actual user text. Closes MoonshotAI#1779
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.
Related Issue
Resolve #1779
Description
The
UserPromptSubmithook event was sending an empty string in thepromptfield whenever the user submitted multimodal content (e.g. text with images or other media). This happened becauseuser_inputislist[ContentPart]for multimodal messages, and the code fell through to a hardcoded""default.The fix extracts text from all
TextPartitems in the content list and joins them with newlines, so the hook payload contains the actual user text even when the input includes non-text parts. Pure text input (str) is unchanged.Checklist
make gen-changelogto update the changelog.make gen-docsto update the user documentation.