@@ -80,7 +80,7 @@ export class Client {
80
80
* @return {Run } The Run object representing the running tool.
81
81
*/
82
82
run ( toolName : string , opts : RunOpts = { } ) : Run {
83
- return ( new Run ( "run-file-stream-with-events" , toolName , "" , opts ) ) . nextChat ( opts . input )
83
+ return ( new Run ( "run-file-stream-with-events" , toolName , "" , opts , this . gptscriptBin , this . gptscriptURL ) ) . nextChat ( opts . input )
84
84
}
85
85
86
86
/**
@@ -101,7 +101,7 @@ export class Client {
101
101
toolString = toolDefToString ( tool )
102
102
}
103
103
104
- return ( new Run ( "run-tool-stream-with-event" , "" , toolString , opts ) ) . nextChat ( opts . input )
104
+ return ( new Run ( "run-tool-stream-with-event" , "" , toolString , opts , this . gptscriptBin , this . gptscriptURL ) ) . nextChat ( opts . input )
105
105
}
106
106
107
107
async parse ( fileName : string ) : Promise < Block [ ] > {
@@ -196,7 +196,7 @@ export class Run {
196
196
197
197
let run = this
198
198
if ( run . state !== RunState . Creating ) {
199
- run = new ( this . constructor as any ) ( run . requestPath , run . filePath , run . content , run . opts )
199
+ run = new ( this . constructor as any ) ( run . requestPath , run . filePath , run . content , run . opts , run . gptscriptURL )
200
200
}
201
201
202
202
run . chatState = this . chatState
@@ -379,9 +379,10 @@ export class Run {
379
379
if ( typeof window !== "undefined" && typeof window . document !== "undefined" ) {
380
380
// @ts -ignore
381
381
const { SSE } = await import ( "sse.js" )
382
- this . sse = new SSE ( this . gptscriptURL + "/" + this . filePath , {
382
+ this . sse = new SSE ( this . gptscriptURL + "/" + this . requestPath , {
383
383
headers : { "Content-Type" : "application/json" } ,
384
- payload : postData
384
+ payload : tool ? postData : undefined ,
385
+ method : tool ? "POST" : "GET"
385
386
} as any )
386
387
387
388
this . sse . addEventListener ( "open" , ( ) => {
0 commit comments