diff --git a/frontend/app/web-gold/src/api/chat.js b/frontend/app/web-gold/src/api/chat.js index 98b7e4c26c..58793096da 100644 --- a/frontend/app/web-gold/src/api/chat.js +++ b/frontend/app/web-gold/src/api/chat.js @@ -33,15 +33,16 @@ export const ChatMessageApi = { attachmentUrls = [] } = options || {} const token = getAccessToken() - + let retryCount = 0 const maxRetries = 0 // 禁用自动重试 - + return fetchEventSource(`${SERVER_BASE_AI}/chat/message/send-stream`, { method: 'post', headers: { 'Content-Type': 'application/json', - Authorization: `Bearer ${token}` + Authorization: `Bearer ${token}`, + 'tenant-id': import.meta.env?.VITE_TENANT_ID }, openWhenHidden: true, body: JSON.stringify({ diff --git a/frontend/app/web-gold/src/stores/voiceCopy.js b/frontend/app/web-gold/src/stores/voiceCopy.js index 9c66c24855..2ef4b637cf 100644 --- a/frontend/app/web-gold/src/stores/voiceCopy.js +++ b/frontend/app/web-gold/src/stores/voiceCopy.js @@ -18,9 +18,11 @@ export const useVoiceCopyStore = defineStore('voiceCopy', { /** * 加载配音列表 */ - async load() { - if (this.loaded && !this.loading) return - + async load(forceRefresh = false) { + if(!forceRefresh){ + if (this.loaded && !this.loading) return + } + this.loading = true try { const res = await VoiceService.getPage({ @@ -166,7 +168,7 @@ export const useVoiceCopyStore = defineStore('voiceCopy', { */ async refresh() { this.loaded = false - await this.load() + await this.load(true) } } }) diff --git a/frontend/app/web-gold/src/views/dh/Video.vue b/frontend/app/web-gold/src/views/dh/Video.vue index 873194f31a..36ecaadc6c 100644 --- a/frontend/app/web-gold/src/views/dh/Video.vue +++ b/frontend/app/web-gold/src/views/dh/Video.vue @@ -6,7 +6,7 @@ * 试听优化:添加缓存机制,同一参数下第二次试听直接播放缓存,无需重复调用API */ defineOptions({ name: 'DigitalVideoPage' }) -import { ref, computed, onMounted, watch, onUnmounted } from 'vue' +import { ref, computed, onMounted, watch, onUnmounted, onActivated } from 'vue' import { message } from 'ant-design-vue' import { InboxOutlined, SoundOutlined, LoadingOutlined } from '@ant-design/icons-vue' import { VoiceService } from '@/api/voice' @@ -40,7 +40,7 @@ const MAX_PREVIEW_CACHE_SIZE = 50 // 最多缓存50个音色的试听音频 // TTS 配置 const ttsText = ref('') const selectedTtsVoice = ref('') -const speechRate = ref(1.5) +const speechRate = ref(1.0) const instruction = ref('neutral') // 指令参数,用于控制音色风格 const emotion = ref('neutral') // 情感参数 const emotionActive = ref(false) // 是否激活情感tab(false为指令,true为情感) @@ -730,7 +730,8 @@ const playAudioFromBase64 = (audioBase64, format = 'mp3', onEnded = null) => { // 生命周期 onMounted(async () => { - await voiceStore.load() + + await voiceStore.refresh() // 默认选择第一个音色 if (voiceSource.value === 'user' && userVoiceCards.value.length > 0) { selectVoiceProfile(userVoiceCards.value[0]) @@ -742,6 +743,8 @@ onMounted(async () => { await loadLastTask() }) + + onUnmounted(() => { // 停止音频播放 previewAudio?.pause?.() @@ -853,7 +856,6 @@ let previewObjectUrl = ''
- {{ voice.category }} 查询