Closed josephshenjs closed 1 month ago
This project is undergoing a major revamp; closing out old issues as part of the prep process.
The chatgpt
package is pretty outdated at this point. I recommend that you use the openai package or the openai-fetch package instead.
Verify latest release
chatgpt
releaseVerify webapp is working
Environment details
Node.js v18.16.0
Describe the Bug
I am not able to run a simple example. Anyone can help?
const regexes = new RegExp(this.patStr, "ug"); ^
SyntaxError: Invalid regular expression: /('s|'S|'t|'T|'re|'rE|'Re|'RE|'ve|'vE|'Ve|'VE|'m|'M|'ll|'lL|'Ll|'LL|'d|'D)|[^\r\n\p{L}\p{N}]?\p{L}+|\p{N}{1,3}| ?[^\s\p{L}\p{N}]+[\r\n]|\s[\r\n]+|\s+(?!\S)|\s+/: Invalid property name in character class at new RegExp ()
at _Tiktoken.encode (file:///home/jo/.npm/_npx/060caca6003d4dba/node_modules/js-tiktoken/dist/chunk-THGZSONF.js:76:21)
at encode (file:///home/jo/.npm/_npx/060caca6003d4dba/node_modules/chatgpt/build/index.js:11:36)
at ChatGPTAPI._getTokenCount (file:///home/jo/.npm/_npx/060caca6003d4dba/node_modules/chatgpt/build/index.js:458:12)
at ChatGPTAPI._buildMessages (file:///home/jo/.npm/_npx/060caca6003d4dba/node_modules/chatgpt/build/index.js:422:48)
at ChatGPTAPI.sendMessage (file:///home/jo/.npm/_npx/060caca6003d4dba/node_modules/chatgpt/build/index.js:226:59)
at CAC. (file:///home/jo/.npm/_npx/060caca6003d4dba/node_modules/chatgpt/bin/cli.js:97:29)
at CAC.runMatchedCommand (file:///home/jo/.npm/_npx/060caca6003d4dba/node_modules/cac/dist/index.mjs:610:34)
at CAC.parse (file:///home/jo/.npm/_npx/060caca6003d4dba/node_modules/cac/dist/index.mjs:537:12)
at main (file:///home/jo/.npm/_npx/060caca6003d4dba/node_modules/chatgpt/bin/cli.js:130:9)