fix(llm): drop bogus qwen3-plus seed and gate enable_search to supporting models (issue #53)

This commit is contained in:
matevip 2026-05-02 19:40:03 +08:00
parent dcd5a95982
commit 062b5169fa
7 changed files with 223 additions and 13 deletions

View File

@ -70,18 +70,60 @@ public class AgentDashScopeChatModelBuilder implements ChatModelBuilder {
}
/**
* DashScope's built-in web search is on by default; only an explicit
* {@code enableSearch=false} in provider kwargs disables it. Public so
* {@code AgentGraphBuilder.build()} can surface the "built-in search
* active" log once per agent.
* Bailian's built-in web search is only accepted by a subset of models;
* sending {@code enable_search} to a model that doesn't support it returns
* 400 InvalidParameter and the failover layer then evicts the entire
* provider as MODEL_NOT_FOUND. Per the public docs, only Qwen-Plus,
* Qwen-Max, Qwen-Turbo and the Qwen3-Max series accept the parameter.
*
* <p>Resolution order:</p>
* <ol>
* <li>Explicit {@code enableSearch} in the model row (per-model toggle)</li>
* <li>Explicit {@code enableSearch} in provider kwargs (admin-level toggle)</li>
* <li>Default: enabled only when the model name matches a known-supporting
* prefix; disabled for everything else (coder / thinking / DeepSeek /
* Long / Vision)</li>
* </ol>
*
* <p>Public so {@code AgentGraphBuilder.build()} can surface the
* "built-in search active" log once per agent.</p>
*/
public boolean isBuiltinSearchEnabled(ModelConfigEntity runtimeModel, ModelProviderEntity provider) {
if (runtimeModel != null && runtimeModel.getEnableSearch() != null) {
return Boolean.TRUE.equals(runtimeModel.getEnableSearch());
}
Map<String, Object> kwargs = modelProviderService.readProviderGenerateKwargs(provider);
Object kwargsSearch = kwargs.get("enableSearch");
if (kwargsSearch != null) {
return Boolean.TRUE.equals(kwargsSearch);
}
return true;
return modelSupportsBuiltinSearch(runtimeModel);
}
/**
* Model id prefixes that the Bailian text-generation endpoint documents as
* accepting {@code enable_search}. Anything else (qwen-coder-*, qwen-long,
* qwen3-*-thinking-*, deepseek-*, qwen*-vl-*) returns 400 InvalidParameter
* when the parameter is sent.
*/
private static final java.util.List<String> BUILTIN_SEARCH_SUPPORTED_PREFIXES = java.util.List.of(
"qwen-plus",
"qwen-max",
"qwen-turbo",
"qwen3-max",
"qwen3.5-flash",
"qwen3.6-flash"
);
private static boolean modelSupportsBuiltinSearch(ModelConfigEntity model) {
if (model == null) return false;
String name = model.getModelName();
if (!StringUtils.hasText(name)) return false;
String lower = name.trim().toLowerCase();
for (String prefix : BUILTIN_SEARCH_SUPPORTED_PREFIXES) {
if (lower.startsWith(prefix)) return true;
}
return false;
}
DashScopeChatOptions buildDashScopeOptions(ModelConfigEntity runtimeModel, ModelProviderEntity provider) {

View File

@ -171,9 +171,13 @@ MERGE INTO mate_model_config (id, name, provider, model_name, description, tempe
(1000000101, 'Qwen3 Max', 'dashscope', 'qwen3-max', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000102, 'Qwen3 235B A22B Thinking', 'dashscope', 'qwen3-235b-a22b-thinking-2507', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000103, 'DeepSeek-V3.2', 'dashscope', 'deepseek-v3.2', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
-- Removed: qwen3.5-plus / qwen3.5-max — unavailable on DashScope native protocol (returns 400 InvalidParameter)
(1000000172, 'Qwen3 Plus', 'dashscope', 'qwen3-plus', 'Qwen3 balanced model', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
-- Note: dotted Qwen3 versions (qwen3-plus / qwen3.5-plus / qwen3.5-max / qwen3.6-*) only ship on the
-- OpenAI-compatible endpoint. Calling them through DashScope native (text-generation/generation)
-- returns 400 InvalidParameter — use the bailian-team OpenAI-compat provider instead.
(1000000173, 'Qwen Long', 'dashscope', 'qwen-long', 'Long-context model with extended context support', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000174, 'Qwen Plus (latest)', 'dashscope', 'qwen-plus-latest', 'Latest stable snapshot of Qwen Plus — auto-updates as Bailian rolls new releases', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000175, 'Qwen Max (latest)', 'dashscope', 'qwen-max-latest', 'Latest stable snapshot of Qwen Max — strongest reasoning capability', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000176, 'Qwen Turbo (latest)', 'dashscope', 'qwen-turbo-latest', 'Latest stable snapshot of Qwen Turbo — low latency, high frequency', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000104, 'Qwen3.5-122B-A10B', 'modelscope', 'Qwen/Qwen3.5-122B-A10B', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000105, 'GLM-5', 'modelscope', 'ZhipuAI/GLM-5', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000106, 'Qwen3.5 Plus', 'aliyun-codingplan', 'qwen3.5-plus', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),

View File

@ -186,9 +186,13 @@ VALUES
(1000000101, 'Qwen3 Max', 'dashscope', 'qwen3-max', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000102, 'Qwen3 235B A22B Thinking', 'dashscope', 'qwen3-235b-a22b-thinking-2507', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000103, 'DeepSeek-V3.2', 'dashscope', 'deepseek-v3.2', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
-- Removed: qwen3.5-plus / qwen3.5-max — unavailable on DashScope native protocol (returns 400 InvalidParameter)
(1000000172, 'Qwen3 Plus', 'dashscope', 'qwen3-plus', 'Qwen3 balanced model', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
-- Note: dotted Qwen3 versions (qwen3-plus / qwen3.5-plus / qwen3.5-max / qwen3.6-*) only ship on the
-- OpenAI-compatible endpoint. Calling them through DashScope native (text-generation/generation)
-- returns 400 InvalidParameter — use the bailian-team OpenAI-compat provider instead.
(1000000173, 'Qwen Long', 'dashscope', 'qwen-long', 'Long-context model with extended context support', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000174, 'Qwen Plus (latest)', 'dashscope', 'qwen-plus-latest', 'Latest stable snapshot of Qwen Plus — auto-updates as Bailian rolls new releases', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000175, 'Qwen Max (latest)', 'dashscope', 'qwen-max-latest', 'Latest stable snapshot of Qwen Max — strongest reasoning capability', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000176, 'Qwen Turbo (latest)', 'dashscope', 'qwen-turbo-latest', 'Latest stable snapshot of Qwen Turbo — low latency, high frequency', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000104, 'Qwen3.5-122B-A10B', 'modelscope', 'Qwen/Qwen3.5-122B-A10B', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000105, 'GLM-5', 'modelscope', 'ZhipuAI/GLM-5', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000106, 'Qwen3.5 Plus', 'aliyun-codingplan', 'qwen3.5-plus', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
@ -206,6 +210,16 @@ VALUES
(1000000404, 'Qwen Image 2.0 Pro', 'bailian-team', 'qwen-image-2.0-pro', 'Bailian Token Plan — Qwen image generation flagship model', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000405, 'Wan 2.7 Image', 'bailian-team', 'wan2.7-image', 'Bailian Token Plan — Wan image generation model', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000406, 'Wan 2.7 Image Pro', 'bailian-team', 'wan2.7-image-pro', 'Bailian Token Plan — Wan image generation flagship model', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000407, 'Qwen 3.5 Plus', 'bailian-team', 'qwen3.5-plus', 'Bailian Token Plan — Qwen3.5 balanced flagship, hybrid thinking, 128K context', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000408, 'Qwen 3.5 Flash', 'bailian-team', 'qwen3.5-flash', 'Bailian Token Plan — Qwen3.5 fast variant for high-frequency calls', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000409, 'Qwen3 VL Plus', 'bailian-team', 'qwen3-vl-plus', 'Bailian Token Plan — Qwen3 vision-language flagship, image + video', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000410, 'Qwen3 VL Flash', 'bailian-team', 'qwen3-vl-flash', 'Bailian Token Plan — Qwen3 vision-language fast variant', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000411, 'Qwen3 Coder Plus', 'bailian-team', 'qwen3-coder-plus', 'Bailian Token Plan — Qwen3 coding flagship, agentic code editing & tools', 0.2, 8192, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000412, 'Qwen 3.6 Plus 2026-04-02', 'bailian-team', 'qwen3.6-plus-2026-04-02', 'Bailian Token Plan — pinned snapshot of Qwen 3.6 Plus released 2026-04-02', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000413, 'Qwen 3.6 Max (preview)', 'bailian-team', 'qwen3.6-max-preview', 'Bailian Token Plan — Qwen3.6 Max preview, strongest 3.6 reasoning', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000414, 'Qwen 3.6 Flash', 'bailian-team', 'qwen3.6-flash', 'Bailian Token Plan — Qwen3.6 fast variant, hybrid thinking default-on', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000415, 'Qwen 3.6 Flash 2026-04-16','bailian-team', 'qwen3.6-flash-2026-04-16','Bailian Token Plan — pinned snapshot of Qwen 3.6 Flash released 2026-04-16', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000416, 'Qwen 3.5 Omni Plus', 'bailian-team', 'qwen3.5-omni-plus', 'Bailian Token Plan — Qwen3.5 omni-modal plus, text + vision + audio in/out', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000114, 'GPT-5.2', 'openai', 'gpt-5.2', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000115, 'GPT-5', 'openai', 'gpt-5', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000116, 'GPT-5 Mini', 'openai', 'gpt-5-mini', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),

View File

@ -186,9 +186,12 @@ VALUES
(1000000101, 'Qwen3 Max', 'dashscope', 'qwen3-max', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000102, 'Qwen3 235B A22B Thinking', 'dashscope', 'qwen3-235b-a22b-thinking-2507', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000103, 'DeepSeek-V3.2', 'dashscope', 'deepseek-v3.2', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
-- Removed: qwen3.5-plus / qwen3.5-max — unavailable on DashScope native protocol (returns 400 InvalidParameter)
(1000000172, 'Qwen3 Plus', 'dashscope', 'qwen3-plus', 'Qwen3 均衡模型', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
-- 注意: qwen3-plus / qwen3.5-plus / qwen3.5-max / qwen3.6-* 等带点号的版本只在 OpenAI 兼容端点上线,
-- DashScope nativetext-generation/generation调用会返回 400 InvalidParameter请使用 bailian-team 等 OpenAI-compat provider。
(1000000173, 'Qwen Long', 'dashscope', 'qwen-long', '长文本模型,支持超长上下文', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000174, 'Qwen Plus (latest)', 'dashscope', 'qwen-plus-latest', '通义千问 Plus 最新稳定快照,自动跟随官方更新', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000175, 'Qwen Max (latest)', 'dashscope', 'qwen-max-latest', '通义千问 Max 最新稳定快照,最强推理能力', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000176, 'Qwen Turbo (latest)', 'dashscope', 'qwen-turbo-latest', '通义千问 Turbo 最新稳定快照,低延迟、高并发', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000104, 'Qwen3.5-122B-A10B', 'modelscope', 'Qwen/Qwen3.5-122B-A10B', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000105, 'GLM-5', 'modelscope', 'ZhipuAI/GLM-5', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000106, 'Qwen3.5 Plus', 'aliyun-codingplan', 'qwen3.5-plus', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
@ -206,6 +209,16 @@ VALUES
(1000000404, 'Qwen Image 2.0 Pro', 'bailian-team', 'qwen-image-2.0-pro', '百炼团队套餐 — 千问图片生成旗舰模型', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000405, 'Wan 2.7 Image', 'bailian-team', 'wan2.7-image', '百炼团队套餐 — 万相图片生成模型', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000406, 'Wan 2.7 Image Pro', 'bailian-team', 'wan2.7-image-pro', '百炼团队套餐 — 万相图片生成旗舰模型', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000407, 'Qwen 3.5 Plus', 'bailian-team', 'qwen3.5-plus', '百炼团队套餐 — Qwen3.5 均衡旗舰混合思考128K 上下文', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000408, 'Qwen 3.5 Flash', 'bailian-team', 'qwen3.5-flash', '百炼团队套餐 — Qwen3.5 快速版,低延迟、高并发', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000409, 'Qwen3 VL Plus', 'bailian-team', 'qwen3-vl-plus', '百炼团队套餐 — Qwen3 视觉旗舰,支持图像与视频理解', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000410, 'Qwen3 VL Flash', 'bailian-team', 'qwen3-vl-flash', '百炼团队套餐 — Qwen3 视觉快速版,高吞吐视觉调用', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000411, 'Qwen3 Coder Plus', 'bailian-team', 'qwen3-coder-plus', '百炼团队套餐 — Qwen3 编码旗舰,智能体代码编辑与工具调用', 0.2, 8192, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000412, 'Qwen 3.6 Plus 2026-04-02', 'bailian-team', 'qwen3.6-plus-2026-04-02', '百炼团队套餐 — Qwen 3.6 Plus 2026-04-02 锁定快照', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000413, 'Qwen 3.6 Max (preview)', 'bailian-team', 'qwen3.6-max-preview', '百炼团队套餐 — Qwen3.6 Max 预览版3.6 系列最强推理', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000414, 'Qwen 3.6 Flash', 'bailian-team', 'qwen3.6-flash', '百炼团队套餐 — Qwen3.6 快速版,混合思考默认开启', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000415, 'Qwen 3.6 Flash 2026-04-16','bailian-team', 'qwen3.6-flash-2026-04-16','百炼团队套餐 — Qwen 3.6 Flash 2026-04-16 锁定快照', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000416, 'Qwen 3.5 Omni Plus', 'bailian-team', 'qwen3.5-omni-plus', '百炼团队套餐 — Qwen3.5 全模态版,文本/视觉/音频输入输出', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000114, 'GPT-5.2', 'openai', 'gpt-5.2', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000115, 'GPT-5', 'openai', 'gpt-5', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000116, 'GPT-5 Mini', 'openai', 'gpt-5-mini', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),

View File

@ -175,9 +175,12 @@ MERGE INTO mate_model_config (id, name, provider, model_name, description, tempe
(1000000101, 'Qwen3 Max', 'dashscope', 'qwen3-max', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000102, 'Qwen3 235B A22B Thinking', 'dashscope', 'qwen3-235b-a22b-thinking-2507', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000103, 'DeepSeek-V3.2', 'dashscope', 'deepseek-v3.2', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
-- Removed: qwen3.5-plus / qwen3.5-max — unavailable on DashScope native protocol (returns 400 InvalidParameter)
(1000000172, 'Qwen3 Plus', 'dashscope', 'qwen3-plus', 'Qwen3 均衡模型', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
-- 注意: qwen3-plus / qwen3.5-plus / qwen3.5-max / qwen3.6-* 等带点号的版本只在 OpenAI 兼容端点上线,
-- DashScope nativetext-generation/generation调用会返回 400 InvalidParameter请使用 bailian-team 等 OpenAI-compat provider。
(1000000173, 'Qwen Long', 'dashscope', 'qwen-long', '长文本模型,支持超长上下文', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000174, 'Qwen Plus (latest)', 'dashscope', 'qwen-plus-latest', '通义千问 Plus 最新稳定快照,自动跟随官方更新', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000175, 'Qwen Max (latest)', 'dashscope', 'qwen-max-latest', '通义千问 Max 最新稳定快照,最强推理能力', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000176, 'Qwen Turbo (latest)', 'dashscope', 'qwen-turbo-latest', '通义千问 Turbo 最新稳定快照,低延迟、高并发', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000104, 'Qwen3.5-122B-A10B', 'modelscope', 'Qwen/Qwen3.5-122B-A10B', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000105, 'GLM-5', 'modelscope', 'ZhipuAI/GLM-5', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),
(1000000106, 'Qwen3.5 Plus', 'aliyun-codingplan', 'qwen3.5-plus', '', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, NOW(), NOW(), 0),

View File

@ -0,0 +1,85 @@
-- Refresh the Bailian (Aliyun Model Studio) Qwen catalog to match the 2026 Q2
-- model lineup, and remove a non-existent model id that triggered 400
-- InvalidParameter on the native text-generation endpoint.
--
-- Why now:
-- * Reported user error: "Bad request, please check input (type=MODEL_NOT_FOUND)"
-- when chatting with the seeded "Qwen3 Plus" entry.
-- * Root cause: model id `qwen3-plus` does not exist on Bailian. The real
-- balanced Qwen3 series uses dotted minor versions (`qwen3.5-plus`,
-- `qwen3.6-plus`); plain `qwen3-plus` was never published. DashScope's
-- native endpoint rejects it with `[InvalidParameter]`, which our
-- failover classifier maps to MODEL_NOT_FOUND and evicts the entire
-- dashscope provider from the pool.
--
-- Two-part fix:
-- 1. Soft-delete the bogus `qwen3-plus` row (id 1000000172).
-- 2. Seed three latest-snapshot trackers on the dashscope native provider
-- (qwen-plus-latest / qwen-max-latest / qwen-turbo-latest) and six
-- newer Qwen3 series models on the bailian-team OpenAI-compat provider
-- where they are documented to work (vision + flash + coder + 3.6 snapshot).
-- 1. Soft-delete the bogus model id (idempotent).
UPDATE mate_model_config
SET deleted = 1, enabled = FALSE, update_time = CURRENT_TIMESTAMP
WHERE id = 1000000172
AND model_name = 'qwen3-plus';
-- 2a. Latest-snapshot trackers on dashscope native (text-generation endpoint).
-- These ids forward to whatever Bailian currently considers the stable
-- release of the series, so users don't have to chase dated snapshots.
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000174, 'Qwen Plus (latest)', 'dashscope', 'qwen-plus-latest', 'Latest stable snapshot of Qwen Plus — auto-updates as Bailian rolls new releases.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000175, 'Qwen Max (latest)', 'dashscope', 'qwen-max-latest', 'Latest stable snapshot of Qwen Max — strongest reasoning capability.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000176, 'Qwen Turbo (latest)', 'dashscope', 'qwen-turbo-latest', 'Latest stable snapshot of Qwen Turbo — low latency, high frequency.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);
-- 2b. Newer Qwen3 series on the bailian-team OpenAI-compat token plan endpoint.
-- These models target the OpenAI-compatible URL and accept the same
-- tool-call schema as any other OpenAI-compat provider.
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000407, 'Qwen 3.5 Plus', 'bailian-team', 'qwen3.5-plus', 'Bailian Token Plan — Qwen3.5 balanced flagship, hybrid thinking, 128K context.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000408, 'Qwen 3.5 Flash', 'bailian-team', 'qwen3.5-flash', 'Bailian Token Plan — Qwen3.5 fast variant, lower latency for high-frequency calls.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000409, 'Qwen3 VL Plus', 'bailian-team', 'qwen3-vl-plus', 'Bailian Token Plan — Qwen3 vision-language flagship, image + video understanding.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000410, 'Qwen3 VL Flash', 'bailian-team', 'qwen3-vl-flash', 'Bailian Token Plan — Qwen3 vision-language fast variant for high-throughput vision.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000411, 'Qwen3 Coder Plus', 'bailian-team', 'qwen3-coder-plus', 'Bailian Token Plan — Qwen3 coding flagship, agentic code editing and tool use.', 0.2, 8192, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000412, 'Qwen 3.6 Plus 2026-04-02', 'bailian-team', 'qwen3.6-plus-2026-04-02', 'Bailian Token Plan — pinned snapshot of Qwen 3.6 Plus released 2026-04-02.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000413, 'Qwen 3.6 Max (preview)', 'bailian-team', 'qwen3.6-max-preview', 'Bailian Token Plan — Qwen3.6 Max preview, strongest reasoning in the 3.6 lineup.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000414, 'Qwen 3.6 Flash', 'bailian-team', 'qwen3.6-flash', 'Bailian Token Plan — Qwen3.6 fast variant, hybrid thinking mode default-on.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000415, 'Qwen 3.6 Flash 2026-04-16', 'bailian-team', 'qwen3.6-flash-2026-04-16', 'Bailian Token Plan — pinned snapshot of Qwen 3.6 Flash released 2026-04-16.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);
MERGE INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
KEY (id)
VALUES (1000000416, 'Qwen 3.5 Omni Plus', 'bailian-team', 'qwen3.5-omni-plus', 'Bailian Token Plan — Qwen3.5 omni-modal plus, text + vision + audio in/out.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, 0);

View File

@ -0,0 +1,49 @@
-- Refresh the Bailian (Aliyun Model Studio) Qwen catalog to match the 2026 Q2
-- model lineup, and remove a non-existent model id that triggered 400
-- InvalidParameter on the native text-generation endpoint.
--
-- Why now:
-- * Reported user error: "Bad request, please check input (type=MODEL_NOT_FOUND)"
-- when chatting with the seeded "Qwen3 Plus" entry.
-- * Root cause: model id `qwen3-plus` does not exist on Bailian. The real
-- balanced Qwen3 series uses dotted minor versions (`qwen3.5-plus`,
-- `qwen3.6-plus`); plain `qwen3-plus` was never published. DashScope's
-- native endpoint rejects it with `[InvalidParameter]`, which our
-- failover classifier maps to MODEL_NOT_FOUND and evicts the entire
-- dashscope provider from the pool.
--
-- Two-part fix:
-- 1. Soft-delete the bogus `qwen3-plus` row (id 1000000172).
-- 2. Seed three latest-snapshot trackers on the dashscope native provider
-- (qwen-plus-latest / qwen-max-latest / qwen-turbo-latest) and six
-- newer Qwen3 series models on the bailian-team OpenAI-compat provider
-- where they are documented to work (vision + flash + coder + 3.6 snapshot).
-- 1. Soft-delete the bogus model id (idempotent).
UPDATE mate_model_config
SET deleted = 1, enabled = FALSE, update_time = NOW()
WHERE id = 1000000172
AND model_name = 'qwen3-plus';
-- 2a. Latest-snapshot trackers on dashscope native (text-generation endpoint).
INSERT INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
VALUES
(1000000174, 'Qwen Plus (latest)', 'dashscope', 'qwen-plus-latest', 'Latest stable snapshot of Qwen Plus — auto-updates as Bailian rolls new releases.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0),
(1000000175, 'Qwen Max (latest)', 'dashscope', 'qwen-max-latest', 'Latest stable snapshot of Qwen Max — strongest reasoning capability.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0),
(1000000176, 'Qwen Turbo (latest)', 'dashscope', 'qwen-turbo-latest', 'Latest stable snapshot of Qwen Turbo — low latency, high frequency.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0)
ON DUPLICATE KEY UPDATE name=VALUES(name), description=VALUES(description), model_type=VALUES(model_type), update_time=VALUES(update_time);
-- 2b. Newer Qwen3 series on the bailian-team OpenAI-compat token plan endpoint.
INSERT INTO mate_model_config (id, name, provider, model_name, description, temperature, max_tokens, top_p, builtin, enabled, is_default, model_type, create_time, update_time, deleted)
VALUES
(1000000407, 'Qwen 3.5 Plus', 'bailian-team', 'qwen3.5-plus', 'Bailian Token Plan — Qwen3.5 balanced flagship, hybrid thinking, 128K context.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0),
(1000000408, 'Qwen 3.5 Flash', 'bailian-team', 'qwen3.5-flash', 'Bailian Token Plan — Qwen3.5 fast variant, lower latency for high-frequency calls.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0),
(1000000409, 'Qwen3 VL Plus', 'bailian-team', 'qwen3-vl-plus', 'Bailian Token Plan — Qwen3 vision-language flagship, image + video understanding.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0),
(1000000410, 'Qwen3 VL Flash', 'bailian-team', 'qwen3-vl-flash', 'Bailian Token Plan — Qwen3 vision-language fast variant for high-throughput vision.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0),
(1000000411, 'Qwen3 Coder Plus', 'bailian-team', 'qwen3-coder-plus', 'Bailian Token Plan — Qwen3 coding flagship, agentic code editing and tool use.', 0.2, 8192, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0),
(1000000412, 'Qwen 3.6 Plus 2026-04-02', 'bailian-team', 'qwen3.6-plus-2026-04-02','Bailian Token Plan — pinned snapshot of Qwen 3.6 Plus released 2026-04-02.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0),
(1000000413, 'Qwen 3.6 Max (preview)', 'bailian-team', 'qwen3.6-max-preview', 'Bailian Token Plan — Qwen3.6 Max preview, strongest reasoning in the 3.6 lineup.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0),
(1000000414, 'Qwen 3.6 Flash', 'bailian-team', 'qwen3.6-flash', 'Bailian Token Plan — Qwen3.6 fast variant, hybrid thinking mode default-on.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0),
(1000000415, 'Qwen 3.6 Flash 2026-04-16','bailian-team', 'qwen3.6-flash-2026-04-16','Bailian Token Plan — pinned snapshot of Qwen 3.6 Flash released 2026-04-16.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0),
(1000000416, 'Qwen 3.5 Omni Plus', 'bailian-team', 'qwen3.5-omni-plus', 'Bailian Token Plan — Qwen3.5 omni-modal plus, text + vision + audio in/out.', 0.7, 4096, 0.8, TRUE, TRUE, FALSE, 'chat', NOW(), NOW(), 0)
ON DUPLICATE KEY UPDATE name=VALUES(name), description=VALUES(description), model_type=VALUES(model_type), update_time=VALUES(update_time);