-
Notifications
You must be signed in to change notification settings - Fork 3k
[refactor] refactor ai plugins #5986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the AI plugins by introducing a common module (AiCommonConfig) and updating the configuration and strategy references in the various AI plugin components. Key changes include the replacement of AiProxyConfig with AiCommonConfig, renaming and moving code in the OpenAI strategy and related classes, and updating the AiModel invocation flow.
Reviewed Changes
Copilot reviewed 19 out of 25 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| shenyu-plugin-ai-token-limiter | Removed unused imports and refactored AiStatisticServerHttpResponse to use AiModel for token extraction |
| shenyu-plugin-ai-proxy (Handler & Plugin) | Replaced AiProxyConfig with AiCommonConfig and updated configuration assignment |
| shenyu-plugin-ai-common | Moved and refactored OpenAI and related strategy interfaces to use common configurations |
| shenyu-common | Added new constants to support token usage tracking |
Files not reviewed (6)
- shenyu-plugin/pom.xml: Language not supported
- shenyu-plugin/shenyu-plugin-ai/pom.xml: Language not supported
- shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-common/pom.xml: Language not supported
- shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-prompt/pom.xml: Language not supported
- shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-proxy/pom.xml: Language not supported
- shenyu-plugin/shenyu-plugin-ai/shenyu-plugin-ai-token-limiter/pom.xml: Language not supported
| exchange.getAttributes().put(Constants.AI_MODEL, providerEnum); | ||
|
|
Copilot
AI
Mar 31, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The attribute 'Constants.AI_MODEL' is set to a providerEnum instead of the AiModel instance, which can lead to runtime errors in components that expect an AiModel. Set the attribute to 'aiModel' instead.
| exchange.getAttributes().put(Constants.AI_MODEL, providerEnum); | |
| exchange.getAttributes().put(Constants.AI_MODEL, aiModel); |
refactor ai plugins
Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.