(msg: string, code = 503)
| 250 | })}\n\ndata: [DONE]\n\n`; |
| 251 | } |
| 252 | async function* errorStream(msg: string, code = 503) { |
| 253 | yield `data: ${JSON.stringify({ error: { message: msg, code } })}\n\n`; |
| 254 | yield "data: [DONE]\n\n"; |
| 255 | } |
| 256 | function streamResponse(gen: AsyncGenerator<string>, status = 200) { |
| 257 | const stream = new ReadableStream({ |
| 258 | async start(ctrl) { |