改进 错误处理
Some checks failed
Build / build (push) Failing after 6m30s

This commit is contained in:
Twilight 2024-09-16 23:54:42 +08:00
parent 87f6c4b6f3
commit a5e468d0c1
2 changed files with 9 additions and 8 deletions

View File

@ -413,7 +413,7 @@ async function sendMessage(
})
.catch(async (err) => {
// if 409
if (err.response.status === 409) {
if (err.response?.status === 409) {
const streamId = err.response.data.data?.stream_id;
if (streamId) {
@ -481,6 +481,14 @@ function streamChat(streamId: String, redirect = false) {
const url = getApi().conf.basePath + "/api/v1/stream/" + streamId;
const evtSource = new EventSource(url);
// error
evtSource.onerror = (e) => {
dialog.error({
title: "推理失败",
content: "目前无法完成推理,请稍后再试。",
positiveText: "好",
});
}
let messageAdded = false;

View File

@ -101,13 +101,6 @@ const response = {
return h(error500);
},
});
} else {
if (data.length !== 0) {
dialog.error({
title: "错误",
content: data,
});
}
}
return Promise.reject(error);