mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-27 01:23:55 +08:00
fix: 前端优化记忆模型切换体验 - 切换无记忆模型时暂存记忆、切换恢复、保存配置后才真正清除
This commit is contained in:
@@ -109,6 +109,7 @@ const inputValue = ref('')
|
|||||||
const inputVisible = ref(false)
|
const inputVisible = ref(false)
|
||||||
const languageOptions = ref([])
|
const languageOptions = ref([])
|
||||||
const isVisibleReport = ref(false)
|
const isVisibleReport = ref(false)
|
||||||
|
const tempSummaryMemory = ref('')
|
||||||
|
|
||||||
// 音频播放相关
|
// 音频播放相关
|
||||||
const audioRef = ref<UniApp.InnerAudioContext | null>(null)
|
const audioRef = ref<UniApp.InnerAudioContext | null>(null)
|
||||||
@@ -185,6 +186,7 @@ async function loadAgentDetail() {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
loading.value = true
|
loading.value = true
|
||||||
|
tempSummaryMemory.value = ''
|
||||||
const detail = await getAgentDetail(agentId.value)
|
const detail = await getAgentDetail(agentId.value)
|
||||||
formData.value = { ...detail }
|
formData.value = { ...detail }
|
||||||
|
|
||||||
@@ -485,6 +487,13 @@ async function onPickerConfirm(type: string, value: any, name: string) {
|
|||||||
displayNames.value.memory = name // 确保显示名称正确更新
|
displayNames.value.memory = name // 确保显示名称正确更新
|
||||||
displayNames.value.report = reportOptions[1].name
|
displayNames.value.report = reportOptions[1].name
|
||||||
isVisibleReport.value = value !== 'Memory_nomem'
|
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
|
break
|
||||||
case 'tts':
|
case 'tts':
|
||||||
formData.value.ttsModelId = value
|
formData.value.ttsModelId = value
|
||||||
|
|||||||
@@ -385,6 +385,7 @@ export default {
|
|||||||
speed: 0,
|
speed: 0,
|
||||||
pitch: 0
|
pitch: 0
|
||||||
},
|
},
|
||||||
|
tempSummaryMemory: "",
|
||||||
form: {
|
form: {
|
||||||
agentCode: "",
|
agentCode: "",
|
||||||
agentName: "",
|
agentName: "",
|
||||||
@@ -596,6 +597,7 @@ export default {
|
|||||||
fetchAgentConfig(agentId) {
|
fetchAgentConfig(agentId) {
|
||||||
Api.agent.getDeviceConfig(agentId, ({ data }) => {
|
Api.agent.getDeviceConfig(agentId, ({ data }) => {
|
||||||
if (data.code === 0) {
|
if (data.code === 0) {
|
||||||
|
this.tempSummaryMemory = "";
|
||||||
this.form = {
|
this.form = {
|
||||||
...this.form,
|
...this.form,
|
||||||
...data.data,
|
...data.data,
|
||||||
@@ -818,6 +820,13 @@ export default {
|
|||||||
// 有记忆功能的模型,默认记录文本和语音
|
// 有记忆功能的模型,默认记录文本和语音
|
||||||
this.form.chatHistoryConf = 2;
|
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") {
|
if (type === "LLM") {
|
||||||
// 当LLM类型改变时,更新意图识别选项的可见性
|
// 当LLM类型改变时,更新意图识别选项的可见性
|
||||||
|
|||||||
Reference in New Issue
Block a user