Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
2 changes: 2 additions & 0 deletions scripts/install-binary.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
2 changes: 1 addition & 1 deletion src/exec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 2 additions & 0 deletions src/gptscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down