fix: show proper error message
This commit is contained in:
parent
d9b0625b17
commit
cf7e9350b7
@ -40,6 +40,13 @@ export function requestInference(
|
|||||||
signal: controller?.signal,
|
signal: controller?.signal,
|
||||||
})
|
})
|
||||||
.then(async (response) => {
|
.then(async (response) => {
|
||||||
|
if (!response.ok) {
|
||||||
|
subscriber.next(
|
||||||
|
(await response.json()).error?.message ?? "Error occured"
|
||||||
|
);
|
||||||
|
subscriber.complete();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (model.parameters.stream) {
|
if (model.parameters.stream) {
|
||||||
const stream = response.body;
|
const stream = response.body;
|
||||||
const decoder = new TextDecoder("utf-8");
|
const decoder = new TextDecoder("utf-8");
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user