feat:文字转语音改为片段请求
This commit is contained in:
@@ -78,6 +78,12 @@
|
||||
src="/static/icon/stop.png"
|
||||
@click="stopMarkdown(msg.displayText, index)"
|
||||
></image>
|
||||
<image
|
||||
v-else-if="isLoading && speechIndex === index"
|
||||
class="controll-icon mar_le10 btn-light"
|
||||
src="/static/icon/audio-fetching.png"
|
||||
@click="stopMarkdown(msg.displayText, index)"
|
||||
></image>
|
||||
<image
|
||||
class="controll-icon mar_le10 btn-light"
|
||||
src="/static/icon/broadcast.png"
|
||||
@@ -272,7 +278,7 @@ import FileText from './fileText.vue';
|
||||
import useScreenStore from '@/stores/useScreenStore'
|
||||
const screenStore = useScreenStore();
|
||||
import { useAudioRecorder } from '@/hook/useRealtimeRecorder.js';
|
||||
import { useTTSPlayer } from '@/hook/useTTS.js';
|
||||
import { useAudioSpeak } from '@/hook/useAudioSpeak.js';
|
||||
// 全局
|
||||
const { $api, navTo, throttle } = inject('globalFunction');
|
||||
const emit = defineEmits(['onConfirm']);
|
||||
@@ -295,7 +301,7 @@ const {
|
||||
lastFinalText,
|
||||
} = useAudioRecorder();
|
||||
// 语音合成
|
||||
const { speak, pause, resume, isSpeaking, isPaused, cancelAudio } = useTTSPlayer(config.speechSynthesis);
|
||||
const { speak, pause, resume, isSpeaking, isPaused, isLoading, cancelAudio,cleanup } = useAudioSpeak();
|
||||
|
||||
// state
|
||||
const queries = ref([]);
|
||||
@@ -347,8 +353,14 @@ const leaveFileCount = computed(()=>{ //还剩多少文件可以上传 给扫码
|
||||
onMounted(async () => {
|
||||
changeQueries();
|
||||
scrollToBottom();
|
||||
isAudioPermission.value = await requestMicPermission();
|
||||
});
|
||||
isAudioPermission.value = await requestMicPermission();
|
||||
})
|
||||
|
||||
onUnmounted(()=>{
|
||||
console.log('清理TTS资源')
|
||||
cleanup()
|
||||
})
|
||||
|
||||
|
||||
const requestMicPermission = async () => {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user