I'm a noob so bear with me. I've cloned the git, entered the cloned git folder 'whatever' and run npm run install
but it results in the error npm ERR! Missing script: "install"
and, indeed, the package.json doesn't have an "install" script section:
"scripts": {
"dev": "ts-node src/index",
"cli": "ts-node dist/cli.ts",
"test": "echo \"Error: no test specified\" && exit 1",
"build": "npx tsc"
I would appreciate some help getting this running. I tried npm run build
but also got a bunch of errors.
EDIT: I ran npm install typescript
and then npm run build
completes and now I have a couple new folders 'dist' and 'node_modules' but can't make out how to use them
EDIT: npm install -g ts-node
got me further but still not working:
npm run dev
> [email protected] dev
> ts-node src/index
/Users/[redacted]/whatever/src/index.ts:4
assert(process.env.OPENAI_API_KEY, "OPENAI_API_KEY is required to run the app.")
^
AssertionError [ERR_ASSERTION]: OPENAI_API_KEY is required to run the app.
at Object.<anonymous> (/Users/[redacted]/whatever/src/index.ts:4:7)
at Module._compile (node:internal/modules/cjs/loader:1275:14)
at Module.m._compile (/usr/local/lib/node_modules/ts-node/src/index.ts:1618:23)
at Module._extensions..js (node:internal/modules/cjs/loader:1329:10)
at Object.require.extensions.<computed> [as .ts] (/usr/local/lib/node_modules/ts-node/src/index.ts:1621:12)
at Module.load (node:internal/modules/cjs/loader:1133:32)
at Function.Module._load (node:internal/modules/cjs/loader:972:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
at phase4 (/usr/local/lib/node_modules/ts-node/src/bin.ts:649:14)
at bootstrap (/usr/local/lib/node_modules/ts-node/src/bin.ts:95:10) {
generatedMessage: false,
code: 'ERR_ASSERTION',
actual: undefined,
expected: true,
operator: '=='
}
P.S. I do have an .env
file in the 'root directory of the project' whatever
with the following contents OPENAI_API_KEY [redacted]
EDIT: changed syntax in .env
file to OPENAI_API_KEY=[redacted]
and now it's generating a QR Code, which I scanned with WhatsApp, so getting further! Not sure what to do next to actually 'chat' with ChatGPT
EDIT: I've got npm run dev
in one terminal session. Not sure how to use it so I ran npm run cli
in another terminal but it results in:
npm run cli
> [email protected] cli
> ts-node dist/cli.ts
node:internal/modules/cjs/loader:1093
throw err;
^
Error: Cannot find module './cli.ts'
Require stack:
EDIT: having left it running in a terminal window, I suddenly got a WhatsApp message in WhatsApp Desktop from this interesting app you've made. But I cannot figure out how to cause it to happen. Sending a question to myself in a chat to myself doesn't seem to get intercepted. How do you use this thing? Does it intercept anything terminating with a question mark and generate a ChatGPT based response in the same chat?