mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2025-02-17 09:40:34 +08:00
增加对话类型,new还是继续
This commit is contained in:
parent
bff0ad65dc
commit
be0c81458d
@ -0,0 +1,36 @@
|
||||
package cn.iocoder.yudao.module.ai.enums;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
/**
|
||||
* 对话类型
|
||||
* 创建对话、继续对话
|
||||
*
|
||||
* @author fansili
|
||||
* @time 2024/4/14 18:15
|
||||
* @since 1.0
|
||||
*/
|
||||
@AllArgsConstructor
|
||||
@Getter
|
||||
public enum ChatConversationTypeEnum {
|
||||
|
||||
NEW("new", "新建对话"),
|
||||
CONTINUE("continue", "继续对话"),
|
||||
|
||||
;
|
||||
|
||||
private String type;
|
||||
|
||||
private String name;
|
||||
|
||||
public static ChatConversationTypeEnum valueOfType(String type) {
|
||||
for (ChatConversationTypeEnum itemEnum : ChatConversationTypeEnum.values()) {
|
||||
if (itemEnum.getType().equals(type)) {
|
||||
return itemEnum;
|
||||
}
|
||||
}
|
||||
throw new IllegalArgumentException("Invalid MessageType value: " + type);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package cn.iocoder.yudao.module.ai.dataobject;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* chat 交谈
|
||||
*
|
||||
* @author fansili
|
||||
* @time 2024/4/14 17:35
|
||||
* @since 1.0
|
||||
*/
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
@TableName("ai_chat_conversation")
|
||||
public class AiChatConversationDO extends BaseDO {
|
||||
|
||||
@Schema(description = "id")
|
||||
private Long id;
|
||||
|
||||
@Schema(description = "用户id")
|
||||
private Long userId;
|
||||
|
||||
@Schema(description = "chat角色Id")
|
||||
private Long chatRoleId;
|
||||
|
||||
@Schema(description = "chat角色名称")
|
||||
private String chatRoleName;
|
||||
|
||||
@Schema(description = "对话标题(有程序自动生成)")
|
||||
private String chatTitle;
|
||||
|
||||
@Schema(description = "对话标题(有程序自动生成)")
|
||||
private Integer chatCount;
|
||||
|
||||
@Schema(description = "对话类型(roleChat、userChat)")
|
||||
private String chatType;
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package cn.iocoder.yudao.module.ai.mapper;
|
||||
|
||||
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.iocoder.yudao.module.ai.dataobject.AiChatConversationDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* message mapper
|
||||
*
|
||||
* @fansili
|
||||
* @since v1.0
|
||||
*/
|
||||
@Repository
|
||||
@Mapper
|
||||
public interface AiChatConversationMapper extends BaseMapperX<AiChatConversationDO> {
|
||||
|
||||
|
||||
@Update("update ai_chat_conversation set chat_count = chat_count + 1 where id = #{id}")
|
||||
void updateIncrChatCount(@Param("id") Long id);
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user