-
Notifications
You must be signed in to change notification settings - Fork 3k
feat: Ai Proxy enhanced with SpringAI & Fallback & Proxy apikey #6145
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
…rt/rule/AiProxyHandle.java Co-authored-by: Copilot <[email protected]>
…rt/rule/AiProxyHandle.java Co-authored-by: Copilot <[email protected]>
…/src/main/java/org/apache/shenyu/plugin/ai/proxy/enhanced/handler/AiProxyPluginHandler.java Co-authored-by: Copilot <[email protected]>
…/src/main/java/org/apache/shenyu/plugin/ai/proxy/enhanced/service/AiProxyExecutorService.java Co-authored-by: Copilot <[email protected]>
…/src/main/java/org/apache/shenyu/plugin/ai/proxy/enhanced/AiProxyPlugin.java Co-authored-by: Copilot <[email protected]>
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 introduces an AI proxy API key mapping feature that allows administrators to create proxy API keys that map to real API keys, enabling secure API key management for AI services. The implementation includes a new enhanced AI proxy plugin with fallback support, retry mechanisms, and comprehensive data synchronization.
Key Changes:
- New AI Proxy API Key Management: Implements a system to map proxy keys to real API keys with admin UI and CRUD operations
- Enhanced AI Proxy Plugin: Replaces the original plugin with enhanced version supporting fallback configurations, retry logic, and proxy key authentication
- Data Synchronization Infrastructure: Adds new ConfigGroupEnum for AI_PROXY_API_KEY with websocket and HTTP sync support
Reviewed Changes
Copilot reviewed 68 out of 68 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
shenyu-common | Adds ProxyApiKeyData DTO and AI_PROXY_API_KEY config group enum |
shenyu-admin | Implements full CRUD operations, mappers, services for proxy API key management |
shenyu-plugin-ai-proxy-enhanced | New enhanced AI proxy plugin with fallback, retry, and proxy key support |
shenyu-sync-data-center | Extends websocket and HTTP sync to handle AI proxy API key data |
shenyu-spring-boot-starter | Updates configuration classes to include AI proxy API key subscribers |
Database schemas | Adds proxy_api_key_mapping table and related UI permissions |
Comments suppressed due to low confidence (4)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/support/AiProxyRealKeyResolver.java
Outdated
Show resolved
Hide resolved
shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/websocket/WebsocketCollector.java
Outdated
Show resolved
Hide resolved
shenyu-admin/src/main/java/org/apache/shenyu/admin/listener/AbstractDataChangedListener.java
Outdated
Show resolved
Hide resolved
...admin/src/main/java/org/apache/shenyu/admin/listener/AiProxySelectorResolverInvalidator.java
Outdated
Show resolved
Hide resolved
shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/AiProxyApiKeyController.java
Outdated
Show resolved
Hide resolved
shenyu-admin/src/main/java/org/apache/shenyu/admin/controller/AiProxyApiKeyController.java
Outdated
Show resolved
Hide resolved
...admin/src/main/java/org/apache/shenyu/admin/listener/AiProxySelectorResolverInvalidator.java
Outdated
Show resolved
Hide resolved
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AiProxyApiKeyServiceImpl.java
Outdated
Show resolved
Hide resolved
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/SelectorServiceImpl.java
Outdated
Show resolved
Hide resolved
shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/SyncDataServiceImpl.java
Outdated
Show resolved
Hide resolved
...org/apache/shenyu/springboot/starter/sync/data/websocket/WebsocketSyncDataConfiguration.java
Outdated
Show resolved
Hide resolved
...in/java/org/apache/shenyu/springboot/starter/plugin/ai/proxy/AiProxyPluginConfiguration.java
Outdated
Show resolved
Hide resolved
...i-proxy-enhanced/src/main/java/org/apache/shenyu/plugin/ai/proxy/enhanced/AiProxyPlugin.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Copilot <[email protected]>
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
Copilot reviewed 69 out of 70 changed files in this pull request and generated 1 comment.
Comments suppressed due to low confidence (2)
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
fallback:
引入SpringAI 重构大模型API调用
通过SpringAI 抛出的 NonTransientAiException 进行降级逻辑,支持admin配置以及请求时配置
支持流式响应相关重构和降级
proxy apikey
支持namespace + selector级别的租户隔离代理apikey生成和管理
支持真实apikey一对多代理apikey,代理apikey仅绑定selectorid,可随时修改真实apikey
todo: