fix: show error message for tts model params not correct

--bug=1051057 --user=刘瑞斌 【模型管理】语音合成模型有错误的参数,播放回答内容时没有反应 https://www.tapd.cn/57709429/s/1639429
This commit is contained in:
CaptainB 2024-12-31 11:01:01 +08:00 committed by 刘瑞斌
parent 4ae21bcf1f
commit 06f591d404
2 changed files with 14 additions and 2 deletions

View File

@ -84,6 +84,7 @@ import { useRoute } from 'vue-router'
import { copyClick } from '@/utils/clipboard'
import applicationApi from '@/api/application'
import { datetimeFormat } from '@/utils/time'
import { MsgError } from '@/utils/message'
const route = useRoute()
const {
@ -197,7 +198,12 @@ const playAnswerText = (text: string) => {
}
applicationApi
.postTextToSpeech((props.applicationId as string) || (id as string), { text: text }, loading)
.then((res: any) => {
.then(async (res: any) => {
if (res.type === 'application/json') {
const text = await res.text()
MsgError(text)
return
}
// MP3
// Blob
const blob = new Blob([res], { type: 'audio/mp3' })

View File

@ -66,6 +66,7 @@ import EditMarkDialog from '@/views/log/component/EditMarkDialog.vue'
import { datetimeFormat } from '@/utils/time'
import applicationApi from '@/api/application'
import { useRoute } from 'vue-router'
import { MsgError } from '@/utils/message'
const route = useRoute()
const {
@ -177,7 +178,12 @@ const playAnswerText = (text: string) => {
}
applicationApi
.postTextToSpeech(id || (props.applicationId as string), { text: text }, loading)
.then((res: any) => {
.then(async (res: any) => {
if (res.type === 'application/json') {
const text = await res.text()
MsgError(text)
return
}
// MP3
// Blob
const blob = new Blob([res], { type: 'audio/mp3' })