From 26afa04e80c51f108897acfbf3e2715af9b3848f Mon Sep 17 00:00:00 2001 From: cherishsince Date: Thu, 14 Mar 2024 20:23:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=20=E9=98=BF=E9=87=8C=20?= =?UTF-8?q?=E5=8D=83=E9=97=AE=E5=8F=82=E6=95=B0=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/iocoder/yudao/framework/ai/chatqianwen/QianWenApi.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatqianwen/QianWenApi.java b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatqianwen/QianWenApi.java index dbf6a7d70..93a92364c 100644 --- a/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatqianwen/QianWenApi.java +++ b/yudao-module-ai/yudao-spring-boot-starter-ai/src/main/java/cn/iocoder/yudao/framework/ai/chatqianwen/QianWenApi.java @@ -57,8 +57,10 @@ public class QianWenApi { public ResponseEntity chatCompletionEntity(ChatRequestMessage message) { // 创建request CompletionsRequest request = new CompletionsRequest() + // 设置 appid .setAppId(appId) .setMessages(List.of(message)) + // 返回choice message结果 .setParameters(new CompletionsRequest.Parameter().setResultFormat("message")); // CompletionsResponse response = client.completions(request); @@ -74,8 +76,10 @@ public class QianWenApi { public Flux chatCompletionStream(ChatRequestMessage message) { return client.streamCompletions( new CompletionsRequest() + // 设置 appid .setAppId(appId) .setMessages(List.of(message)) + //开启增量输出模式,后面输出不会包含已经输出的内容 .setParameters(new CompletionsRequest.Parameter().setIncrementalOutput(true)) ); }