diff --git a/src/api/dialog.js b/src/api/dialog.js index 846708a7..99b1584d 100644 --- a/src/api/dialog.js +++ b/src/api/dialog.js @@ -58,6 +58,7 @@ export const chatVoice = (data) => { return request({ url: '/traask/traTestchat/chatVoice', method: 'post', + timeout: 120000, data }); }; diff --git a/src/pages/example/components/answer.vue b/src/pages/example/components/answer.vue index 1aa254c6..054b9b4c 100644 --- a/src/pages/example/components/answer.vue +++ b/src/pages/example/components/answer.vue @@ -11,23 +11,9 @@ - - - 引用知识库{{ fileList.length }}篇相关资料 - - - {{ index + 1 }}. {{ item.docName }} - - - 本次回答参考资料来源于网络 - - - 发现{{ crsList.length }}个关联课程 - - - {{ index + 1 }}. {{ item.crsName }} - - + 大模型请求时长:{{ dataInfo.aiAskTime }}ms + 生成语音文件时长:{{ dataInfo.transVoice }}ms + 本次回答参考资料来源于网络 @@ -87,7 +73,28 @@ watch( ) watch( () => props.isLoading, - () => {}, + (val) => { + if(!val){ + setTimeout(()=> { + playVoice() + },500) + } + }, + { + deep: true, + immediate: true + } +) +const isPlaying = ref(false) +watch( + () => props.activeVoiceId, + (val) => { + if(val === props.dataInfo.id){ + isPlaying.value = true + }else{ + isPlaying.value = false + } + }, { deep: true, immediate: true @@ -100,7 +107,6 @@ const mdText = computed(() => { const fileList = computed(() => props.dataInfo?.talkingFiles || []) const crsList = computed(() => props.dataInfo?.talkingCrsList || []) const activeNames = ref([1, 2]) -const isPlaying = ref(false) const talkVoiceObj = ref(null) const voiceLoading = ref(false) @@ -118,11 +124,6 @@ const isPlaying = ref(false) talkVoiceObj.value.src = '' isPlaying.value = false }) - // itemVoice.value = unref(dataInfo).talkingVoice - // talkVoiceObj.value.src = itemVoice.value - // setTimeout(()=>{ - // setVoiceTime(0) - // },100) } const setVoiceTime = (sum) => { sum += 1 diff --git a/src/pages/example/dialog.vue b/src/pages/example/dialog.vue index 52823485..aeea75c5 100644 --- a/src/pages/example/dialog.vue +++ b/src/pages/example/dialog.vue @@ -348,6 +348,7 @@ isLoading: true, id: _id + 'loading' }); + scrollToBottomNow() chatVoice({ chatVoice: data.body.intrctContent }).then(res => { @@ -360,8 +361,10 @@ talkingFiles: [], talkingCrsList: [], talkingVoice: '', - talkingVoiceId: res.body.fileId + talkingVoiceId: res.body.fileId, + ...res.body }); + scrollToBottomNow() }) };