From 1fada268ac9dd4314c10085234f24f035e46adb7 Mon Sep 17 00:00:00 2001 From: cherishsince Date: Sat, 16 Mar 2024 19:54:20 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20QianWenOptions=20=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=E5=88=A4=E6=96=AD=EF=BC=8C=E9=81=BF=E5=85=8D=E5=BC=BA?= =?UTF-8?q?=E8=BD=AC=E5=A4=B1=E8=B4=A5=EF=BC=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yudao/framework/ai/chatqianwen/QianWenChatClient.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatqianwen/QianWenChatClient.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatqianwen/QianWenChatClient.java index 52b2c7b79..f704dee1c 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatqianwen/QianWenChatClient.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatqianwen/QianWenChatClient.java @@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.ai.chat.*; import cn.iocoder.yudao.framework.ai.chat.messages.MessageType; import cn.iocoder.yudao.framework.ai.chat.prompt.ChatOptions; import cn.iocoder.yudao.framework.ai.chat.prompt.Prompt; +import cn.iocoder.yudao.framework.ai.chatyiyan.YiYanOptions; import cn.iocoder.yudao.framework.ai.chatyiyan.exception.YiYanApiException; import com.aliyun.broadscope.bailian.sdk.models.*; import lombok.extern.slf4j.Slf4j; @@ -89,6 +90,10 @@ public class QianWenChatClient implements ChatClient, StreamingChatClient { if (prompt.getOptions() != null) { options = (ChatOptions) prompt.getOptions(); } + // Prompt 里面是一个 ChatOptions,用户可以随意传入,这里做一下判断 + if (!(options instanceof QianWenOptions)) { + throw new ChatException("Prompt 传入的不是 QianWenOptions!"); + } QianWenOptions qianWenOptions = (QianWenOptions) options; // 需要额外处理 if (!stream) {