Skip to content

Commit

Permalink
Fix streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
andychase committed Oct 21, 2024
1 parent 9770c8f commit b22c24c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pages/api/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ const handler = async (req: NextApiRequest, res: NextApiResponse<any>) => {
);

res.setHeader('Content-Type', 'text/event-stream');
res.setHeader('Cache-Control', 'no-cache');
res.setHeader('Cache-Control', 'no-cache, no-transform');
res.setHeader('Connection', 'keep-alive');
res.flushHeaders();

const reader = stream.getReader();
const decoder = new TextDecoder();
Expand Down

0 comments on commit b22c24c

Please sign in to comment.