forked from open-webui/open-webui
wip: displaying error in a toast
This commit is contained in:
parent
a7bec01d7b
commit
195cfd4f84
2 changed files with 140 additions and 120 deletions
|
@ -191,6 +191,15 @@
|
|||
})
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
const error = await res.json();
|
||||
console.log(error);
|
||||
if ('detail' in error) {
|
||||
toast.error(error.detail);
|
||||
} else {
|
||||
toast.error(error.error);
|
||||
}
|
||||
} else {
|
||||
const reader = res.body
|
||||
.pipeThrough(new TextDecoderStream())
|
||||
.pipeThrough(splitStream('\n'))
|
||||
|
@ -266,6 +275,7 @@
|
|||
history: history
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
stopResponseFlag = false;
|
||||
await tick();
|
||||
|
|
|
@ -218,6 +218,15 @@
|
|||
})
|
||||
});
|
||||
|
||||
if (!res.ok) {
|
||||
const error = await res.json();
|
||||
console.log(error);
|
||||
if ('detail' in error) {
|
||||
toast.error(error.detail);
|
||||
} else {
|
||||
toast.error(error.error);
|
||||
}
|
||||
} else {
|
||||
const reader = res.body
|
||||
.pipeThrough(new TextDecoderStream())
|
||||
.pipeThrough(splitStream('\n'))
|
||||
|
@ -293,6 +302,7 @@
|
|||
history: history
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
stopResponseFlag = false;
|
||||
await tick();
|
||||
|
|
Loading…
Reference in a new issue