mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-23 07:41:53 +08:00
增加 QianWenOptions 类型判断,避免强转失败!
This commit is contained in:
parent
6415422f7d
commit
1fada268ac
@ -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.messages.MessageType;
|
||||||
import cn.iocoder.yudao.framework.ai.chat.prompt.ChatOptions;
|
import cn.iocoder.yudao.framework.ai.chat.prompt.ChatOptions;
|
||||||
import cn.iocoder.yudao.framework.ai.chat.prompt.Prompt;
|
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 cn.iocoder.yudao.framework.ai.chatyiyan.exception.YiYanApiException;
|
||||||
import com.aliyun.broadscope.bailian.sdk.models.*;
|
import com.aliyun.broadscope.bailian.sdk.models.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@ -89,6 +90,10 @@ public class QianWenChatClient implements ChatClient, StreamingChatClient {
|
|||||||
if (prompt.getOptions() != null) {
|
if (prompt.getOptions() != null) {
|
||||||
options = (ChatOptions) prompt.getOptions();
|
options = (ChatOptions) prompt.getOptions();
|
||||||
}
|
}
|
||||||
|
// Prompt 里面是一个 ChatOptions,用户可以随意传入,这里做一下判断
|
||||||
|
if (!(options instanceof QianWenOptions)) {
|
||||||
|
throw new ChatException("Prompt 传入的不是 QianWenOptions!");
|
||||||
|
}
|
||||||
QianWenOptions qianWenOptions = (QianWenOptions) options;
|
QianWenOptions qianWenOptions = (QianWenOptions) options;
|
||||||
// 需要额外处理
|
// 需要额外处理
|
||||||
if (!stream) {
|
if (!stream) {
|
||||||
|
Loading…
Reference in New Issue
Block a user