This repository was archived by the owner on Aug 30, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +14
-21
lines changed
Expand file tree Collapse file tree 1 file changed +14
-21
lines changed Original file line number Diff line number Diff line change @@ -295,31 +295,24 @@ export class r2rClient {
295295 console . log ( "Request headers:" , this . axiosInstance . defaults . headers ) ;
296296
297297
298- private async streamRag (
299- request : R2RRAGRequest
300- ) : Promise < ReadableStream < Uint8Array > | null > {
301- const response = await fetch ( `${ this . baseUrl } /rag` , {
302- method : 'POST' ,
303- headers : {
304- 'Content-Type' : 'application/json' ,
305- // Add any other headers you need, like authentication
306- } ,
307- body : JSON . stringify ( request ) ,
308- } ) ;
309-
310- if ( ! response . ok ) {
311- throw new Error ( `HTTP error! status: ${ response . status } ` ) ;
312- }
313-
314- return response . body ;
315298 }
316299
317300 @feature ( "streamingRag" )
318- private async streamRag ( request : R2RRAGRequest ) : Promise < ReadableStream > {
319- const response = await this . axiosInstance . post ( "/rag" , request , {
320- responseType : "stream" ,
301+ private async streamRag ( request : R2RRAGRequest ) : Promise < ReadableStream < Uint8Array > | null > {
302+ const response = await fetch ( `${ this . baseUrl } /rag` , {
303+ method : 'POST' ,
304+ headers : {
305+ 'Content-Type' : 'application/json' ,
306+ // Add any other headers you need, like authentication
307+ } ,
308+ body : JSON . stringify ( request ) ,
321309 } ) ;
322- return response . data ;
310+
311+ if ( ! response . ok ) {
312+ throw new Error ( `HTTP error! status: ${ response . status } ` ) ;
313+ }
314+
315+ return response . body ;
323316 }
324317
325318 @feature ( "delete" )
You can’t perform that action at this time.
0 commit comments