🎨 兼容无返回值情况
This commit is contained in:
parent
c493412066
commit
29fe0d2343
6
pom.xml
6
pom.xml
@ -328,7 +328,7 @@
|
||||
<dependency>
|
||||
<groupId>com.theokanning.openai-gpt3-java</groupId>
|
||||
<artifactId>client</artifactId>
|
||||
<version>0.14.0</version>
|
||||
<version>0.15.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.squareup.retrofit2</groupId>
|
||||
@ -439,7 +439,7 @@
|
||||
<profileActive>dev</profileActive>
|
||||
</properties>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
<profile>
|
||||
@ -448,7 +448,7 @@
|
||||
<profileActive>prod</profileActive>
|
||||
</properties>
|
||||
<activation>
|
||||
<activeByDefault>false</activeByDefault>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user