diff --git a/pom.xml b/pom.xml
index c12dcd6..ced06b1 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}
@@ -328,7 +329,7 @@
com.theokanning.openai-gpt3-java
client
- 0.14.0
+ 0.15.0
com.squareup.retrofit2
@@ -439,7 +440,7 @@
dev
- true
+ false
@@ -448,7 +449,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;