[refactor] refactor ai plugins#5986
Merged
moremind merged 21 commits intoapache:masterfrom Apr 14, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
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
Comment on lines
108
to
109
| exchange.getAttributes().put(Constants.AI_MODEL, providerEnum); | ||
|
|
There was a problem hiding this comment.
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.
Suggested change
| exchange.getAttributes().put(Constants.AI_MODEL, providerEnum); | |
| exchange.getAttributes().put(Constants.AI_MODEL, aiModel); |
…nto feat/refactor_ai
moremind
approved these changes
Apr 14, 2025
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.
refactor ai plugins
Make sure that:
./mvnw clean install -Dmaven.javadoc.skip=true.