From 36721f4cfbd45a17ffa6dd84c09668c1eedc6c9f Mon Sep 17 00:00:00 2001 From: ronger Date: Mon, 17 Jul 2023 10:41:39 +0800 Subject: [PATCH] =?UTF-8?q?:art:=20openai=20model=20=E5=88=87=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/rymcu/forest/openai/OpenAiController.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/rymcu/forest/openai/OpenAiController.java b/src/main/java/com/rymcu/forest/openai/OpenAiController.java index 6820373..f70c949 100644 --- a/src/main/java/com/rymcu/forest/openai/OpenAiController.java +++ b/src/main/java/com/rymcu/forest/openai/OpenAiController.java @@ -7,6 +7,7 @@ import com.rymcu.forest.entity.User; import com.rymcu.forest.openai.entity.ChatMessageModel; import com.rymcu.forest.openai.service.OpenAiService; import com.rymcu.forest.openai.service.SseService; +import com.rymcu.forest.util.Html2TextUtil; import com.rymcu.forest.util.UserUtils; import com.theokanning.openai.completion.chat.ChatCompletionChoice; import com.theokanning.openai.completion.chat.ChatCompletionChunk; @@ -72,7 +73,7 @@ public class OpenAiController { list.add(message); } messages.forEach(chatMessageModel -> { - ChatMessage message = new ChatMessage(chatMessageModel.getRole(), chatMessageModel.getContent()); + ChatMessage message = new ChatMessage(chatMessageModel.getRole(), Html2TextUtil.getContent(chatMessageModel.getContent())); list.add(message); }); return sendMessage(user, list); @@ -82,7 +83,7 @@ public class OpenAiController { private GlobalResult sendMessage(User user, List list) { OpenAiService service = new OpenAiService(token, Duration.ofSeconds(180)); ChatCompletionRequest completionRequest = ChatCompletionRequest.builder() - .model("gpt-3.5-turbo") + .model("gpt-3.5-turbo-16k-0613") .stream(true) .messages(list) .build();