Commit 97c12d193203c380f36f4839004d1b9e435f4cdb

Authored by cherishsince
1 parent b68117c8

conversation 充满 title 和 count

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 {
30 30 @Schema(description = "chat角色名称")
31 31 private String chatRoleName;
32 32  
33   - @Schema(description = "聊天标题(有程序自动生成)")
34   - private String chatTitle;
35   -
36   - @Schema(description = "聊天次数(有程序自动生成)")
37   - private Integer chatCount;
  33 + @Schema(description = "标题(有程序自动生成)")
  34 + private String title;
38 35  
39 36 @Schema(description = "对话类型(roleChat、userChat)")
40   - private String chatType;
  37 + private String type;
41 38  
  39 + @Schema(description = "聊天次数(有程序自动生成)")
  40 + private Integer chatCount;
42 41 }
... ...
yudao-module-ai/yudao-module-ai-biz/src/main/java/cn/iocoder/yudao/module/ai/dataobject/AiChatMessageDO.java
1 1 package cn.iocoder.yudao.module.ai.dataobject;
2 2  
  3 +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
  4 +import com.baomidou.mybatisplus.annotation.TableName;
3 5 import lombok.Data;
4 6 import lombok.experimental.Accessors;
5 7  
6   -import java.util.Date;
7   -
8 8 /**
9 9 * ai 聊天 message
10 10 *
... ... @@ -13,7 +13,8 @@ import java.util.Date;
13 13 */
14 14 @Data
15 15 @Accessors(chain = true)
16   -public class AiChatMessageDO {
  16 +@TableName("ai_chat_message")
  17 +public class AiChatMessageDO extends BaseDO {
17 18  
18 19 /**
19 20 * 编号,作为每条聊天记录的唯一标识符
... ... @@ -58,23 +59,4 @@ public class AiChatMessageDO {
58 59 */
59 60 private Double temperature;
60 61  
61   - /**
62   - * 创建该记录的操作员ID
63   - */
64   - private Long createdBy;
65   -
66   - /**
67   - * 记录创建的时间戳
68   - */
69   - private Date createdTime;
70   -
71   - /**
72   - * 最后更新该记录的操作员ID
73   - */
74   - private Long updatedBy;
75   -
76   - /**
77   - * 记录最后更新的时间戳
78   - */
79   - private Date updatedTime;
80 62 }
... ...
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<AiChatConversation
53 53 LambdaQueryWrapper<AiChatConversationDO> queryWrapper
54 54 = new LambdaQueryWrapper<AiChatConversationDO>().eq(AiChatConversationDO::getUserId, loginUserId);
55 55 if (!StrUtil.isBlank(search)) {
56   - queryWrapper.like(AiChatConversationDO::getChatTitle, search);
  56 + queryWrapper.like(AiChatConversationDO::getTitle, search);
57 57 }
58 58 queryWrapper.orderByDesc(AiChatConversationDO::getId);
59 59 return selectPage(new PageParam().setPageNo(1).setPageSize(100), queryWrapper).getList();
... ...
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 {
45 45 insertConversation.setUserId(loginUserId);
46 46 insertConversation.setChatRoleId(null);
47 47 insertConversation.setChatRoleName(null);
48   - insertConversation.setChatTitle(null);
  48 + insertConversation.setTitle(null);
49 49 insertConversation.setChatCount(0);
50   - insertConversation.setChatType(req.getChatType());
  50 + insertConversation.setType(req.getChatType());
51 51 aiChatConversationMapper.insert(insertConversation);
52 52 // 转换 res
53 53 return ChatConversationConvert.INSTANCE.covnertChatConversationRes(latestConversation);
... ...
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 {
141 141 .setUserId(loginUserId)
142 142 .setChatRoleId(req.getChatRoleId())
143 143 .setChatRoleName(chatRoleName)
144   - .setChatType(chatTypeEnum.getType())
  144 + .setType(chatTypeEnum.getType())
145 145 .setChatCount(1)
146   - .setChatTitle(req.getPrompt().substring(0, 20) + "...");
  146 + .setTitle(req.getPrompt().substring(0, 20) + "...");
147 147 aiChatConversationMapper.insert(insertChatConversation);
148 148 return insertChatConversation;
149 149 }
... ...
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 {
27 27 @Schema(description = "chat角色名称")
28 28 private String chatRoleName;
29 29  
30   - @Schema(description = "聊天标题(有程序自动生成)")
31   - private String chatTitle;
  30 + @Schema(description = "标题(有程序自动生成)")
  31 + private String title;
  32 +
  33 + @Schema(description = "对话类型(roleChat、userChat)")
  34 + private String type;
32 35  
33 36 @Schema(description = "聊天次数(有程序自动生成)")
34 37 private Integer chatCount;
35   -
36   - @Schema(description = "对话类型(roleChat、userChat)")
37   - private String chatType;
38 38 }
... ...