Don't send streaming request if generation was aborted before the streaming processor creation
| @@ -5020,6 +5020,10 @@ async function sendGenerationRequest(type, data) { | ||
| 5020 | 5020 | * @returns {Promise<any>} Streaming generator |
| 5021 | 5021 | */ |
| 5022 | 5022 | async function sendStreamingRequest(type, data) { |
| 5023 | + if (abortController?.signal?.aborted) { | |
| 5024 | + throw new Error('Generation was aborted.'); | |
| 5025 | + } | |
| 5026 | + | |
| 5023 | 5027 | switch (main_api) { |
| 5024 | 5028 | case 'openai': |
| 5025 | 5029 | return await sendOpenAIRequest(type, data.prompt, streamingProcessor.abortController.signal); |