⬆️ huTool 依赖升级

⬆️ huTool 依赖升级
This commit is contained in:
ronger 2023-10-10 08:52:01 +08:00 committed by GitHub
commit 992b582ac8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 5 deletions

11
pom.xml
View File

@ -19,6 +19,7 @@
<properties> <properties>
<java.version>1.8</java.version> <java.version>1.8</java.version>
<lucene.version>8.11.2</lucene.version> <lucene.version>8.11.2</lucene.version>
<hutool.version>5.8.22</hutool.version>
</properties> </properties>
<dependencies> <dependencies>
@ -305,12 +306,12 @@
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-core</artifactId> <artifactId>hutool-core</artifactId>
<version>5.8.20</version> <version>${hutool.version}</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>cn.hutool</groupId> <groupId>cn.hutool</groupId>
<artifactId>hutool-http</artifactId> <artifactId>hutool-http</artifactId>
<version>5.8.20</version> <version>${hutool.version}</version>
</dependency> </dependency>
<dependency> <dependency>
@ -328,7 +329,7 @@
<dependency> <dependency>
<groupId>com.theokanning.openai-gpt3-java</groupId> <groupId>com.theokanning.openai-gpt3-java</groupId>
<artifactId>client</artifactId> <artifactId>client</artifactId>
<version>0.14.0</version> <version>0.15.0</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.squareup.retrofit2</groupId> <groupId>com.squareup.retrofit2</groupId>
@ -439,7 +440,7 @@
<profileActive>dev</profileActive> <profileActive>dev</profileActive>
</properties> </properties>
<activation> <activation>
<activeByDefault>true</activeByDefault> <activeByDefault>false</activeByDefault>
</activation> </activation>
</profile> </profile>
<profile> <profile>
@ -448,7 +449,7 @@
<profileActive>prod</profileActive> <profileActive>prod</profileActive>
</properties> </properties>
<activation> <activation>
<activeByDefault>false</activeByDefault> <activeByDefault>true</activeByDefault>
</activation> </activation>
</profile> </profile>
</profiles> </profiles>

View File

@ -86,6 +86,9 @@ public class OpenAiController {
.build(); .build();
service.streamChatCompletion(completionRequest).doOnError(Throwable::printStackTrace) service.streamChatCompletion(completionRequest).doOnError(Throwable::printStackTrace)
.blockingForEach(chunk -> { .blockingForEach(chunk -> {
if (chunk.getChoices().isEmpty() || chunk.getChoices().get(0).getMessage() == null) {
return;
}
String text = chunk.getChoices().get(0).getMessage().getContent(); String text = chunk.getChoices().get(0).getMessage().getContent();
if (text == null) { if (text == null) {
return; return;