-
Notifications
You must be signed in to change notification settings - Fork 939
feat(ai-proxy): enable Qwen compatible mode by default and add missing API endpoints #3032
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
feat(ai-proxy): enable Qwen compatible mode by default and add missing API endpoints #3032
Conversation
…g API endpoints - Set qwenEnableCompatible to true by default when qwenEnableSearch is not configured - Add missing API endpoints for AsyncAIGC, AsyncTask, and V1Rerank in compatible mode - Improve Qwen provider configuration with better default behavior Change-Id: Ia2674f186c764c06bd7d3b6f7c32400ca99074f9 Co-developed-by: Cursor <noreply@cursor.com>
改进 Qwen AI 提供商默认兼容模式并补全 API 端点变更概述
变更文件
💡 小贴士与 lingma-agents 交流的方式📜 直接回复评论
📜 在代码行处标记
📜 在讨论中提问
|
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.
🔎 代码评审报告
🎯 评审意见概览
| 严重度 | 数量 | 说明 |
|---|---|---|
| 🔴 Blocker | 0 | 阻断性问题,需立即修复。例如:系统崩溃、关键功能不可用或严重安全漏洞。 |
| 🟠 Critical | 0 | 严重问题,高优先级修复。例如:核心功能异常或性能瓶颈影响用户体验。 |
| 🟡 Major | 1 | 主要问题,建议修复。例如:非核心功能缺陷或代码维护性较差。 |
| 🟢 Minor | 0 | 次要问题,酬情优化。例如:代码格式不规范或注释缺失。 |
总计: 1 个问题
📋 评审意见详情
💡 代码实现建议
以下是文件级别的代码建议,聚焦于代码的可读性、可维护性和潜在问题。
🔹 plugins/wasm-go/extensions/ai-proxy/provider/provider.go (1 💬)
- 默认启用Qwen兼容模式的逻辑应更加明确和安全。 (L450-L455)
🚀 架构设计建议
以下是对代码架构和设计的综合分析,聚焦于跨文件交互、系统一致性和潜在优化空间。
🔍1. 默认启用Qwen兼容模式可能引入未预期的行为
在 provider.go 中,默认情况下启用了 Qwen 兼容模式(当 qwenEnableSearch 不存在时)。这可能会导致依赖旧行为的现有配置出现意外行为或错误。建议明确文档说明此变更,并考虑添加警告日志以提醒用户该默认值已被更改。
📌 关键代码
if !json.Get("qwenEnableSearch").Exists() {
// Default use official compatiable mode
c.qwenEnableCompatible = true
} else {
c.qwenEnableCompatible = json.Get("qwenEnableCompatible").Bool()
}可能导致已有部署因默认行为改变而出现问题,特别是在没有显式设置 qwenEnableCompatible 的情况下。
🔍2. 新增API端点缺乏对应的处理逻辑验证
在 qwen.go 文件中增加了三个新的 API 端点映射(ApiNameQwenAsyncAIGC、ApiNameQwenAsyncTask 和 ApiNameQwenV1Rerank),但未提供这些新路径的具体实现或测试覆盖信息。需要确认这些新增接口是否具备完整的请求转发与响应处理能力,以及是否有相应的单元测试来保证其正确性。
📌 关键代码
string(ApiNameQwenAsyncAIGC): qwenAsyncAIGCPath,
string(ApiNameQwenAsyncTask): qwenAsyncTaskPath,
string(ApiNameQwenV1Rerank): qwenTextRerankPath,如果新增的API端点缺少适当实现,则可能导致服务不可用或者返回不正确的结果,影响整体系统稳定性。
审查详情
📒 文件清单 (2 个文件)
📝 变更: 2 个文件
📝 变更文件:
plugins/wasm-go/extensions/ai-proxy/provider/provider.goplugins/wasm-go/extensions/ai-proxy/provider/qwen.go
💡 小贴士
与 lingma-agents 交流的方式
📜 直接回复评论
直接回复本条评论,lingma-agents 将自动处理您的请求。例如:
-
在当前代码中添加详细的注释说明。
-
请详细介绍一下你说的 LRU 改造方案,并使用伪代码加以说明。
📜 在代码行处标记
在文件的特定位置创建评论并 @lingma-agents。例如:
-
@lingma-agents 分析这个方法的性能瓶颈并提供优化建议。
-
@lingma-agents 对这个方法生成优化代码。
📜 在讨论中提问
在任何讨论中 @lingma-agents 来获取帮助。例如:
-
@lingma-agents 请总结上述讨论并提出解决方案。
-
@lingma-agents 请根据讨论内容生成优化代码。
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3032 +/- ##
===========================================
+ Coverage 35.91% 47.91% +12.00%
===========================================
Files 69 136 +67
Lines 11576 25637 +14061
===========================================
+ Hits 4157 12285 +8128
- Misses 7104 12857 +5753
- Partials 315 495 +180
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
CH3CHO
left a comment
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.
LGTM
…fault - Add explicit qwenEnableCompatible: false to basicQwenConfig and qwenCustomDomainConfig - Ensure tests expecting original Qwen API paths work correctly with new default behavior - Maintain backward compatibility while enabling compatible mode by default for new configurations Change-Id: If8be5ea60b540ef07e41409d2e7965c319fa4663 Co-developed-by: Cursor <noreply@cursor.com>
Change-Id: I6bed59252ac96d0281a41aa1906071dff7c31759
Ⅰ. Describe what this PR did
This PR improves the Qwen AI provider configuration by:
qwenEnableCompatiblewhenqwenEnableCompatibleis not explicitly configured, providing better out-of-the-box experienceAsyncAIGC,AsyncTask,V1Rerank) to the compatible mode mappingThese changes enhance the Qwen provider's usability while maintaining backward compatibility.
Ⅱ. Does this pull request fix one issue?
fixes #3031
Ⅲ. Why don't you add test cases (unit test/integration test)?
Ⅳ. Describe how to verify it
Ⅴ. Special notes for reviews