From faf8faa9c831c2798bd7110900ab2c963bf2cee5 Mon Sep 17 00:00:00 2001 From: Bill Maxwell Date: Thu, 29 Feb 2024 08:38:43 -0700 Subject: [PATCH 1/2] fix - x64 needed to be remapped to amd64. Signed-off-by: Bill Maxwell --- scripts/install-binary.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install-binary.js b/scripts/install-binary.js index b1eaa4d..e72b52f 100644 --- a/scripts/install-binary.js +++ b/scripts/install-binary.js @@ -43,6 +43,8 @@ const platform = process.platform; let arch = process.arch; if (process.platform === 'darwin') { arch = 'universal'; +} else if (process.arch === 'x64') { + arch = 'amd64'; } let gptscriptBinaryName = 'gptscript'; From 0d2b3d0ffb29967fac3c54c3010934eba72c9fe9 Mon Sep 17 00:00:00 2001 From: Bill Maxwell Date: Thu, 29 Feb 2024 15:32:42 -0700 Subject: [PATCH 2/2] fix - stream exec funcs to capture std streams address docs issue and prep bug fix release. Signed-off-by: Bill Maxwell --- README.md | 2 +- package.json | 2 +- src/exec.js | 2 +- src/gptscript.js | 2 ++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 19b10bd..dbdf144 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ To use the module and run gptscripts, you need to first set the OPENAI_API_KEY e To ensure it is working properly, you can run the following command: ```bash -npm exec gptscript https://get.gptscript.ai/echo.gpt --input 'Hello, World!' +npm exec -c "gptscript https://get.gptscript.ai/echo.gpt --input 'Hello, World!'" ``` you will see "Hello, World!" in the output of the command. diff --git a/package.json b/package.json index 4be5938..3ddcb23 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@gptscript-ai/gptscript", - "version": "0.1.0", + "version": "0.1.1", "description": "Run gptscript in node.js", "main": "lib/gptscript.js", "repository": { diff --git a/src/exec.js b/src/exec.js index 68ce8c7..57c78ef 100644 --- a/src/exec.js +++ b/src/exec.js @@ -47,7 +47,7 @@ async function exec(command, args, stdin, cwd = './', detached, env) { } async function streamExec(command, args, stdin, cwd = './', detached, env) { - const spawnOptions = { maxBuffer: TEN_MEBIBYTE, cwd, detached, env, stdio: ['pipe', 'inherit', 'inherit'] }; + const spawnOptions = { maxBuffer: TEN_MEBIBYTE, cwd, detached, env, stdio: ['pipe', 'pipe', 'pipe'] }; const child = childProcess.spawn(command, args, spawnOptions); diff --git a/src/gptscript.js b/src/gptscript.js index 15aff90..7411b1f 100644 --- a/src/gptscript.js +++ b/src/gptscript.js @@ -93,6 +93,7 @@ async function execFile(scriptPath, input = "", opts = {}) { } async function streamExec(prompt, opts = {}) { + opts['quiet'] = false; const args = toArgs(opts); try { return await streamRun(args, prompt); @@ -102,6 +103,7 @@ async function streamExec(prompt, opts = {}) { } async function streamExecFile(scriptPath, input = "", opts = {}) { + opts['quiet'] = false; const args = toArgs(opts); try { const { stdout, stderr, promise } = await streamRun(args, undefined, scriptPath, input);