feat: 样式升级
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
* 支持多个供应商:CosyVoice, SiliconFlow, Azure, AWS等
|
||||
*/
|
||||
import { ref } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { toast } from 'vue-sonner'
|
||||
import { VoiceService } from '@/api/voice'
|
||||
import { normalizeProviderType, VOICE_PROVIDER_TYPES } from '@/config/voiceConfig'
|
||||
|
||||
@@ -83,7 +83,7 @@ export function useTTS(options = {}) {
|
||||
*/
|
||||
function playAudioPreview(url, opts = {}) {
|
||||
if (!url) {
|
||||
message.warning('暂无可试听的音频')
|
||||
toast.warning('暂无可试听的音频')
|
||||
return
|
||||
}
|
||||
|
||||
@@ -103,9 +103,9 @@ export function useTTS(options = {}) {
|
||||
.then(() => {
|
||||
previewAudio = audio
|
||||
audio.onended = cleanup
|
||||
audio.onerror = () => { cleanup(); message.error('播放失败') }
|
||||
audio.onerror = () => { cleanup(); toast.error('播放失败') }
|
||||
})
|
||||
.catch(() => { cleanup(); message.error('播放失败') })
|
||||
.catch(() => { cleanup(); toast.error('播放失败') })
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -157,7 +157,7 @@ export function useTTS(options = {}) {
|
||||
function buildPreviewParams(voice) {
|
||||
const configId = voice.rawId || extractIdFromString(voice.id)
|
||||
if (!configId) {
|
||||
message.error('配音配置无效')
|
||||
toast.error('配音配置无效')
|
||||
return null
|
||||
}
|
||||
return {
|
||||
@@ -231,7 +231,7 @@ export function useTTS(options = {}) {
|
||||
|
||||
const res = await VoiceService.synthesize(params)
|
||||
if (res.code !== 0) {
|
||||
message.error(res.msg || '试听失败')
|
||||
toast.error(res.msg || '试听失败')
|
||||
resetPreviewState()
|
||||
onError?.(new Error(res.msg || '试听失败'))
|
||||
return
|
||||
@@ -258,11 +258,11 @@ export function useTTS(options = {}) {
|
||||
return
|
||||
}
|
||||
|
||||
message.error('试听失败')
|
||||
toast.error('试听失败')
|
||||
resetPreviewState()
|
||||
onError?.(new Error('未收到音频数据'))
|
||||
} catch (error) {
|
||||
message.error('试听失败')
|
||||
toast.error('试听失败')
|
||||
resetPreviewState()
|
||||
onError?.(error)
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*/
|
||||
|
||||
import { ref, reactive } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import { toast } from 'vue-sonner'
|
||||
import { MaterialService } from '@/api/material'
|
||||
import { useUserStore } from '@/stores/user'
|
||||
import { OSS_ORIGINAL, OSS_DOMAIN, isDev } from '@gold/config/api'
|
||||
|
||||
Reference in New Issue
Block a user