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)
playAudio()
}
ttsList = tts;
ttsList = JSON.parse(JSON.stringify(tts));
}
}

View File

@ -197,6 +197,17 @@ async function onConversation() {
})
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 {
let lastText = ''
const tts:any = [];
@ -206,12 +217,14 @@ async function onConversation() {
socket.send(JSON.stringify({
tts: 1,
data: [
...infoList,
{
role: 'user',
content: message,
},
],
}))
nowStatus.value = 'loding'
// WebSocket