|
|
@@ -50,7 +50,7 @@ public class ConsoleStreamListener extends AbstractStreamListener {
|
|
|
return;
|
|
|
}
|
|
|
|
|
|
- if (content.contains("失败")) {
|
|
|
+ if (content.contains("失败") || content.contains("Generation failed")) {
|
|
|
//将用户使用次数返回
|
|
|
miniPopularizeCommonService.recoverUserLimit(userId, recoverNum);
|
|
|
miniPopularizeCommonService.saveImgRecord(setImagRecord(imgRecordId, img, MiniPopularizeUserConversationChat.Status.fail, content));
|
|
|
@@ -65,7 +65,7 @@ public class ConsoleStreamListener extends AbstractStreamListener {
|
|
|
//将用户使用次数返回
|
|
|
miniPopularizeCommonService.recoverUserLimit(userId, recoverNum);
|
|
|
miniPopularizeCommonService.saveImgRecord(setImagRecord(imgRecordId, null, MiniPopularizeUserConversationChat.Status.fail, "出图失败"));
|
|
|
- log.error("gpt对话异常,异常key:{}", response);
|
|
|
+ log.error("gpt对话异常,异常:{}", response);
|
|
|
Message message = Message.ofAssistant("图片生成异常");
|
|
|
SendMessageUtil.sendMessage(userId, message);
|
|
|
message = Message.ofAssistant("[DONE]");
|
|
|
@@ -74,11 +74,13 @@ public class ConsoleStreamListener extends AbstractStreamListener {
|
|
|
}
|
|
|
|
|
|
public MiniPopularizeUserConversationChat setImagRecord(Long imagRecordId, String img, MiniPopularizeUserConversationChat.Status status, String content) {
|
|
|
- String url;
|
|
|
- try {
|
|
|
- url = ImageUploadUtil.upload(img, "mgpt");
|
|
|
- } catch (IOException e) {
|
|
|
- url = img;
|
|
|
+ String url = null;
|
|
|
+ if (StrUtil.isNotBlank(img)) {
|
|
|
+ try {
|
|
|
+ url = ImageUploadUtil.upload(img, "mgpt");
|
|
|
+ } catch (IOException e) {
|
|
|
+ url = img;
|
|
|
+ }
|
|
|
}
|
|
|
MiniPopularizeUserConversationChat build = MiniPopularizeUserConversationChat.builder()
|
|
|
.conversationId(conversationId)
|