mirror of
				https://gitee.com/hhyykk/ipms-sjy.git
				synced 2025-11-04 12:18:42 +08:00 
			
		
		
		
	conversation 充满 title 和 count
This commit is contained in:
		@@ -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;
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -53,7 +53,7 @@ public interface AiChatConversationMapper extends BaseMapperX<AiChatConversation
 | 
			
		||||
        LambdaQueryWrapper<AiChatConversationDO> queryWrapper
 | 
			
		||||
                = new LambdaQueryWrapper<AiChatConversationDO>().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();
 | 
			
		||||
 
 | 
			
		||||
@@ -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);
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -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;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user