Skip to content

Commit

Permalink
gracefully end stream
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhravya committed Apr 1, 2024
1 parent dbf3011 commit a00bb30
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/cf-ai-backend/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export default {
const encodedChunk = converter.encode("data: " + JSON.stringify({ "response": chunkText }) + "\n\n");
controller.enqueue(encodedChunk);
}
const doneChunk = converter.encode("[DONE]");
const doneChunk = converter.encode("data: [DONE]");
controller.enqueue(doneChunk);
controller.close();
}
Expand Down Expand Up @@ -167,7 +167,7 @@ export default {
const encodedChunk = converter.encode("data: " + JSON.stringify({ "response": chunkText }) + "\n\n");
controller.enqueue(encodedChunk);
}
const doneChunk = converter.encode("[DONE]");
const doneChunk = converter.encode("data: [DONE]");
controller.enqueue(doneChunk);
controller.close();
}
Expand Down

0 comments on commit a00bb30

Please sign in to comment.