From fdbe5fa556c90cacbef158dfc66413bce1e00b3d Mon Sep 17 00:00:00 2001 From: JianYu Zheng <2375294554@qq.com> Date: Thu, 24 Jul 2025 17:01:43 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=BA=86=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E9=85=8D=E7=BD=AE=E9=AA=8C=E8=AF=81=20--Mode?= =?UTF-8?q?lConfigServiceImpl.java=20=E4=BF=AE=E6=94=B9=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=EF=BC=8CjsonConfig=20=E9=87=8C=E5=8C=85=E6=8B=ACllm,=E6=A0=A1?= =?UTF-8?q?=E9=AA=8C=E4=B8=80=E4=B8=8Bllm=E6=98=AF=E5=90=A6=E6=97=B6?= =?UTF-8?q?=E5=9C=A8LLM=E6=A8=A1=E5=9E=8B=E9=87=8C,=E5=B9=B6=E4=B8=94?= =?UTF-8?q?=E8=BF=99=E4=B8=AA=E6=A8=A1=E5=9E=8B=E7=9A=84=E4=BE=9B=E5=BA=94?= =?UTF-8?q?=E5=99=A8=E7=B1=BB=E5=9E=8B=E5=8F=AA=E8=83=BD=E6=98=AFopenai?= =?UTF-8?q?=E5=92=8Collama=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/service/impl/ModelConfigServiceImpl.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/main/manager-api/src/main/java/xiaozhi/modules/model/service/impl/ModelConfigServiceImpl.java b/main/manager-api/src/main/java/xiaozhi/modules/model/service/impl/ModelConfigServiceImpl.java index 046b440e..0e85eba9 100644 --- a/main/manager-api/src/main/java/xiaozhi/modules/model/service/impl/ModelConfigServiceImpl.java +++ b/main/manager-api/src/main/java/xiaozhi/modules/model/service/impl/ModelConfigServiceImpl.java @@ -5,6 +5,7 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; @@ -110,6 +111,19 @@ public class ModelConfigServiceImpl extends BaseServiceImpl() + .eq(ModelConfigEntity::getId, llm)); + if(modelConfigEntity == null){ + throw new RenException("设置的LLM不存在"); + } + String type = modelConfigEntity.getConfigJson().get("type").toString(); + // 如果查询大语言模型是openai或者ollama,意图识别选参数都可以 + if(!"openai".equals(type) && !"ollama".equals(type)){ + throw new RenException("设置的LLM不是openai和ollama"); + } + } // 再更新供应器提供的模型 ModelConfigEntity modelConfigEntity = ConvertUtils.sourceToTarget(modelConfigBodyDTO, ModelConfigEntity.class);