diff --git a/src/views/chat/components/Message/index.vue b/src/views/chat/components/Message/index.vue index 3ddc77a..2f69962 100644 --- a/src/views/chat/components/Message/index.vue +++ b/src/views/chat/components/Message/index.vue @@ -161,7 +161,7 @@ const watchTTS = watch(() => props.tts, async (n: any, o: any) => { } tts = props.tts ? JSON.parse(props.tts) : [] loadTTS() -}, { immediate: true, deep: true }) +}, { deep: true }) // 停止播放音频 const stopPlay = () => { console.log('停止播放音频') @@ -302,11 +302,16 @@ const noPauseAudio = () => { pauseIndex = -1 } +const reload = () => { + +} + defineExpose({ stopPlay, pauseAudio, noPauseAudio, radioPlay, + reload, }) diff --git a/src/views/chat/index.vue b/src/views/chat/index.vue index 2e90644..71b45dc 100644 --- a/src/views/chat/index.vue +++ b/src/views/chat/index.vue @@ -47,6 +47,9 @@ const connection = new Push({ // 是否正在录音 const recordFalg = ref(0) +// 刷新聊天的key +const f_key = ref('') + /** * APP端命令目录 * start 开始录音 @@ -68,10 +71,17 @@ const runOrder = (e) => { case 'play':playOrder(); break case 'stop':stopOrder(); break case 're-play':rePlayOrder(); break + case 'reload':reloadOrder(); break default: console.log('无效指令') } } +const reloadOrder = () => { + // f_key.value = `${Math.random().toFixed(0)}${Date.now()}` + // console.log(f_key.value) + window.location.reload() +} + const startOrder = () => { if (recordFalg.value == 0) { RecordXunfei() @@ -321,7 +331,7 @@ async function onConversation() { options = { ...lastContext } let infoList = JSON.parse(JSON.stringify(dataSources.value)) - infoList = infoList.slice(-20) + infoList = infoList.slice(-10) infoList = infoList.map((item: any, index: any) => { return { role: index % 2 == 0 ? 'user' : 'assistant', @@ -829,7 +839,7 @@ window.addEventListener('test', (e) => {