Commit 97c12d193203c380f36f4839004d1b9e435f4cdb
1 parent
b68117c8
conversation 充满 title 和 count
Showing
6 changed files
with
19 additions
and
38 deletions
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,13 +30,12 @@ public class AiChatConversationDO extends BaseDO { | ||
| 30 | @Schema(description = "chat角色名称") | 30 | @Schema(description = "chat角色名称") |
| 31 | private String chatRoleName; | 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 | @Schema(description = "对话类型(roleChat、userChat)") | 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 | package cn.iocoder.yudao.module.ai.dataobject; | 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 | import lombok.Data; | 5 | import lombok.Data; |
| 4 | import lombok.experimental.Accessors; | 6 | import lombok.experimental.Accessors; |
| 5 | 7 | ||
| 6 | -import java.util.Date; | ||
| 7 | - | ||
| 8 | /** | 8 | /** |
| 9 | * ai 聊天 message | 9 | * ai 聊天 message |
| 10 | * | 10 | * |
| @@ -13,7 +13,8 @@ import java.util.Date; | @@ -13,7 +13,8 @@ import java.util.Date; | ||
| 13 | */ | 13 | */ |
| 14 | @Data | 14 | @Data |
| 15 | @Accessors(chain = true) | 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,23 +59,4 @@ public class AiChatMessageDO { | ||
| 58 | */ | 59 | */ |
| 59 | private Double temperature; | 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,7 +53,7 @@ public interface AiChatConversationMapper extends BaseMapperX<AiChatConversation | ||
| 53 | LambdaQueryWrapper<AiChatConversationDO> queryWrapper | 53 | LambdaQueryWrapper<AiChatConversationDO> queryWrapper |
| 54 | = new LambdaQueryWrapper<AiChatConversationDO>().eq(AiChatConversationDO::getUserId, loginUserId); | 54 | = new LambdaQueryWrapper<AiChatConversationDO>().eq(AiChatConversationDO::getUserId, loginUserId); |
| 55 | if (!StrUtil.isBlank(search)) { | 55 | if (!StrUtil.isBlank(search)) { |
| 56 | - queryWrapper.like(AiChatConversationDO::getChatTitle, search); | 56 | + queryWrapper.like(AiChatConversationDO::getTitle, search); |
| 57 | } | 57 | } |
| 58 | queryWrapper.orderByDesc(AiChatConversationDO::getId); | 58 | queryWrapper.orderByDesc(AiChatConversationDO::getId); |
| 59 | return selectPage(new PageParam().setPageNo(1).setPageSize(100), queryWrapper).getList(); | 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,9 +45,9 @@ public class ChatConversationServiceImpl implements ChatConversationService { | ||
| 45 | insertConversation.setUserId(loginUserId); | 45 | insertConversation.setUserId(loginUserId); |
| 46 | insertConversation.setChatRoleId(null); | 46 | insertConversation.setChatRoleId(null); |
| 47 | insertConversation.setChatRoleName(null); | 47 | insertConversation.setChatRoleName(null); |
| 48 | - insertConversation.setChatTitle(null); | 48 | + insertConversation.setTitle(null); |
| 49 | insertConversation.setChatCount(0); | 49 | insertConversation.setChatCount(0); |
| 50 | - insertConversation.setChatType(req.getChatType()); | 50 | + insertConversation.setType(req.getChatType()); |
| 51 | aiChatConversationMapper.insert(insertConversation); | 51 | aiChatConversationMapper.insert(insertConversation); |
| 52 | // 转换 res | 52 | // 转换 res |
| 53 | return ChatConversationConvert.INSTANCE.covnertChatConversationRes(latestConversation); | 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,9 +141,9 @@ public class ChatServiceImpl implements ChatService { | ||
| 141 | .setUserId(loginUserId) | 141 | .setUserId(loginUserId) |
| 142 | .setChatRoleId(req.getChatRoleId()) | 142 | .setChatRoleId(req.getChatRoleId()) |
| 143 | .setChatRoleName(chatRoleName) | 143 | .setChatRoleName(chatRoleName) |
| 144 | - .setChatType(chatTypeEnum.getType()) | 144 | + .setType(chatTypeEnum.getType()) |
| 145 | .setChatCount(1) | 145 | .setChatCount(1) |
| 146 | - .setChatTitle(req.getPrompt().substring(0, 20) + "..."); | 146 | + .setTitle(req.getPrompt().substring(0, 20) + "..."); |
| 147 | aiChatConversationMapper.insert(insertChatConversation); | 147 | aiChatConversationMapper.insert(insertChatConversation); |
| 148 | return insertChatConversation; | 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,12 +27,12 @@ public class ChatConversationRes { | ||
| 27 | @Schema(description = "chat角色名称") | 27 | @Schema(description = "chat角色名称") |
| 28 | private String chatRoleName; | 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 | @Schema(description = "聊天次数(有程序自动生成)") | 36 | @Schema(description = "聊天次数(有程序自动生成)") |
| 34 | private Integer chatCount; | 37 | private Integer chatCount; |
| 35 | - | ||
| 36 | - @Schema(description = "对话类型(roleChat、userChat)") | ||
| 37 | - private String chatType; | ||
| 38 | } | 38 | } |