|
|
@@ -132,10 +132,11 @@ public class MidjourneyServiceImpl implements MidjourneyService {
|
|
|
public MidjourneyUserConversation saveConversation(Long userId,Integer mode,SubmitResult result, String action,String prompt, String botType) throws Exception {
|
|
|
Long taskId = Long.parseLong(result.getResult());
|
|
|
Map<String, Object> properties = result.getProperties();
|
|
|
- MidjourneyUserConversation conversation;
|
|
|
+ MidjourneyUserConversation conversation = null;
|
|
|
if (action.equals("MODAL")){
|
|
|
conversation = conversationMapper.selectOne(Wrappers.lambdaQuery(MidjourneyUserConversation.class).eq(MidjourneyUserConversation::getTaskId, taskId).last("limit 1"));
|
|
|
- }else {
|
|
|
+ }
|
|
|
+ if (conversation == null){
|
|
|
conversation = new MidjourneyUserConversation();
|
|
|
conversation.setUserId(userId);
|
|
|
conversation.setTaskId(taskId);
|
|
|
@@ -322,8 +323,18 @@ public class MidjourneyServiceImpl implements MidjourneyService {
|
|
|
conversation.setButtons(Jsons.toJson(messageButtons));
|
|
|
}
|
|
|
if (customId.contains("BOOKMARK")) {
|
|
|
- conversation.setBookmark(true);
|
|
|
- conversationMapper.updateById(conversation);
|
|
|
+ TASK_EXECUTOR.execute(() -> {
|
|
|
+ try {
|
|
|
+ conversation.setBookmark(true);
|
|
|
+ String imageUrl = conversation.getImageUrl();
|
|
|
+ if (StringUtil.isNotBlank(imageUrl)) {
|
|
|
+ conversation.setImageUrl(uploadPic(imageUrl, "conversation"+conversation.getId()));
|
|
|
+ conversationMapper.updateById(conversation);
|
|
|
+ }
|
|
|
+ } catch (IOException e) {
|
|
|
+ log.error("上传图片失败",e);
|
|
|
+ }
|
|
|
+ });
|
|
|
return null;
|
|
|
}
|
|
|
Map<String, Object> param = MapUtil.builder(new HashMap<String,Object>())
|
|
|
@@ -648,11 +659,12 @@ public class MidjourneyServiceImpl implements MidjourneyService {
|
|
|
if (!Objects.equals(conversation.getUserId(), user.getId())) {
|
|
|
throw BusinessRuntimeException.getInstance("不是您的会话");
|
|
|
}
|
|
|
- conversation.setStatus("CANCEL");
|
|
|
- conversationMapper.updateById(conversation);
|
|
|
- TASK_EXECUTOR.execute(() -> {
|
|
|
+ conversationMapper.deleteById(id);
|
|
|
+ //conversation.setStatus("CANCEL");
|
|
|
+ //conversationMapper.updateById(conversation);
|
|
|
+ //TASK_EXECUTOR.execute(() -> {
|
|
|
//cancel(user.getMode(),conversation.getTaskId());
|
|
|
- });
|
|
|
+ //});
|
|
|
return conversation;
|
|
|
}
|
|
|
|