Skip to content

Commit

Permalink
dev release
Browse files Browse the repository at this point in the history
  • Loading branch information
aj-ya committed Sep 15, 2023
1 parent 7774a6a commit 8ecb715
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/lazy-clocks-end.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'outpostkit': patch
---

fix for streaming
6 changes: 4 additions & 2 deletions src/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,12 @@ export const streamPromptWithEventStreaming = async (
},
body: JSON.stringify(payload),
async onopen(response) {
if (response.ok && response.headers.get('content-type') === EventStreamContentType) {
const contentType = response.headers.get('content-type');
console.log(contentType);
if (response.ok && contentType === EventStreamContentType) {
return; // everything's good
} else {
if (response.headers.get('content-type') === 'application/json') {
if (contentType === 'application/json') {
const body = await response.json();
throw new APIError({ status: response.status, message: body?.message });
} else {
Expand Down
Empty file added src/test.ts
Empty file.

0 comments on commit 8ecb715

Please sign in to comment.