Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Chatgpt Puppeteer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Chatgpt Puppeteer
Commits
9d408621
Commit
9d408621
authored
Dec 05, 2022
by
Travis Fischer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
docs: add example gif
parent
c361da93
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
210 additions
and
2 deletions
+210
-2
media/demo.gif
media/demo.gif
+0
-0
media/demo.tape
media/demo.tape
+76
-0
package.json
package.json
+1
-0
pnpm-lock.yaml
pnpm-lock.yaml
+123
-0
readme.md
readme.md
+4
-0
src/example.ts
src/example.ts
+6
-2
No files found.
media/demo.gif
0 → 100644
View file @
9d408621
143 KB
media/demo.tape
0 → 100644
View file @
9d408621
# VHS documentation
#
# @see https://github.com/charmbracelet/vhs
#
# ```
# vhs < media/demo.tape
# ```
#
# Output:
# Output <path>.gif Create a GIF output at the given <path>
# Output <path>.mp4 Create an MP4 output at the given <path>
# Output <path>.webm Create a WebM output at the given <path>
#
# Require:
# Require <string> Ensure a program is on the $PATH to proceed
#
# Settings:
# Set FontSize <number> Set the font size of the terminal
# Set FontFamily <string> Set the font family of the terminal
# Set Height <number> Set the height of the terminal
# Set Width <number> Set the width of the terminal
# Set LetterSpacing <float> Set the font letter spacing (tracking)
# Set LineHeight <float> Set the font line height
# Set LoopOffset <float>% Set the starting frame offset for the GIF loop
# Set Theme <json|string> Set the theme of the terminal
# Set Padding <number> Set the padding of the terminal
# Set Framerate <number> Set the framerate of the recording
# Set PlaybackSpeed <float> Set the playback speed of the recording
#
# Sleep:
# Sleep <time> Sleep for a set amount of <time> in seconds
#
# Type:
# Type[@<time>] "<characters>" Type <characters> into the terminal with a
# <time> delay between each character
#
# Keys:
# Backspace[@<time>] [number] Press the Backspace key
# Down[@<time>] [number] Press the Down key
# Enter[@<time>] [number] Press the Enter key
# Space[@<time>] [number] Press the Space key
# Tab[@<time>] [number] Press the Tab key
# Left[@<time>] [number] Press the Left Arrow key
# Right[@<time>] [number] Press the Right Arrow key
# Up[@<time>] [number] Press the Up Arrow key
# Down[@<time>] [number] Press the Down Arrow key
# Ctrl+<key> Press the Control key + <key> (e.g. Ctrl+C)
#
# Display:
# Hide Hide the subsequent commands from the output
# Show Show the subsequent commands in the output
Output media/demo.gif
Hide
Require npx
#Set Shell bash
Set FontSize 17
Set Width 1200
Set Height 600
Set Padding 24
Set LoopOffset 75%
Type " "
Sleep 980ms
Backspace 1
Show
Type "npx tsx src/example.ts"
Sleep 500ms
Enter
Show
Sleep 8s
Sleep 8s
package.json
View file @
9d408621
...
...
@@ -50,6 +50,7 @@
"
husky
"
:
"
^8.0.2
"
,
"
lint-staged
"
:
"
^13.0.3
"
,
"
npm-run-all
"
:
"
^4.1.5
"
,
"
ora
"
:
"
^6.1.2
"
,
"
prettier
"
:
"
^2.8.0
"
,
"
tsup
"
:
"
^6.5.0
"
,
"
tsx
"
:
"
^3.12.1
"
,
...
...
pnpm-lock.yaml
View file @
9d408621
...
...
@@ -12,6 +12,7 @@ specifiers:
lint-staged
:
^13.0.3
node-fetch
:
^3.3.0
npm-run-all
:
^4.1.5
ora
:
^6.1.2
prettier
:
^2.8.0
remark
:
^14.0.2
strip-markdown
:
^5.0.0
...
...
@@ -39,6 +40,7 @@ devDependencies:
husky
:
8.0.2
lint-staged
:
13.0.4
npm-run-all
:
4.1.5
ora
:
6.1.2
prettier
:
2.8.0
tsup
:
6.5.0_typescript@4.9.3
tsx
:
3.12.1
...
...
@@ -531,11 +533,23 @@ packages:
resolution
:
{
integrity
:
sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==
}
dev
:
true
/base64-js/1.5.1
:
resolution
:
{
integrity
:
sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==
}
dev
:
true
/binary-extensions/2.2.0
:
resolution
:
{
integrity
:
sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==
}
engines
:
{
node
:
'
>=8'
}
dev
:
true
/bl/5.1.0
:
resolution
:
{
integrity
:
sha512-tv1ZJHLfTDnXE6tMHv73YgSJaWR2AFuPwMntBe7XL/GBFHnT0CLnsHMogfk5+GzCDC5ZWarSCYaIGATZt9dNsQ==
}
dependencies
:
buffer
:
6.0.3
inherits
:
2.0.4
readable-stream
:
3.6.0
dev
:
true
/brace-expansion/1.1.11
:
resolution
:
{
integrity
:
sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==
}
dependencies
:
...
...
@@ -571,6 +585,13 @@ packages:
resolution
:
{
integrity
:
sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==
}
dev
:
true
/buffer/6.0.3
:
resolution
:
{
integrity
:
sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==
}
dependencies
:
base64-js
:
1.5.1
ieee754
:
1.2.1
dev
:
true
/bundle-require/3.1.2_esbuild@0.15.16
:
resolution
:
{
integrity
:
sha512-Of6l6JBAxiyQ5axFxUM6dYeP/W7X2Sozeo/4EYB9sJhL+dqL7TKjg+shwxp6jlu/6ZSERfsYtIpSJ1/x3XkAEA==
}
engines
:
{
node
:
^12.20.0 || ^14.13.1 || >=16.0.0
}
...
...
@@ -621,6 +642,11 @@ packages:
supports-color
:
5.5.0
dev
:
true
/chalk/5.1.2
:
resolution
:
{
integrity
:
sha512-E5CkT4jWURs1Vy5qGJye+XwCkNj7Od3Af7CP6SujMetSMkLs8Do2RWJK5yx1wamHV/op8Rz+9rltjaTQWDnEFQ==
}
engines
:
{
node
:
^12.17.0 || ^14.13 || >=16.0.0
}
dev
:
true
/character-entities/2.0.2
:
resolution
:
{
integrity
:
sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==
}
dev
:
false
...
...
@@ -659,6 +685,18 @@ packages:
restore-cursor
:
3.1.0
dev
:
true
/cli-cursor/4.0.0
:
resolution
:
{
integrity
:
sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==
}
engines
:
{
node
:
^12.20.0 || ^14.13.1 || >=16.0.0
}
dependencies
:
restore-cursor
:
4.0.0
dev
:
true
/cli-spinners/2.7.0
:
resolution
:
{
integrity
:
sha512-qu3pN8Y3qHNgE2AFweciB1IfMnmZ/fsNTEE+NOFjmGB2F/7rLhnhzppvpCnN4FovtP26k8lHyy9ptEbNwWFLzw==
}
engines
:
{
node
:
'
>=6'
}
dev
:
true
/cli-truncate/2.1.0
:
resolution
:
{
integrity
:
sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==
}
engines
:
{
node
:
'
>=8'
}
...
...
@@ -675,6 +713,11 @@ packages:
string-width
:
5.1.2
dev
:
true
/clone/1.0.4
:
resolution
:
{
integrity
:
sha512-JQHZ2QMW6l3aH/j6xCqQThY/9OH4D/9ls34cgkUBiEeocRTU04tHfKPBsUK1PqZCUQM7GiA0IIXJSuXHI64Kbg==
}
engines
:
{
node
:
'
>=0.8'
}
dev
:
true
/color-convert/1.9.3
:
resolution
:
{
integrity
:
sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==
}
dependencies
:
...
...
@@ -778,6 +821,12 @@ packages:
character-entities
:
2.0.2
dev
:
false
/defaults/1.0.4
:
resolution
:
{
integrity
:
sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==
}
dependencies
:
clone
:
1.0.4
dev
:
true
/define-properties/1.1.4
:
resolution
:
{
integrity
:
sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==
}
engines
:
{
node
:
'
>=
0.4'
}
...
...
@@ -1416,6 +1465,10 @@ packages:
hasBin
:
true
dev
:
true
/ieee754/1.2.1
:
resolution
:
{
integrity
:
sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA==
}
dev
:
true
/ignore/5.2.1
:
resolution
:
{
integrity
:
sha512-d2qQLzTJ9WxQftPAuEQpSPmKqzxePjzVbpAVv62AQ64NTL+wR4JkrVqR/LqFsFEUsHDAiId52mJteHDFuDkElA==
}
engines
:
{
node
:
'
>=
4'
}
...
...
@@ -1521,6 +1574,11 @@ packages:
is-extglob
:
2.1.1
dev
:
true
/is-interactive/2.0.0
:
resolution
:
{
integrity
:
sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==
}
engines
:
{
node
:
'
>=12'
}
dev
:
true
/is-negative-zero/2.0.2
:
resolution
:
{
integrity
:
sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==
}
engines
:
{
node
:
'
>=
0.4'
}
...
...
@@ -1596,6 +1654,11 @@ packages:
has-symbols
:
1.0.3
dev
:
true
/is-unicode-supported/1.3.0
:
resolution
:
{
integrity
:
sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==
}
engines
:
{
node
:
'
>=12'
}
dev
:
true
/is-weakref/1.0.2
:
resolution
:
{
integrity
:
sha512-qctsuLZmIQ0+vSSMfoVvyFe2+GSEvnmZ2ezTup1SBse9+twCCeial6EEi3Nc2KFcf6+qz2FBPnjXsk8xhKSaPQ==
}
dependencies
:
...
...
@@ -1734,6 +1797,14 @@ packages:
resolution
:
{
integrity
:
sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
}
dev
:
true
/log-symbols/5.1.0
:
resolution
:
{
integrity
:
sha512-l0x2DvrW294C9uDCoQe1VSU4gf529FkSZ6leBl4TiqZH/e+0R7hSfHQBNut2mNygDgHwvYHfFLn6Oxb3VWj2rA==
}
engines
:
{
node
:
'
>=12'
}
dependencies
:
chalk
:
5.1.2
is-unicode-supported
:
1.3.0
dev
:
true
/log-update/4.0.0
:
resolution
:
{
integrity
:
sha512-9fkkDevMefjg0mmzWFBW8YkFP91OrizzkW3diF7CpG+S2EYdy4+TVfGwz1zeF8x7hCx1ovSPTOE9Ngib74qqUg==
}
engines
:
{
node
:
'
>=10'
}
...
...
@@ -2214,6 +2285,21 @@ packages:
mimic-fn
:
4.0.0
dev
:
true
/ora/6.1.2
:
resolution
:
{
integrity
:
sha512-EJQ3NiP5Xo94wJXIzAyOtSb0QEIAUu7m8t6UZ9krbz0vAJqr92JpcK/lEXg91q6B9pEGqrykkd2EQplnifDSBw==
}
engines
:
{
node
:
^12.20.0 || ^14.13.1 || >=16.0.0
}
dependencies
:
bl
:
5.1.0
chalk
:
5.1.2
cli-cursor
:
4.0.0
cli-spinners
:
2.7.0
is-interactive
:
2.0.0
is-unicode-supported
:
1.3.0
log-symbols
:
5.1.0
strip-ansi
:
7.0.1
wcwidth
:
1.0.1
dev
:
true
/p-defer/1.0.0
:
resolution
:
{
integrity
:
sha512-wB3wfAxZpk2AzOfUMJNL+d36xothRSyj8EXOa4f6GMqYDN9BJaaSISbsk+wS9abmnebVw95C2Kb5t85UmpCxuw==
}
engines
:
{
node
:
'
>=4'
}
...
...
@@ -2401,6 +2487,15 @@ packages:
type-fest
:
1.4.0
dev
:
true
/readable-stream/3.6.0
:
resolution
:
{
integrity
:
sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==
}
engines
:
{
node
:
'
>=
6'
}
dependencies
:
inherits
:
2.0.4
string_decoder
:
1.3.0
util-deprecate
:
1.0.2
dev
:
true
/readdirp/3.6.0
:
resolution
:
{
integrity
:
sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==
}
engines
:
{
node
:
'
>=8.10.0'
}
...
...
@@ -2476,6 +2571,14 @@ packages:
signal-exit
:
3.0.7
dev
:
true
/restore-cursor/4.0.0
:
resolution
:
{
integrity
:
sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==
}
engines
:
{
node
:
^12.20.0 || ^14.13.1 || >=16.0.0
}
dependencies
:
onetime
:
5.1.2
signal-exit
:
3.0.7
dev
:
true
/reusify/1.0.4
:
resolution
:
{
integrity
:
sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==
}
engines
:
{
iojs
:
'
>=1.0.0'
,
node
:
'
>=0.10.0'
}
...
...
@@ -2519,6 +2622,10 @@ packages:
mri
:
1.2.0
dev
:
false
/safe-buffer/5.2.1
:
resolution
:
{
integrity
:
sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
}
dev
:
true
/safe-regex-test/1.0.0
:
resolution
:
{
integrity
:
sha512-JBUUzyOgEwXQY1NuPtvcj/qcBDbDmEvWufhlnXZIm75DEHp+afM1r1ujJpJsV/gSM4t59tpDyPi1sd6ZaPFfsA==
}
dependencies
:
...
...
@@ -2723,6 +2830,12 @@ packages:
es-abstract
:
1.20.4
dev
:
true
/string_decoder/1.3.0
:
resolution
:
{
integrity
:
sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==
}
dependencies
:
safe-buffer
:
5.2.1
dev
:
true
/strip-ansi/6.0.1
:
resolution
:
{
integrity
:
sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==
}
engines
:
{
node
:
'
>=8'
}
...
...
@@ -3000,6 +3113,10 @@ packages:
picocolors
:
1.0.0
dev
:
true
/util-deprecate/1.0.2
:
resolution
:
{
integrity
:
sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==
}
dev
:
true
/uuid/9.0.0
:
resolution
:
{
integrity
:
sha512-MXcSTerfPa4uqyzStbRoTgt5XIe3x5+42+q1sDuy3R5MDk66URdLMOZe5aPX/SQd+kuYAh0FdP/pO28IkQyTeg==
}
hasBin
:
true
...
...
@@ -3047,6 +3164,12 @@ packages:
resolution
:
{
integrity
:
sha512-gu73tuZfJgu+mvCSy4UZwd2JXykjK9zAZsfmDeut5dx/1a7FeTk0XwJsSuqQn+cuMCGVbIBfl+s53X4T19DnzQ==
}
dev
:
true
/wcwidth/1.0.1
:
resolution
:
{
integrity
:
sha512-XHPEwS0q6TaxcvG85+8EYkbiCux2XtWG2mkc47Ng2A77BQu9+DqIOJldST4HgPkuea7dvKSj5VgX3P1d4rW8Tg==
}
dependencies
:
defaults
:
1.0.4
dev
:
true
/web-streams-polyfill/3.2.1
:
resolution
:
{
integrity
:
sha512-e0MO3wdXWKrLbL0DgGnUV7WHVuw9OUvL4hjgnPkIeEvESk74gAITi5G606JtZPp39cd8HA9VQzCIvA49LpPN5Q==
}
engines
:
{
node
:
'
>=
8'
}
...
...
readme.md
View file @
9d408621
<p
align=
"center"
>
<img
alt=
"Example usage"
src=
"/media/demo.gif"
>
</p>
# ChatGPT API <!-- omit in toc -->
> Node.js client for the unofficial [ChatGPT](https://openai.com/blog/chatgpt/) API.
...
...
src/example.ts
View file @
9d408621
import
dotenv
from
'
dotenv-safe
'
import
{
oraPromise
}
from
'
ora
'
import
{
ChatGPTAPI
}
from
'
./chatgpt-api
'
...
...
@@ -11,9 +12,12 @@ async function main() {
const
api
=
new
ChatGPTAPI
({
sessionToken
:
process
.
env
.
SESSION_TOKEN
})
await
api
.
ensureAuth
()
const
response
=
await
api
.
sendMessage
(
const
prompt
=
'
Write a python version of bubble sort. Do not include example usage.
'
)
const
response
=
await
oraPromise
(
api
.
sendMessage
(
prompt
),
{
text
:
prompt
})
return
response
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment