Skip to content

Commit

Permalink
fix: show proper error message
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-jan authored and urmauur committed Dec 15, 2023
1 parent d9b0625 commit cf7e935
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions extensions/inference-openai-extension/src/helpers/sse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ export function requestInference(
signal: controller?.signal,
})
.then(async (response) => {
if (!response.ok) {
subscriber.next(
(await response.json()).error?.message ?? "Error occured"
);
subscriber.complete();
return;
}
if (model.parameters.stream) {
const stream = response.body;
const decoder = new TextDecoder("utf-8");
Expand Down

0 comments on commit cf7e935

Please sign in to comment.