wy471x opened a new pull request, #7484: URL: https://github.com/apache/shenyu/pull/7484
## What Closes #6795. Replace eager `collectList` aggregation of streaming responses in the AI request/response transformer plugins and the non-committing MCP response decorator: - `AiRequestTransformerPlugin`: accumulate the streamed content into a single `StringBuilder` via `Flux#collect(Supplier, BiConsumer)` instead of collecting every chunk into a `List` and joining it afterwards. The `List` retention (plus a second joined copy) is gone; chunks are appended as they arrive. - `AiResponseTransformerPlugin`: same change inside `AiResponseTransformerDecorator#writeWith`. - `NonCommittingMcpResponseDecorator`: append each `DataBuffer` chunk incrementally with `doOnNext` (mirroring the established `ShenyuMcpResponseDecorator` pattern) instead of `collectList()` over all buffers, and complete the response future once the stream completes. `writeAndFlushWith` now uses `concatMap` so inner publishers are consumed sequentially and chunk order is preserved. The transformed output still requires the full streamed payload (it is parsed as an HTTP-shaped response / JSON template), so no second heap copy of every chunk is kept; the accumulated text is the only retained buffer. ## Tests - New `NonCommittingMcpResponseDecoratorTest`: incremental accumulation across chunks, ordered `writeAndFlushWith` inner publishers, response template applied to the accumulated body, exceptional completion on stream error, and `setComplete` behavior. - Existing module test suites pass: `shenyu-plugin-ai-request-transformer` (16), `shenyu-plugin-ai-response-transformer` (50), `shenyu-plugin-mcp-server` (106). - Checkstyle passes for all three modules. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
