Skip to content

Conversation

@johnlanni
Copy link
Collaborator

@johnlanni johnlanni commented Oct 20, 2025

Ⅰ. Describe what this PR did

This PR improves the Qwen AI provider configuration by:

  • Default compatible mode: Automatically enables qwenEnableCompatible when qwenEnableCompatible is not explicitly configured, providing better out-of-the-box experience
  • Complete API coverage: Adds missing API endpoints (AsyncAIGC, AsyncTask, V1Rerank) to the compatible mode mapping
  • Better defaults: Ensures users get the official compatible mode behavior by default, reducing configuration complexity

These 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

…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>
@lingma-agents
Copy link

lingma-agents bot commented Oct 20, 2025

改进 Qwen AI 提供商默认兼容模式并补全 API 端点

变更概述
  • 新功能

    • 默认启用 Qwen 兼容模式:当未显式配置 qwenEnableCompatible 时,自动将 qwenEnableCompatible 设置为 true
    • 补全缺失的 API 端点映射:在兼容模式下新增了对 AsyncAIGCAsyncTaskV1Rerank 接口的支持。
  • 配置调整

    • 修改了 Qwen 提供商初始化逻辑,在 JSON 配置解析阶段根据是否存在 qwenEnableSearch 来决定是否默认开启兼容模式。
    • 更新了默认能力集(DefaultCapabilities),确保兼容模式包含所有必要的 API 路径映射。
  • 目的说明

    • 此次更改提升了 Qwen 提供商的开箱即用体验,减少用户手动配置的工作量。
    • 同时增强了与官方兼容模式的一致性,并保持向后兼容性。
变更文件
文件路径 变更说明
plugins/​wasm-go/​extensions/​ai-proxy/​provider/​provider.​go 在 ProviderConfig 的 FromJson 方法中增加了判断逻辑,默认启用 Qwen 官方兼容模式。如果未设置 `qwenEnableCompatible`,则自动激活 `qwenEnableCompatible` 模式;否则按照原有方式从配置读取该值。
plugins/​wasm-go/​extensions/​ai-proxy/​provider/​qwen.​go 在 qwenProviderInitializer 的 DefaultCapabilities 方法中补充了三个新的 API 名称到路径的映射关系,分别是 `ApiNameQwenAsyncAIGC`、`ApiNameQwenAsyncTask` 和 `ApiNameQwenV1Rerank`,以完善兼容模式下的接口支持。

💡 小贴士

与 lingma-agents 交流的方式

📜 直接回复评论
直接回复本条评论,lingma-agents 将自动处理您的请求。例如:

  • 在当前代码中添加详细的注释说明。

  • 请详细介绍一下你说的 LRU 改造方案,并使用伪代码加以说明。

📜 在代码行处标记
在文件的特定位置创建评论并 @lingma-agents。例如:

  • @lingma-agents 分析这个方法的性能瓶颈并提供优化建议。

  • @lingma-agents 对这个方法生成优化代码。

📜 在讨论中提问
在任何讨论中 @lingma-agents 来获取帮助。例如:

  • @lingma-agents 请总结上述讨论并提出解决方案。

  • @lingma-agents 请根据讨论内容生成优化代码。

Copy link

@lingma-agents lingma-agents bot left a 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 💬)
🚀 架构设计建议
以下是对代码架构和设计的综合分析,聚焦于跨文件交互、系统一致性和潜在优化空间。
🔍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.go
  • plugins/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-commenter
Copy link

codecov-commenter commented Oct 20, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 47.91%. Comparing base (ef31e09) to head (81068fb).
⚠️ Report is 745 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             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     
Flag Coverage Δ
wasm-go-plugin-ai-proxy 51.15% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...s/wasm-go/extensions/ai-proxy/provider/provider.go 56.31% <100.00%> (ø)
...ugins/wasm-go/extensions/ai-proxy/provider/qwen.go 28.38% <100.00%> (ø)
plugins/wasm-go/extensions/ai-proxy/test/qwen.go 99.71% <100.00%> (ø)

... and 131 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Change-Id: I25953f72c31946c757736e26a2b8375ff0bcce7e
Copy link
Collaborator

@CH3CHO CH3CHO left a 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: I8f9260330e3cffb88ce7e43ec2145bfd711622f0
Change-Id: I6bed59252ac96d0281a41aa1906071dff7c31759
@johnlanni johnlanni merged commit 271e603 into alibaba:main Oct 22, 2025
15 checks passed
ink-hz pushed a commit to ink-hz/higress-ai-capability-auth that referenced this pull request Nov 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

3 participants