(readableStream, options)
| 82459 | for await (const chunk of stream4) { |
| 82460 | __classPrivateFieldGet11(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_addChunk).call(this, chunk); |
| 82461 | } |
| 82462 | if (stream4.controller.signal?.aborted) { |
| 82463 | throw new APIUserAbortError3(); |
| 82464 | } |
| 82465 | return this._addChatCompletion(__classPrivateFieldGet11(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_endRequest).call(this)); |
| 82466 | } |
| 82467 | async _fromReadableStream(readableStream, options) { |
| 82468 | const signal = options?.signal; |
| 82469 | if (signal) { |
| 82470 | if (signal.aborted) |
| 82471 | this.controller.abort(); |
| 82472 | signal.addEventListener("abort", () => this.controller.abort()); |
| 82473 | } |
| 82474 | __classPrivateFieldGet11(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_beginRequest).call(this); |
| 82475 | this._connected(); |
| 82476 | const stream4 = Stream2.fromReadableStream(readableStream, this.controller); |
| 82477 | let chatId; |
| 82478 | for await (const chunk of stream4) { |
| 82479 | if (chatId && chatId !== chunk.id) { |
| 82480 | this._addChatCompletion(__classPrivateFieldGet11(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_endRequest).call(this)); |
| 82481 | } |
| 82482 | __classPrivateFieldGet11(this, _ChatCompletionStream_instances, "m", _ChatCompletionStream_addChunk).call(this, chunk); |
| 82483 | chatId = chunk.id; |
| 82484 | } |
| 82485 | if (stream4.controller.signal?.aborted) { |
| 82486 | throw new APIUserAbortError3(); |
no test coverage detected