Don't send streaming request if generation was aborted before the streaming processor creation

This commit is contained in:
Cohee 2024-07-06 17:39:50 +03:00
parent 6dbbf89d65
commit 57175b4229
1 changed files with 4 additions and 0 deletions

View File

@ -5020,6 +5020,10 @@ async function sendGenerationRequest(type, data) {
* @returns {Promise<any>} Streaming generator
*/
async function sendStreamingRequest(type, data) {
if (abortController?.signal?.aborted) {
throw new Error('Generation was aborted.');
}
switch (main_api) {
case 'openai':
return await sendOpenAIRequest(type, data.prompt, streamingProcessor.abortController.signal);