This commit is contained in:
shengchanzhe 2023-10-16 09:16:02 +08:00
parent 9aec1b9871
commit afe1c7a6e2
2 changed files with 18 additions and 3 deletions

View File

@ -161,7 +161,7 @@ const watchTTS = watch(() => props.tts, async (n: any, o: any) => {
} }
tts = props.tts ? JSON.parse(props.tts) : [] tts = props.tts ? JSON.parse(props.tts) : []
loadTTS() loadTTS()
}, { immediate: true, deep: true }) }, { deep: true })
// //
const stopPlay = () => { const stopPlay = () => {
console.log('停止播放音频') console.log('停止播放音频')
@ -302,11 +302,16 @@ const noPauseAudio = () => {
pauseIndex = -1 pauseIndex = -1
} }
const reload = () => {
}
defineExpose({ defineExpose({
stopPlay, stopPlay,
pauseAudio, pauseAudio,
noPauseAudio, noPauseAudio,
radioPlay, radioPlay,
reload,
}) })
</script> </script>

View File

@ -47,6 +47,9 @@ const connection = new Push({
// //
const recordFalg = ref(0) const recordFalg = ref(0)
// key
const f_key = ref('')
/** /**
* APP端命令目录 * APP端命令目录
* start 开始录音 * start 开始录音
@ -68,10 +71,17 @@ const runOrder = (e) => {
case 'play':playOrder(); break case 'play':playOrder(); break
case 'stop':stopOrder(); break case 'stop':stopOrder(); break
case 're-play':rePlayOrder(); break case 're-play':rePlayOrder(); break
case 'reload':reloadOrder(); break
default: console.log('无效指令') default: console.log('无效指令')
} }
} }
const reloadOrder = () => {
// f_key.value = `${Math.random().toFixed(0)}${Date.now()}`
// console.log(f_key.value)
window.location.reload()
}
const startOrder = () => { const startOrder = () => {
if (recordFalg.value == 0) { if (recordFalg.value == 0) {
RecordXunfei() RecordXunfei()
@ -321,7 +331,7 @@ async function onConversation() {
options = { ...lastContext } options = { ...lastContext }
let infoList = JSON.parse(JSON.stringify(dataSources.value)) let infoList = JSON.parse(JSON.stringify(dataSources.value))
infoList = infoList.slice(-20) infoList = infoList.slice(-10)
infoList = infoList.map((item: any, index: any) => { infoList = infoList.map((item: any, index: any) => {
return { return {
role: index % 2 == 0 ? 'user' : 'assistant', role: index % 2 == 0 ? 'user' : 'assistant',
@ -829,7 +839,7 @@ window.addEventListener('test', (e) => {
<Message <Message
v-for="(item, index) of dataSources" v-for="(item, index) of dataSources"
ref="messageRef" ref="messageRef"
:key="index" :key="index + f_key"
:date-time="item.dateTime" :date-time="item.dateTime"
:text="item.text" :text="item.text"
:tts="item.tts" :tts="item.tts"