File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
ui/src/components/ai-chat/component/operation-button Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ import { useRoute } from 'vue-router'
8484import { copyClick } from ' @/utils/clipboard'
8585import applicationApi from ' @/api/application'
8686import { datetimeFormat } from ' @/utils/time'
87+ import { MsgError } from ' @/utils/message'
8788
8889const route = useRoute ()
8990const {
@@ -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' })
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ import EditMarkDialog from '@/views/log/component/EditMarkDialog.vue'
6666import { datetimeFormat } from ' @/utils/time'
6767import applicationApi from ' @/api/application'
6868import { useRoute } from ' vue-router'
69+ import { MsgError } from ' @/utils/message'
6970
7071const route = useRoute ()
7172const {
@@ -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' })
You can’t perform that action at this time.
0 commit comments