hengyuss opened a new issue, #7533:
URL: https://github.com/apache/shenyu/issues/7533
# [Task][AI Proxy] Migrate AiProxyPlugin to AiProxyEngine
Parent issue: #7351
Depends on: Complete orchestration in `AiProxyEngine`
## Background
The layered contracts and implementations are introduced independently before
changing the existing gateway execution path. `AiProxyPlugin` therefore
continues using `OpenAiApi`, Spring AI request/response DTOs, and the legacy
executor until the new path reaches behavioral parity.
## Goal
Make `AiProxyEngine` the only upstream execution path used by
`AiProxyPlugin`, while preserving existing configuration and externally
observable behavior.
## Scope
- retain `AiProxyPlugin` as the terminal ShenYu plugin and WebFlux response
boundary;
- preserve selector and rule configuration resolution;
- preserve proxy API key validation and real-key substitution;
- invoke `AiProxyEngine` for both streaming and non-streaming requests;
- write Engine response status, headers, and reactive body to
`ServerHttpResponse` without buffering the complete response;
- preserve OpenAI Chat SSE framing and completion behavior through the new
Protocol path;
- preserve retry and fallback behavior implemented by `AiProxyEngine`;
- preserve request body limits and downstream cancellation;
- remove legacy Spring AI clients, DTOs, caches, and executor code from the
AI
Proxy data path once they are no longer used;
- retain Spring AI dependencies needed by other AI plugins.
## Boundaries
`AiProxyPlugin` should be limited to gateway concerns:
- reading the downstream request and matched ShenYu configuration;
- authentication and proxy-key handling owned by the plugin;
- invoking `AiProxyEngine`;
- writing the downstream HTTP response;
- mapping failures that occur before response commitment to gateway
responses.
Protocol parsing, Provider adaptation, upstream HTTP execution, retry, and
fallback must not be reimplemented in the plugin.
## Acceptance criteria
- [ ] `AiProxyPlugin` uses `AiProxyEngine` for streaming and non-streaming
requests.
- [ ] Status codes, response headers, normal bodies, SSE chunks, and upstream
error bodies are written without full-response buffering.
- [ ] Proxy API key, selector/rule, retry, fallback, body-limit, and
cancellation behavior remains compatible with the legacy path.
- [ ] No OpenAI-specific DTO, `OpenAiApi`, or Spring AI client remains in the
AI Proxy execution path.
- [ ] Legacy execution code is removed after compatibility is demonstrated.
- [ ] Existing AI Proxy tests continue to pass through the new path.
- [ ] Compatibility tests cover normal responses, streaming responses,
upstream 4xx/5xx responses, invalid proxy keys, retry, fallback,
cancellation, and oversized request bodies.
- [ ] Migration and extension documentation is updated.
--
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]