-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
vite2 + vue3 ReferenceError: __dirname is not defined #334
Comments
I don't think this error is likely to do with the Without more info, we won't be able to help you. |
the same error was encountered in other vue3 project
This is an error in the gpt-3-encoder dependency. So, click here: https://github.com/latitudegames/GPT-3-Encoder |
It looks like this code is trying to be used from a non-Node.js environment according to what Vite expects. That's the only reason why With that being said, https://github.com/latitudegames/GPT-3-Encoder has some problems, and I'm definitely looking to replace it. It has compatibility issues like this one, only support node.js, and it's not up-to-date. If anyone has a good alternative tokenizer (like a JS version of https://github.com/openai/tiktoken), please let me know. |
//const encoder = JSON.parse(fs.readFileSync(path.join(__dirname, './encoder.json')));
//const bpe_file = fs.readFileSync(path.join(__dirname, './vocab.bpe'), 'utf-8');
const encoder = require('./encoder.json')
const bpe_file = require('./vocab_bpe.json')
Enjoy |
Hi, thanks for the suggestions, but where can I find 'vocab_bpoe.json'? It's not in the repo. Do I need to convert vocab.bpe to JSON or can I find it somewhere else? Thanks a lot. |
@JamieMcDonnell @JerryCheng1 @classfang try the new version https://github.com/transitive-bullshit/chatgpt-api/releases/tag/v4.6.0 It replaces the troublesome gpt-3-encoder with a better dependency. |
Verify latest release
chatgpt
releaseVerify webapp is working
Environment details
vite2 + vue3 node=18.0
Describe the Bug
vite2 + vue3 ReferenceError: __dirname is not defined
The text was updated successfully, but these errors were encountered: