From 2bc96514fcd61478d7d00a2d4f69f975c7ea89bf Mon Sep 17 00:00:00 2001 From: kwaroran Date: Wed, 21 Jun 2023 23:41:03 +0900 Subject: [PATCH] [fix] stream outputs nothing when responses non-event stream --- src/ts/process/request.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/ts/process/request.ts b/src/ts/process/request.ts index 3fe36380..8bfa6506 100644 --- a/src/ts/process/request.ts +++ b/src/ts/process/request.ts @@ -183,6 +183,13 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model' } } + if(da.headers.get('Content-Type') !== 'text/event-stream'){ + return { + type: "fail", + result: await da.text() + } + } + let dataUint = new Uint8Array([]) const transtream = new TransformStream( {