MCPcopy Create free account
hub / github.com/Seanium/ChatMap / start

Function start

app/api/stream/route.ts:128–136  ·  view source on GitHub ↗
(controller)

Source from the content-addressed store, hash-verified

126
127 const responseStream = new ReadableStream({
128 async start(controller) {
129 for await (const chunk of stream) {
130 if (chunk.choices[0]?.delta?.content) {
131 controller.enqueue(encoder.encode(`data: ${JSON.stringify(chunk)}\n\n`));
132 }
133 }
134 controller.enqueue(encoder.encode("data: [DONE]\n\n"));
135 controller.close();
136 },
137 cancel() {
138 // 当流被取消时,关闭 OpenAI 流
139 if (stream.controller) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected