Merge pull request #3061 from xinnan-tech/memory-model-rename

选择仅上报聊天记录时,清除历史记忆;前端优化记忆模型切换体验
This commit is contained in:
wengzh
2026-04-01 15:57:44 +08:00
committed by GitHub
3 changed files with 20 additions and 1 deletions
@@ -406,8 +406,9 @@ public class AgentServiceImpl extends BaseServiceImpl<AgentDao, AgentEntity> imp
existingEntity.setUpdatedAt(new Date());
// 更新记忆策略
if (existingEntity.getMemModelId() == null || existingEntity.getMemModelId().equals(Constant.MEMORY_NO_MEM)) {
// 删除所有记录
if (existingEntity.getMemModelId() == null || existingEntity.getMemModelId().equals(Constant.MEMORY_NO_MEM)
|| existingEntity.getMemModelId().equals(Constant.MEMORY_MEM_REPORT_ONLY)) {
agentChatHistoryService.deleteByAgentId(existingEntity.getId(), true, true);
existingEntity.setSummaryMemory("");
} else if (existingEntity.getChatHistoryConf() != null && existingEntity.getChatHistoryConf() == 1) {
@@ -109,6 +109,7 @@ const inputValue = ref('')
const inputVisible = ref(false)
const languageOptions = ref([])
const isVisibleReport = ref(false)
const tempSummaryMemory = ref('')
// 音频播放相关
const audioRef = ref<UniApp.InnerAudioContext | null>(null)
@@ -185,6 +186,7 @@ async function loadAgentDetail() {
try {
loading.value = true
tempSummaryMemory.value = ''
const detail = await getAgentDetail(agentId.value)
formData.value = { ...detail }
@@ -485,6 +487,13 @@ async function onPickerConfirm(type: string, value: any, name: string) {
displayNames.value.memory = name // 确保显示名称正确更新
displayNames.value.report = reportOptions[1].name
isVisibleReport.value = value !== 'Memory_nomem'
if (value === 'Memory_nomem' || value === 'Memory_mem_report_only') {
tempSummaryMemory.value = formData.value.summaryMemory
formData.value.summaryMemory = ''
} else if (tempSummaryMemory.value !== '' && formData.value.summaryMemory === '') {
formData.value.summaryMemory = tempSummaryMemory.value
tempSummaryMemory.value = ''
}
break
case 'tts':
formData.value.ttsModelId = value
@@ -385,6 +385,7 @@ export default {
speed: 0,
pitch: 0
},
tempSummaryMemory: "",
form: {
agentCode: "",
agentName: "",
@@ -596,6 +597,7 @@ export default {
fetchAgentConfig(agentId) {
Api.agent.getDeviceConfig(agentId, ({ data }) => {
if (data.code === 0) {
this.tempSummaryMemory = "";
this.form = {
...this.form,
...data.data,
@@ -818,6 +820,13 @@ export default {
// 有记忆功能的模型,默认记录文本和语音
this.form.chatHistoryConf = 2;
}
if (value === "Memory_nomem" || value === "Memory_mem_report_only") {
this.tempSummaryMemory = this.form.summaryMemory;
this.form.summaryMemory = "";
} else if (this.tempSummaryMemory !== "" && this.form.summaryMemory === "") {
this.form.summaryMemory = this.tempSummaryMemory;
this.tempSummaryMemory = "";
}
}
if (type === "LLM") {
// 当LLM类型改变时,更新意图识别选项的可见性