Skip to content

Commit 5772633

Browse files
committed
fix: show error message for tts model params not correct
--bug=1051057 --user=刘瑞斌 【模型管理】语音合成模型有错误的参数,播放回答内容时没有反应 https://www.tapd.cn/57709429/s/1639429
1 parent a4f8d59 commit 5772633

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

ui/src/components/ai-chat/component/operation-button/ChatOperationButton.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ import { useRoute } from 'vue-router'
8484
import { copyClick } from '@/utils/clipboard'
8585
import applicationApi from '@/api/application'
8686
import { datetimeFormat } from '@/utils/time'
87+
import { MsgError } from '@/utils/message'
8788
8889
const route = useRoute()
8990
const {
@@ -197,7 +198,12 @@ const playAnswerText = (text: string) => {
197198
}
198199
applicationApi
199200
.postTextToSpeech((props.applicationId as string) || (id as string), { text: text }, loading)
200-
.then((res: any) => {
201+
.then(async (res: any) => {
202+
if (res.type === 'application/json') {
203+
const text = await res.text()
204+
MsgError(text)
205+
return
206+
}
201207
// 假设我们有一个 MP3 文件的字节数组
202208
// 创建 Blob 对象
203209
const blob = new Blob([res], { type: 'audio/mp3' })

ui/src/components/ai-chat/component/operation-button/LogOperationButton.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ import EditMarkDialog from '@/views/log/component/EditMarkDialog.vue'
6666
import { datetimeFormat } from '@/utils/time'
6767
import applicationApi from '@/api/application'
6868
import { useRoute } from 'vue-router'
69+
import { MsgError } from '@/utils/message'
6970
7071
const route = useRoute()
7172
const {
@@ -177,7 +178,12 @@ const playAnswerText = (text: string) => {
177178
}
178179
applicationApi
179180
.postTextToSpeech(id || (props.applicationId as string), { text: text }, loading)
180-
.then((res: any) => {
181+
.then(async (res: any) => {
182+
if (res.type === 'application/json') {
183+
const text = await res.text()
184+
MsgError(text)
185+
return
186+
}
181187
// 假设我们有一个 MP3 文件的字节数组
182188
// 创建 Blob 对象
183189
const blob = new Blob([res], { type: 'audio/mp3' })

0 commit comments

Comments
 (0)