From 828ece526e78cf166dfe74dcd8dffeb903e44974 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=80=AA=E7=A8=8B=E4=BC=9F?= Date: Wed, 20 May 2026 09:29:11 +0800 Subject: [PATCH] fix(llm): add text-embedding- prefix to DashScope native model allow-list (#172) Closes #168 The native DashScope provider exposes both chat and embedding models, but DASHSCOPE_NATIVE_ALLOW_PREFIXES only listed chat families (qwen-/qwen2-/qwen3-/deepseek-/baichuan/yi-/llama). When a user manually added text-embedding-v1/v2/v3/v4 to the dashscope provider, assertModelIdAcceptable() rejected the id because no allow prefix matched. Add 'text-embedding-' to the allow-list and broaden the doc comment from "native chat protocol" to "native protocol (chat or embedding)" so the intent is clear. Discovery probing is chat-based and will still mark embedding entries probeOk=false; surfacing them as discoverable embedding suggestions is a separate follow-up. --- .../java/vip/mate/llm/service/ModelDiscoveryService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mateclaw-server/src/main/java/vip/mate/llm/service/ModelDiscoveryService.java b/mateclaw-server/src/main/java/vip/mate/llm/service/ModelDiscoveryService.java index c2921f7f..a9f531c7 100644 --- a/mateclaw-server/src/main/java/vip/mate/llm/service/ModelDiscoveryService.java +++ b/mateclaw-server/src/main/java/vip/mate/llm/service/ModelDiscoveryService.java @@ -141,8 +141,8 @@ public class ModelDiscoveryService { /** * Allow-list prefixes for DashScope models that are known to work on the native - * chat protocol. An empty set means "no prefix filter" (we still apply DENY). - * Extend conservatively as new families are verified. + * protocol (chat or embedding). An empty set means "no prefix filter" (we still + * apply DENY). Extend conservatively as new families are verified. */ private static final Set DASHSCOPE_NATIVE_ALLOW_PREFIXES = Set.of( "qwen-", // qwen-max / qwen-plus / qwen-turbo / qwen-coder-* / qwen-long @@ -151,7 +151,8 @@ public class ModelDiscoveryService { "deepseek-", // deepseek-v3.x / deepseek-r1* "baichuan", "yi-", - "llama" + "llama", + "text-embedding-" // DashScope embedding models (text-embedding-v1/v2/v3/v4) ); // ==================== 模型发现 ====================