This commit is contained in:
weipengfei 2023-10-13 22:17:33 +08:00
parent bcb694fe69
commit 8ab770305c
2 changed files with 14 additions and 1 deletions

View File

@ -124,7 +124,7 @@ async function loadTTS(){
if (ttsList.length == 0) if (ttsList.length == 0)
playAudio() playAudio()
} }
ttsList = tts; ttsList = JSON.parse(JSON.stringify(tts));
} }
} }

View File

@ -197,6 +197,17 @@ async function onConversation() {
}) })
scrollToBottom() scrollToBottom()
let infoList = JSON.parse(JSON.stringify(dataSources.value));
infoList = infoList.map((item:any, index:any)=>{
return {
role: index%2==0?'user':'assistant',
content: item.text
}
})
console.log(dataSources.value);
try { try {
let lastText = '' let lastText = ''
const tts:any = []; const tts:any = [];
@ -206,12 +217,14 @@ async function onConversation() {
socket.send(JSON.stringify({ socket.send(JSON.stringify({
tts: 1, tts: 1,
data: [ data: [
...infoList,
{ {
role: 'user', role: 'user',
content: message, content: message,
}, },
], ],
})) }))
nowStatus.value = 'loding' nowStatus.value = 'loding'
// WebSocket // WebSocket