mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Don't send streaming request if generation was aborted before the streaming processor creation
This commit is contained in:
@ -5020,6 +5020,10 @@ async function sendGenerationRequest(type, data) {
|
|||||||
* @returns {Promise<any>} Streaming generator
|
* @returns {Promise<any>} Streaming generator
|
||||||
*/
|
*/
|
||||||
async function sendStreamingRequest(type, data) {
|
async function sendStreamingRequest(type, data) {
|
||||||
|
if (abortController?.signal?.aborted) {
|
||||||
|
throw new Error('Generation was aborted.');
|
||||||
|
}
|
||||||
|
|
||||||
switch (main_api) {
|
switch (main_api) {
|
||||||
case 'openai':
|
case 'openai':
|
||||||
return await sendOpenAIRequest(type, data.prompt, streamingProcessor.abortController.signal);
|
return await sendOpenAIRequest(type, data.prompt, streamingProcessor.abortController.signal);
|
||||||
|
Reference in New Issue
Block a user