Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix latitudegames#15 in another way by removing textEncoder dependency
By using the Buffer class in this way, you can encode and decode strings as UTF-8 without using the TextEncoder and TextDecoder classes. This can be useful if you need to support earlier versions of Node.js that do not have these classes in the util module.
- Loading branch information
1831e5b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems to still pass tests in node 16 please test in 12 if that's what you use and if it works will bump npm
1831e5b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this fixed my issue. When using the actual gpt-3-encoder npm library, in my environment I get the error
failed to execute source for 'node_modules/gpt-3-encoder/Encoder.js': ReferenceError: 'TextEncoder' is not defined at node_modules/gpt-3-encoder/Encoder.js:33:23(86)
. But with this fork, it now works with no errors. I don't know exactly what version of Node.js is being used in my environment, as I am using Atlas App Services to host my application, but I assume it's an older version.1831e5b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm Im not sure I pushed to npm yet do you know if you used this branch of the npm version?
1831e5b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now I'm targeting the master branch of this repo, specifically at this commit. Here's the dependency I added to my package.json:
1831e5b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm actually getting an error when I try to install this GitHub repo within my GitHub Actions CI pipeline:
I tried changing the line in my package.json to the below, but I'm still getting the same error.
So, I think I'll need to wait until you push this commit to npm.
1831e5b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok Still passes tests published 1.3.0 for this
1831e5b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/syonfox/GPT-3-Encoder
Ok, i updated the read me as well if you feel inclined let me know how you set up the working pipeline that seems useful I have we could maybe add an example to the usage docs.
1831e5b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, it was very nice of you to push the changes so quickly. I added your package directly from the npm registry, and it is now installing without errors in my GitHub Actions CI environment!
I'm happy to share how I set up the pipeline, but I'm not sure if any of it would be relevant to your usage docs. The actual installation of my project's node packages is a pretty simple part of my pipeline. I just run
npm ci
, and it installs all the node packages into my CI environment. I do happen to be using node version 14 in the environment, if that's useful to know.1831e5b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, the GitHub tests are set to node 12 and node 16 so if they pass and yours works I say we are golden. I spent the last little bit touching up some stuff and adding browserify support so we can use a single 2.5mb bundle in the browser to do this on the client. If you feel inclined let me know if the 1.4rc2 works there is a change in how I load the blob of characters.
1831e5b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, I just updated to 1.4rc3, and everything's working correctly for me.