Skip to content

Commit

Permalink
fix: streams
Browse files Browse the repository at this point in the history
  • Loading branch information
Kypaku committed Jul 3, 2023
1 parent 771d166 commit 6bcefb5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/api/openai.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,12 @@ export default class SimpleGPT {
try {
const responseChunk = JSON.parse(chunk.toString().slice("data: ".length));

fData(responseChunk.choices?.[0]?.delta?.content, responseChunk, chunk);
fData(responseChunk.choices?.[0]?.delta?.content || '', responseChunk, chunk);
} catch (e) {
throw new Error(`Unexpected message: ${chunk}`);
}
}
resolve();
}
});
});
Expand Down

0 comments on commit 6bcefb5

Please sign in to comment.