fix(ai-prompt): preserve all original messages in decorateBody#6343
Open
eye-gu wants to merge 3 commits into
Open
fix(ai-prompt): preserve all original messages in decorateBody#6343eye-gu wants to merge 3 commits into
eye-gu wants to merge 3 commits into
Conversation
moremind
previously approved these changes
May 16, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes AiPromptPlugin#decorateBody so it preserves the full incoming messages array (multi-turn conversation history) instead of only keeping the first entry, aligning behavior with expected AI chat request semantics (issue #6342).
Changes:
- Update
decorateBodyto append all original messages viadecoratedMessages.addAll(messages). - Add unit tests covering decoration behavior (no messages, empty messages, prepend/append, multi-message preservation, and preservation of other JSON fields).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-prompt/src/main/java/org/apache/shenyu/plugin/ai/prompt/AiPromptPlugin.java |
Fixes message decoration to preserve all original conversation messages. |
shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-prompt/src/test/java/org/apache/shenyu/plugin/ai/prompt/AiPromptPluginTest.java |
Adds coverage to validate correct body decoration and multi-message preservation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
close #6342
AiPromptPlugin#decorateBodyusedmessages.get(0)which only kept the first message, silently dropping all remaining conversation history (multi-turn dialogue messages).Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.