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) : []
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,
})
</script>

View File

@ -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) => {
<Message
v-for="(item, index) of dataSources"
ref="messageRef"
:key="index"
:key="index + f_key"
:date-time="item.dateTime"
:text="item.text"
:tts="item.tts"