From afe1c7a6e21f3f25abedd38a1699cd5ce4db0bce Mon Sep 17 00:00:00 2001 From: shengchanzhe <179998674@qq.com> Date: Mon, 16 Oct 2023 09:16:02 +0800 Subject: [PATCH] gengx --- src/views/chat/components/Message/index.vue | 7 ++++++- src/views/chat/index.vue | 14 ++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) 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) => {