From 29fe0d2343f1de107d2f43b7cb71b326839c7cd5 Mon Sep 17 00:00:00 2001 From: ronger Date: Sun, 8 Oct 2023 16:26:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?:art:=20=E5=85=BC=E5=AE=B9=E6=97=A0?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=80=BC=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 6 +++--- src/main/java/com/rymcu/forest/openai/OpenAiController.java | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index ebce38e..0775197 100644 --- a/pom.xml +++ b/pom.xml @@ -328,7 +328,7 @@ com.theokanning.openai-gpt3-java client - 0.14.0 + 0.15.0 com.squareup.retrofit2 @@ -439,7 +439,7 @@ dev - true + false @@ -448,7 +448,7 @@ prod - false + true diff --git a/src/main/java/com/rymcu/forest/openai/OpenAiController.java b/src/main/java/com/rymcu/forest/openai/OpenAiController.java index 1aa635a..4375c81 100644 --- a/src/main/java/com/rymcu/forest/openai/OpenAiController.java +++ b/src/main/java/com/rymcu/forest/openai/OpenAiController.java @@ -86,6 +86,9 @@ public class OpenAiController { .build(); service.streamChatCompletion(completionRequest).doOnError(Throwable::printStackTrace) .blockingForEach(chunk -> { + if (chunk.getChoices().isEmpty() || chunk.getChoices().get(0).getMessage() == null) { + return; + } String text = chunk.getChoices().get(0).getMessage().getContent(); if (text == null) { return; From f8b6ab363259752dcd89a11920788d40b6ae924a Mon Sep 17 00:00:00 2001 From: ronger Date: Tue, 10 Oct 2023 08:49:12 +0800 Subject: [PATCH 2/2] =?UTF-8?q?:arrow=5Fup:=20huTool=20=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 0775197..3b7e1b3 100644 --- a/pom.xml +++ b/pom.xml @@ -19,6 +19,7 @@ 1.8 8.11.2 + 5.8.22 @@ -305,12 +306,12 @@ cn.hutool hutool-core - 5.8.20 + ${hutool.version} cn.hutool hutool-http - 5.8.20 + ${hutool.version}