yangjj-iso opened a new pull request, #7543: URL: https://github.com/apache/shenyu/pull/7543
Fixes #7533. Related to #7532 and parent #7351. AiProxyPlugin now delegates both normal and streaming requests to AiProxyEngine. The plugin handles ShenYu configuration, proxy-key validation/substitution, bounded downstream requests, and WebFlux response writing; Protocol, Provider, and Transport handle upstream execution. - Forward response status, end-to-end headers, normal/error bodies, and SSE chunks incrementally. Preserve unknown OpenAI fields and emit [DONE] once on successful completion. - Centralize retry and fallback in the Engine before body emission, rebuild fallback requests with the fallback configuration, and propagate downstream cancellation. - Preserve selector/default-rule configuration, dynamic/admin fallback precedence, real-key substitution, and the 5 MiB request-body limit. - Remove the legacy AI Proxy OpenAiApi cache, executor, cancellation helper, and Spring AI client wiring. Other AI plugins retain their Spring AI dependencies. - Document migration behavior and Protocol/Provider/Transport extension points in the Engine package documentation. ### Dependencies The branch includes the layered foundation from #7531 at `9b367b740d63ac71ac4aec51534547e15cce51a8`, followed by separate Engine orchestration and plugin migration commits. #7531 is still open; this PR also supplies the response/retry/fallback orchestration required by #7532. The foundation commit can be dropped/rebased once the prerequisite lands. This does not claim to complete all separate Provider/Transport hardening tasks. ### Validation 135 targeted tests passed across AI Common, AI Proxy, and the AI Proxy starter, including real HTTP tests for incremental streaming, cancellation, and a response larger than the default codec limit. Compatibility tests cover normal/SSE responses, upstream 4xx/5xx bodies, proxy keys, retries, fallback, malformed/oversized requests, and failures before/after response commitment. Checkstyle and Apache RAT passed; the relevant reactor package build passed. ```sh ./mvnw -o -pl shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-ai-proxy -am clean test -Dtest='AiProxy*,OpenAi*,WebClientAiProxyTransportTest,CommonAiProxyApiKeyDataSubscriberTest' -Dsurefire.failIfNoSpecifiedTests=false -Dmaven.javadoc.skip=true -Djacoco.skip=true ./mvnw -o -pl shenyu-common,shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-common,shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-proxy,shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-ai-proxy apache-rat:check ./mvnw -o -pl shenyu-spring-boot-starter/shenyu-spring-boot-starter-plugin/shenyu-spring-boot-starter-plugin-ai-proxy -am package -DskipTests -Dmaven.javadoc.skip=true -Djacoco.skip=true ``` Make sure that: - [x] You have read the [contribution guidelines](https://shenyu.apache.org/community/contributor-guide). - [x] You submit test cases (unit or integration tests) that back your changes. - [ ] Your local test passed `./mvnw clean install -Dmaven.javadoc.skip=true` (the scoped checks above passed; the full repository build was not run). -- 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]
