feat: can break the stream when st does
This commit is contained in:
@@ -240,6 +240,14 @@ app.post("/v1/messages", (req, res) => {
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
res.on("close", function () {
|
||||||
|
console.log(" > [Client closed]");
|
||||||
|
if (stream && typeof stream.destroy === 'function') {
|
||||||
|
stream.destroy();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
stream.on("end", () => {
|
stream.on("end", () => {
|
||||||
// send ending
|
// send ending
|
||||||
res.write(createEvent("content_block_stop", { type: "content_block_stop", index: 0 }));
|
res.write(createEvent("content_block_stop", { type: "content_block_stop", index: 0 }));
|
||||||
|
|||||||
Reference in New Issue
Block a user