mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-10-31 18:28:43 +08:00 
			
		
		
		
	conversation 充满 title 和 count
This commit is contained in:
		| @@ -30,13 +30,12 @@ public class AiChatConversationDO extends BaseDO { | |||||||
|     @Schema(description = "chat角色名称") |     @Schema(description = "chat角色名称") | ||||||
|     private String chatRoleName; |     private String chatRoleName; | ||||||
|  |  | ||||||
|     @Schema(description = "聊天标题(有程序自动生成)") |     @Schema(description = "标题(有程序自动生成)") | ||||||
|     private String chatTitle; |     private String title; | ||||||
|  |  | ||||||
|  |     @Schema(description = "对话类型(roleChat、userChat)") | ||||||
|  |     private String type; | ||||||
|  |  | ||||||
|     @Schema(description = "聊天次数(有程序自动生成)") |     @Schema(description = "聊天次数(有程序自动生成)") | ||||||
|     private Integer chatCount; |     private Integer chatCount; | ||||||
|  |  | ||||||
|     @Schema(description = "对话类型(roleChat、userChat)") |  | ||||||
|     private String chatType; |  | ||||||
|  |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -1,10 +1,10 @@ | |||||||
| package cn.iocoder.yudao.module.ai.dataobject; | 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.Data; | ||||||
| import lombok.experimental.Accessors; | import lombok.experimental.Accessors; | ||||||
|  |  | ||||||
| import java.util.Date; |  | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * ai 聊天 message |  * ai 聊天 message | ||||||
|  * |  * | ||||||
| @@ -13,7 +13,8 @@ import java.util.Date; | |||||||
|  */ |  */ | ||||||
| @Data | @Data | ||||||
| @Accessors(chain = true) | @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; |     private Double temperature; | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 创建该记录的操作员ID |  | ||||||
|      */ |  | ||||||
|     private Long createdBy; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 记录创建的时间戳 |  | ||||||
|      */ |  | ||||||
|     private Date createdTime; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 最后更新该记录的操作员ID |  | ||||||
|      */ |  | ||||||
|     private Long updatedBy; |  | ||||||
|  |  | ||||||
|     /** |  | ||||||
|      * 记录最后更新的时间戳 |  | ||||||
|      */ |  | ||||||
|     private Date updatedTime; |  | ||||||
| } | } | ||||||
|   | |||||||
| @@ -53,7 +53,7 @@ public interface AiChatConversationMapper extends BaseMapperX<AiChatConversation | |||||||
|         LambdaQueryWrapper<AiChatConversationDO> queryWrapper |         LambdaQueryWrapper<AiChatConversationDO> queryWrapper | ||||||
|                 = new LambdaQueryWrapper<AiChatConversationDO>().eq(AiChatConversationDO::getUserId, loginUserId); |                 = new LambdaQueryWrapper<AiChatConversationDO>().eq(AiChatConversationDO::getUserId, loginUserId); | ||||||
|         if (!StrUtil.isBlank(search)) { |         if (!StrUtil.isBlank(search)) { | ||||||
|             queryWrapper.like(AiChatConversationDO::getChatTitle, search); |             queryWrapper.like(AiChatConversationDO::getTitle, search); | ||||||
|         } |         } | ||||||
|         queryWrapper.orderByDesc(AiChatConversationDO::getId); |         queryWrapper.orderByDesc(AiChatConversationDO::getId); | ||||||
|         return selectPage(new PageParam().setPageNo(1).setPageSize(100), queryWrapper).getList(); |         return selectPage(new PageParam().setPageNo(1).setPageSize(100), queryWrapper).getList(); | ||||||
|   | |||||||
| @@ -45,9 +45,9 @@ public class ChatConversationServiceImpl implements ChatConversationService { | |||||||
|         insertConversation.setUserId(loginUserId); |         insertConversation.setUserId(loginUserId); | ||||||
|         insertConversation.setChatRoleId(null); |         insertConversation.setChatRoleId(null); | ||||||
|         insertConversation.setChatRoleName(null); |         insertConversation.setChatRoleName(null); | ||||||
|         insertConversation.setChatTitle(null); |         insertConversation.setTitle(null); | ||||||
|         insertConversation.setChatCount(0); |         insertConversation.setChatCount(0); | ||||||
|         insertConversation.setChatType(req.getChatType()); |         insertConversation.setType(req.getChatType()); | ||||||
|         aiChatConversationMapper.insert(insertConversation); |         aiChatConversationMapper.insert(insertConversation); | ||||||
|         // 转换 res |         // 转换 res | ||||||
|         return ChatConversationConvert.INSTANCE.covnertChatConversationRes(latestConversation); |         return ChatConversationConvert.INSTANCE.covnertChatConversationRes(latestConversation); | ||||||
|   | |||||||
| @@ -141,9 +141,9 @@ public class ChatServiceImpl implements ChatService { | |||||||
|                 .setUserId(loginUserId) |                 .setUserId(loginUserId) | ||||||
|                 .setChatRoleId(req.getChatRoleId()) |                 .setChatRoleId(req.getChatRoleId()) | ||||||
|                 .setChatRoleName(chatRoleName) |                 .setChatRoleName(chatRoleName) | ||||||
|                 .setChatType(chatTypeEnum.getType()) |                 .setType(chatTypeEnum.getType()) | ||||||
|                 .setChatCount(1) |                 .setChatCount(1) | ||||||
|                 .setChatTitle(req.getPrompt().substring(0, 20) + "..."); |                 .setTitle(req.getPrompt().substring(0, 20) + "..."); | ||||||
|         aiChatConversationMapper.insert(insertChatConversation); |         aiChatConversationMapper.insert(insertChatConversation); | ||||||
|         return insertChatConversation; |         return insertChatConversation; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -27,12 +27,12 @@ public class ChatConversationRes { | |||||||
|     @Schema(description = "chat角色名称") |     @Schema(description = "chat角色名称") | ||||||
|     private String chatRoleName; |     private String chatRoleName; | ||||||
|  |  | ||||||
|     @Schema(description = "聊天标题(有程序自动生成)") |     @Schema(description = "标题(有程序自动生成)") | ||||||
|     private String chatTitle; |     private String title; | ||||||
|  |  | ||||||
|  |     @Schema(description = "对话类型(roleChat、userChat)") | ||||||
|  |     private String type; | ||||||
|  |  | ||||||
|     @Schema(description = "聊天次数(有程序自动生成)") |     @Schema(description = "聊天次数(有程序自动生成)") | ||||||
|     private Integer chatCount; |     private Integer chatCount; | ||||||
|  |  | ||||||
|     @Schema(description = "对话类型(roleChat、userChat)") |  | ||||||
|     private String chatType; |  | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 cherishsince
					cherishsince