From 97c12d193203c380f36f4839004d1b9e435f4cdb Mon Sep 17 00:00:00 2001 From: cherishsince Date: Thu, 18 Apr 2024 17:31:58 +0800 Subject: [PATCH] =?UTF-8?q?conversation=20=E5=85=85=E6=BB=A1=20title=20?= =?UTF-8?q?=E5=92=8C=20count?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ai/dataobject/AiChatConversationDO.java | 11 ++++---- .../module/ai/dataobject/AiChatMessageDO.java | 26 +++---------------- .../ai/mapper/AiChatConversationMapper.java | 2 +- .../impl/ChatConversationServiceImpl.java | 4 +-- .../ai/service/impl/ChatServiceImpl.java | 4 +-- .../module/ai/vo/ChatConversationRes.java | 10 +++---- 6 files changed, 19 insertions(+), 38 deletions(-) diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dataobject/AiChatConversationDO.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dataobject/AiChatConversationDO.java index c48baa1c6..79bb281e7 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dataobject/AiChatConversationDO.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dataobject/AiChatConversationDO.java @@ -30,13 +30,12 @@ public class AiChatConversationDO extends BaseDO { @Schema(description = "chat角色名称") private String chatRoleName; - @Schema(description = "聊天标题(有程序自动生成)") - private String chatTitle; + @Schema(description = "标题(有程序自动生成)") + private String title; + + @Schema(description = "对话类型(roleChat、userChat)") + private String type; @Schema(description = "聊天次数(有程序自动生成)") private Integer chatCount; - - @Schema(description = "对话类型(roleChat、userChat)") - private String chatType; - } diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dataobject/AiChatMessageDO.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dataobject/AiChatMessageDO.java index 9047180ec..53d274ae1 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dataobject/AiChatMessageDO.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dataobject/AiChatMessageDO.java @@ -1,10 +1,10 @@ package cn.iocoder.yudao.module.ai.dataobject; +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; +import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; import lombok.experimental.Accessors; -import java.util.Date; - /** * ai 聊天 message * @@ -13,7 +13,8 @@ import java.util.Date; */ @Data @Accessors(chain = true) -public class AiChatMessageDO { +@TableName("ai_chat_message") +public class AiChatMessageDO extends BaseDO { /** * 编号,作为每条聊天记录的唯一标识符 @@ -58,23 +59,4 @@ public class AiChatMessageDO { */ private Double temperature; - /** - * 创建该记录的操作员ID - */ - private Long createdBy; - - /** - * 记录创建的时间戳 - */ - private Date createdTime; - - /** - * 最后更新该记录的操作员ID - */ - private Long updatedBy; - - /** - * 记录最后更新的时间戳 - */ - private Date updatedTime; } diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/mapper/AiChatConversationMapper.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/mapper/AiChatConversationMapper.java index f6f58e7a0..bfc7bc0aa 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/mapper/AiChatConversationMapper.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/mapper/AiChatConversationMapper.java @@ -53,7 +53,7 @@ public interface AiChatConversationMapper extends BaseMapperX queryWrapper = new LambdaQueryWrapper().eq(AiChatConversationDO::getUserId, loginUserId); if (!StrUtil.isBlank(search)) { - queryWrapper.like(AiChatConversationDO::getChatTitle, search); + queryWrapper.like(AiChatConversationDO::getTitle, search); } queryWrapper.orderByDesc(AiChatConversationDO::getId); return selectPage(new PageParam().setPageNo(1).setPageSize(100), queryWrapper).getList(); diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/impl/ChatConversationServiceImpl.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/impl/ChatConversationServiceImpl.java index 0dd533959..52af7f7b5 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/impl/ChatConversationServiceImpl.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/impl/ChatConversationServiceImpl.java @@ -45,9 +45,9 @@ public class ChatConversationServiceImpl implements ChatConversationService { insertConversation.setUserId(loginUserId); insertConversation.setChatRoleId(null); insertConversation.setChatRoleName(null); - insertConversation.setChatTitle(null); + insertConversation.setTitle(null); insertConversation.setChatCount(0); - insertConversation.setChatType(req.getChatType()); + insertConversation.setType(req.getChatType()); aiChatConversationMapper.insert(insertConversation); // 转换 res return ChatConversationConvert.INSTANCE.covnertChatConversationRes(latestConversation); diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/impl/ChatServiceImpl.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/impl/ChatServiceImpl.java index 069de7092..bf3c9ff62 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/impl/ChatServiceImpl.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/service/impl/ChatServiceImpl.java @@ -141,9 +141,9 @@ public class ChatServiceImpl implements ChatService { .setUserId(loginUserId) .setChatRoleId(req.getChatRoleId()) .setChatRoleName(chatRoleName) - .setChatType(chatTypeEnum.getType()) + .setType(chatTypeEnum.getType()) .setChatCount(1) - .setChatTitle(req.getPrompt().substring(0, 20) + "..."); + .setTitle(req.getPrompt().substring(0, 20) + "..."); aiChatConversationMapper.insert(insertChatConversation); return insertChatConversation; } diff --git a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/vo/ChatConversationRes.java b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/vo/ChatConversationRes.java index 3a2bb16d5..aa11c0464 100644 --- a/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/vo/ChatConversationRes.java +++ b/yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/vo/ChatConversationRes.java @@ -27,12 +27,12 @@ public class ChatConversationRes { @Schema(description = "chat角色名称") private String chatRoleName; - @Schema(description = "聊天标题(有程序自动生成)") - private String chatTitle; + @Schema(description = "标题(有程序自动生成)") + private String title; + + @Schema(description = "对话类型(roleChat、userChat)") + private String type; @Schema(description = "聊天次数(有程序自动生成)") private Integer chatCount; - - @Schema(description = "对话类型(roleChat、userChat)") - private String chatType; }