kopia lustrzana https://github.com/transitive-bullshit/chatgpt-api
Merge pull request #363 from zeke/add-cli
commit
5f7609c0ad
|
@ -0,0 +1,14 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import { ChatGPTAPI } from './build/index.js'
|
||||
|
||||
const input = process.argv[2]
|
||||
|
||||
if (!input) {
|
||||
console.log('Usage: chatgpt "input prompt"')
|
||||
process.exit()
|
||||
}
|
||||
|
||||
const api = new ChatGPTAPI({ apiKey: process.env.OPENAI_API_KEY })
|
||||
const res = await api.sendMessage(input)
|
||||
process.stdout.write(res.text)
|
Plik diff jest za duży
Load Diff
|
@ -21,6 +21,7 @@
|
|||
"engines": {
|
||||
"node": ">=14"
|
||||
},
|
||||
"bin": "cli.js",
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"dev": "tsup --watch",
|
||||
|
|
Ładowanie…
Reference in New Issue