mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 17:43:55 +08:00
update:修改记录类型为0、1、2
This commit is contained in:
@@ -180,9 +180,7 @@ public interface Constant {
|
|||||||
enum ChatHistoryConfEnum {
|
enum ChatHistoryConfEnum {
|
||||||
IGNORE(0, "不记录"),
|
IGNORE(0, "不记录"),
|
||||||
RECORD_TEXT(1, "记录文本"),
|
RECORD_TEXT(1, "记录文本"),
|
||||||
RECORD_AUDIO(2, "记录音频"),
|
RECORD_TEXT_AUDIO(2, "文本音频都记录");
|
||||||
RECORD_TEXT_AUDIO(3, "文本音频都记录")
|
|
||||||
;
|
|
||||||
|
|
||||||
private final int code;
|
private final int code;
|
||||||
private final String name;
|
private final String name;
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class AgentUpdateDTO implements Serializable {
|
|||||||
@Schema(description = "角色设定参数", example = "你是一个专业的客服助手,负责回答用户问题并提供帮助", required = false)
|
@Schema(description = "角色设定参数", example = "你是一个专业的客服助手,负责回答用户问题并提供帮助", required = false)
|
||||||
private String systemPrompt;
|
private String systemPrompt;
|
||||||
|
|
||||||
@Schema(description = "聊天记录配置(0不记录 1仅记录文本 2仅记录语音 3记录文本和语音)", example = "3", required = false)
|
@Schema(description = "聊天记录配置(0不记录 1仅记录文本 2记录文本和语音)", example = "3", required = false)
|
||||||
private Integer chatHistoryConf;
|
private Integer chatHistoryConf;
|
||||||
|
|
||||||
@Schema(description = "语言编码", example = "zh_CN", required = false)
|
@Schema(description = "语言编码", example = "zh_CN", required = false)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ public class AgentEntity {
|
|||||||
@Schema(description = "意图模型标识")
|
@Schema(description = "意图模型标识")
|
||||||
private String intentModelId;
|
private String intentModelId;
|
||||||
|
|
||||||
@Schema(description = "聊天记录配置(0不记录 1仅记录文本 2仅记录语音 3记录文本和语音)")
|
@Schema(description = "聊天记录配置(0不记录 1仅记录文本 2记录文本和语音)")
|
||||||
private Integer chatHistoryConf;
|
private Integer chatHistoryConf;
|
||||||
|
|
||||||
@Schema(description = "角色设定参数")
|
@Schema(description = "角色设定参数")
|
||||||
|
|||||||
+1
-1
@@ -70,7 +70,7 @@ public class AgentTemplateEntity implements Serializable {
|
|||||||
private String intentModelId;
|
private String intentModelId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 聊天记录配置(0不记录 1仅记录文本 2仅记录语音 3记录文本和语音)
|
* 聊天记录配置(0不记录 1仅记录文本 2记录文本和语音)
|
||||||
*/
|
*/
|
||||||
private Integer chatHistoryConf;
|
private Integer chatHistoryConf;
|
||||||
|
|
||||||
|
|||||||
-3
@@ -60,8 +60,6 @@ public class AgentChatHistoryBizServiceImpl implements AgentChatHistoryBizServic
|
|||||||
|
|
||||||
if (Objects.equals(chatHistoryConf, Constant.ChatHistoryConfEnum.RECORD_TEXT.getCode())) {
|
if (Objects.equals(chatHistoryConf, Constant.ChatHistoryConfEnum.RECORD_TEXT.getCode())) {
|
||||||
saveChatText(report, agentId, macAddress, null);
|
saveChatText(report, agentId, macAddress, null);
|
||||||
} else if (Objects.equals(chatHistoryConf, Constant.ChatHistoryConfEnum.RECORD_AUDIO.getCode())) {
|
|
||||||
saveChatAudio(report);
|
|
||||||
} else if (Objects.equals(chatHistoryConf, Constant.ChatHistoryConfEnum.RECORD_TEXT_AUDIO.getCode())) {
|
} else if (Objects.equals(chatHistoryConf, Constant.ChatHistoryConfEnum.RECORD_TEXT_AUDIO.getCode())) {
|
||||||
String audioId = saveChatAudio(report);
|
String audioId = saveChatAudio(report);
|
||||||
saveChatText(report, agentId, macAddress, audioId);
|
saveChatText(report, agentId, macAddress, audioId);
|
||||||
@@ -69,7 +67,6 @@ public class AgentChatHistoryBizServiceImpl implements AgentChatHistoryBizServic
|
|||||||
|
|
||||||
// 更新设备最后对话时间
|
// 更新设备最后对话时间
|
||||||
redisUtils.set(RedisKeys.getAgentDeviceLastConnectedAtById(agentId), new Date());
|
redisUtils.set(RedisKeys.getAgentDeviceLastConnectedAtById(agentId), new Date());
|
||||||
|
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
-- 添加聊天记录配置字段
|
||||||
|
ALTER TABLE `ai_agent`
|
||||||
|
ADD COLUMN `chat_history_conf` tinyint NOT NULL DEFAULT 2 COMMENT '聊天记录配置(0不记录 1仅记录文本 2记录文本和语音)' AFTER `system_prompt`;
|
||||||
Reference in New Issue
Block a user