diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatxinghuo/XingHuoChatClient.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatxinghuo/XingHuoChatClient.java index eef59cac00..849a70d75c 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatxinghuo/XingHuoChatClient.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatxinghuo/XingHuoChatClient.java @@ -5,6 +5,7 @@ import cn.hutool.core.exceptions.ExceptionUtil; import cn.iocoder.yudao.framework.ai.chat.*; import cn.iocoder.yudao.framework.ai.chat.prompt.ChatOptions; import cn.iocoder.yudao.framework.ai.chat.prompt.Prompt; +import cn.iocoder.yudao.framework.ai.chatxinghuo.api.XingHuoApi; import cn.iocoder.yudao.framework.ai.chatxinghuo.api.XingHuoChatCompletion; import cn.iocoder.yudao.framework.ai.chatxinghuo.api.XingHuoChatCompletionRequest; import lombok.extern.slf4j.Slf4j; @@ -69,7 +70,7 @@ public class XingHuoChatClient implements ChatClient, StreamingChatClient { // 创建 request 请求,stream模式需要供应商支持 XingHuoChatCompletionRequest request = this.createRequest(prompt, chatOptions); // 调用 callWithFunctionSupport 发送请求 - ResponseEntity response = xingHuoApi.chatCompletionEntity(request, chatOptions.getDomain()); + ResponseEntity response = xingHuoApi.chatCompletionEntity(request, chatOptions.getChatModel()); // 获取结果封装 ChatResponse return new ChatResponse(List.of(new Generation(response.getBody().getPayload().getChoices().getText().get(0).getContent()))); }); @@ -82,7 +83,7 @@ public class XingHuoChatClient implements ChatClient, StreamingChatClient { // 创建 request 请求,stream模式需要供应商支持 XingHuoChatCompletionRequest request = this.createRequest(prompt, chatOptions); // 发送请求 - Flux response = this.xingHuoApi.chatCompletionStream(request, chatOptions.getDomain()); + Flux response = this.xingHuoApi.chatCompletionStream(request, chatOptions.getChatModel()); return response.map(res -> { String content = res.getPayload().getChoices().getText().stream() .map(item -> item.getContent()).collect(Collectors.joining()); @@ -113,7 +114,7 @@ public class XingHuoChatClient implements ChatClient, StreamingChatClient { // 创建 params XingHuoChatCompletionRequest.Parameter.Chat chatParameter = new XingHuoChatCompletionRequest.Parameter.Chat(); BeanUtil.copyProperties(xingHuoOptions, chatParameter); - chatParameter.setDomain(xingHuoOptions.getDomain().getValue()); + chatParameter.setDomain(xingHuoOptions.getChatModel().getValue()); XingHuoChatCompletionRequest.Parameter parameter = new XingHuoChatCompletionRequest.Parameter().setChat(chatParameter); // 创建 payload text 信息 XingHuoChatCompletionRequest.Payload.Message.Text text = new XingHuoChatCompletionRequest.Payload.Message.Text(); diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatxinghuo/XingHuoOptions.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatxinghuo/XingHuoOptions.java index 5c539d4918..dd839403e1 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatxinghuo/XingHuoOptions.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatxinghuo/XingHuoOptions.java @@ -24,7 +24,7 @@ public class XingHuoOptions implements ChatOptions { * generalv3.5指向V3.5版本; * 注意:不同的取值对应的url也不一样! */ - private XingHuoChatModel domain = XingHuoChatModel.XING_HUO_3_5; + private XingHuoChatModel chatModel = XingHuoChatModel.XING_HUO_3_5; /** * 取值范围 (0,1] ,默认值0.5 */ diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatClientTests.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatClientTests.java index 4a4b06b818..2340ad9a36 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatClientTests.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/test/java/cn/iocoder/yudao/framework/ai/chat/XingHuoChatClientTests.java @@ -1,10 +1,10 @@ package cn.iocoder.yudao.framework.ai.chat; import cn.iocoder.yudao.framework.ai.chat.prompt.Prompt; -import cn.iocoder.yudao.framework.ai.chatxinghuo.XingHuoApi; import cn.iocoder.yudao.framework.ai.chatxinghuo.XingHuoChatClient; import cn.iocoder.yudao.framework.ai.chatxinghuo.XingHuoChatModel; import cn.iocoder.yudao.framework.ai.chatxinghuo.XingHuoOptions; +import cn.iocoder.yudao.framework.ai.chatxinghuo.api.XingHuoApi; import org.junit.Before; import org.junit.Test; import reactor.core.publisher.Flux; @@ -31,7 +31,7 @@ public class XingHuoChatClientTests { "cb6415c19d6162cda07b47316fcb0416", "Y2JiYTIxZjA3MDMxMjNjZjQzYzVmNzdh" ), - new XingHuoOptions().setDomain(XingHuoChatModel.XING_HUO_3_5) + new XingHuoOptions().setChatModel(XingHuoChatModel.XING_HUO_3_5) ); }