(controller)
| 460 | const encoder = new TextEncoder(); |
| 461 | return new ReadableStream({ |
| 462 | start(controller) { |
| 463 | controller.enqueue(encoder.encode(`data: ${JSON.stringify({ |
| 464 | id: "", model: MODEL_NAME, object: "chat.completion.chunk", |
| 465 | choices: [{ index: 0, delta: { role: "assistant", content: "服务暂时不可用,第三方响应错误" }, finish_reason: "stop" }], |
| 466 | usage: { prompt_tokens: 1, completion_tokens: 1, total_tokens: 2 }, |
| 467 | created: unixTimestamp(), |
| 468 | })}\n\n`)); |
| 469 | controller.close(); |
| 470 | } |
| 471 | }); |
| 472 | } |
| 473 | return createTransStream(model, response.body!, (convId: string) => { |
nothing calls this directly
no test coverage detected