Comments (38)
@JamesVausch hello! It's been a while, but the update with all the fixes has been pushed. Please try it and let us know what happens!
from node_characterai.
@JamesVausch hello! It's been a while, but the update with all the fixes has been pushed. Please try it and let us know what happens!
I've tested it for a day and so far it went so smooth, although there are rare cases it takes a while to fetch which I guess the problem with cloudflare. Overall it's a very good version, thanks for the fix and improvement!
from node_characterai.
Doing that tomorrow. Thank you for your contribution.
from node_characterai.
@monckey100 could you run
npm list | grep node_characterai
and paste the output please?
from node_characterai.
@monckey100 I've never used chrome regularly as a personal browser, so how would you do that? Thanks for responding by the way
You create an account on a machine, probably also login to character.ai and you can grab the profile and put it on your server after you set it up:
"C:\Users\USER_NAME\AppData\Local\Google\Chrome\User Data"
then you just point your puppeteer setup to the profile folder.
https://stackoverflow.com/questions/53236692/how-to-use-chrome-profile-in-puppeteer
from node_characterai.
I'll try. I'll keep you updated
from node_characterai.
Hmm, weird issue. I don't use Replit, but perhaps I could try to help you there.
What is your node_characterai
version? and at which line of code would it cause this error?
from node_characterai.
Hmm, weird issue. I don't use Replit, but perhaps I could try to help you there.
What is your
node_characterai
version? and at which line of code would it cause this error?
It's the latest one, it wasn't giving that error the day before. I encountered this error yday, was working well 2 days ago.
here's a screenshot of the code and the console showing the error
After a while of waiting tho it works normally without errors so maybe it takes a while to authenticate? I'm not sure
from node_characterai.
I think this is caused by the cloudflare waiting room, needs investigation
from node_characterai.
@realcoloride also this is caused by the waiting room. At the end of the error, it shows "/cdn-cgi/challenge-platform/h/g/orchestrate/chl_page/v1" which is the challenge page after the waiting room is over just to verify you are human. I think this is caused by the waiting room also
from node_characterai.
Have you tried #72 ?
from node_characterai.
@realcoloride yes I can confirm it works. Sometimes it doesn't but this is basically the best thing I could come with. Sadly their website is extremely complex and you would need to work for Character.AI to fix any more problems
from node_characterai.
soo should I push your evaluate fix and commit #72? perhaps could you try reinstalling the whole thing and see if it works after?
from node_characterai.
@realcoloride yeah, that would be great. Thanks :)
from node_characterai.
@JamesVausch did the new update solve your problem? Please let us know and @realcoloride shall close this issue, thanks.
from node_characterai.
@JamesVausch I think the code you posted includes your auth token. Please remove and make sure in the future that when you post code, it doesn't have any personal info inside it.
My bad, thanks for pointing that out
from node_characterai.
@JamesVausch did the new update solve your problem? Please let us know and @realcoloride shall close this issue, thanks.
I'll test it later after work
from node_characterai.
1.1.8 is significantly faster in fetching the chat object but gives out bad string error, 1.1.9 however takes a while to fetch the chat object but it doesn't give you bad string error. either way both needs time before it works normally.
Still good I'll just have the bot login once the chat object has been fetched I think. Tysm for the fix too <3
from node_characterai.
@JamesVausch you're welcome and thanks for pointing that out! Glad it works now, and I'll still find some ways to make it faster in the future. :)
from node_characterai.
I'm getting the exact error with the latest build, I'm also using the plus paid version:
1|Amy | {
1|Amy | name: 'SyntaxError',
1|Amy | message: 'Bad string',
1|Amy | at: 2,
1|Amy | text: `{window._cf_chl_opt={cvId: '2',cZone: 'plus.character.ai',cTyp e: 'managed',cNounce: '28305',cRay: '7f7559a78f07275f',cHash: 'bfe2a9b8ae9284a', cUPMDTk: "\\/chat\\/streaming\\/?__cf_chl_tk=3AIke2BcKopDz0m0uGv_4y5S3RocsZryZMx kT6Wa80g-1692143535-0-gaNycGzNDuU",cFPWv: 'b',cTTimeMs: '1000',cMTimeMs: '0',cTp lV: 5,cTplB: 'cf',cK: "",fa: "/chat/streaming/?__cf_chl_f_tk=3AIke2BcKopDz0m0uGv _4y5S3RocsZryZMxkT6Wa80g-1692143535-0-gaNycGzNDuU",md: "IPQVrFSp4vihKTCptUX0jlD5 VjB8Kua6xxpwAyankTk-1692143535-0-AWNpLUXudujZVND6WOgeyGmfrIC37zAJyoc-8gc8hM8kn17 MWZXmoA1VVWKaPI0EH4AKoVUySu5mxkxryY49G42oUY3_5swtfDtLjP7KV0f5t4tftw8GfI3kZ1lOqsc tnkbDWmYp7a8fV3PDAnUENNhNGCQHUt9fr_W57e13zsn4R4pbbxjtVjkTHwDTgYgN4RpFFNPCFzcizck MWoojXTZ7lERR2Br_JbIhCBBeQ5-r7fK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(Dat e.now() / 1000),m: 'DdU0U5AePkyUC07cpAXyicKnjqQ0shfVYIcUMk/o26g=',i1: 'bDFEeG8U9 l6TlTgPo+20VA==',i2: 'S6mx8ZivYtpTbxGsxUFrLw==',zh: '3MzEEr4KLflmeMqd8UHKRwLX7Al BIHlHXAkcvB3KPTI=',uh: 'iqDROoHmWoS5vJW1eIV7QcCnG+o+Jh5QJJjlCQhkqMk=',hh: 'guxl0 cDtfq5w8RDPZeOzxqHMRcVcYMmnCHawN/xuD5c=',}};var cpo = document.createElement('sc ript');cpo.src = '/cdn-cgi/challenge-platform/h/b/orchestrate/chl_page/v1?ray=7f 7559a78f07275f';window._cf_chl_opt.cOgUHash = location.hash === '' && location.h ref.indexOf('#') !== -1 ? '#' : location.hash;window._cf_chl_opt.cOgUQuery = loc ation.search === '' && location.href.slice(0, location.href.length - window._cf_ chl_opt.cOgUHash.length).indexOf('?') !== -1 ? '?' : location.search;if (window. history && window.history.replaceState) {var ogU = location.pathname + window._c f_chl_opt.cOgUQuery + window._cf_chl_opt.cOgUHash;history.replaceState(null, nul l, "\\/chat\\/streaming\\/?__cf_chl_rt_tk=3AIke2BcKopDz0m0uGv_4y5S3RocsZryZMxkT6 Wa80g-1692143535-0-gaNycGzNDuU" + window._cf_chl_opt.cOgUHash);cpo.onload = func tion() {history.replaceState(null, null, ogU);};}document.getElementsByTagName(' head')[0].appendChild(cpo);}`
1|Amy | }
1|Amy | END CHAT Error!
from node_characterai.
@monckey100 could you run npm list | grep node_characterai
and paste the output please?
from node_characterai.
@monckey100 it does seem you are using the latest version. I'll do some more digging and keep you updated soon. Thanks
from node_characterai.
Ok, here's some info: I went to the url where that was inside that error, and it leads to here:
it's a valid page, and the beginning of the error starts with the content of that URL.
That's all I have for now, I'll keep you updated.
from node_characterai.
Also this
https://developers.cloudflare.com/fundamentals/get-started/reference/cdn-cgi-endpoint/
- JavaScript detection used by Cloudflare bot products (example.com/cdn-cgi/challenge-platform/)
It is definitely bot-specific. @realcoloride so much for using puppeteer, cloudflare can even detect bots there now
Tomorrow I will have to open puppeteer in a non-headless mode to see if it's redirecting to that page, if it is, I think it has something to do with a new script that detects bots from Character.AI.
This could also be helpful, @realcoloride:
https://stackoverflow.com/questions/51731848/how-to-avoid-being-detected-as-bot-on-puppeteer-and-phantomjs#54361485
from node_characterai.
Also this
https://developers.cloudflare.com/fundamentals/get-started/reference/cdn-cgi-endpoint/
- JavaScript detection used by Cloudflare bot products (example.com/cdn-cgi/challenge-platform/)
It is definitely bot-specific. @realcoloride so much for using puppeteer, cloudflare can even detect bots there now
Tomorrow I will have to open puppeteer in a non-headless mode to see if it's redirecting to that page, if it is, I think it has something to do with a new script that detects bots from Character.AI.
I used to get around cloudflare by importing an existing chrome profile, maybe that can be the new solution? it would require better documentation on setup. I'm not sure if it works any longer too.
Also with puppeteer extra stealth
from node_characterai.
@monckey100 I've never used chrome regularly as a personal browser, so how would you do that? Thanks for responding by the way
from node_characterai.
@monckey100 thanks! I'll check it out tomorrow.
from node_characterai.
On replit.com I hardcoded the puppeteer path to make it work and not get a cannot find chromium
or failed to launch browser process
error
puppeteerPath = '/nix/store/x205pbkd5xh5g4iv0g58xjla55has3cx-chromium-108.0.5359.94/bin/chromium-browser';
Also somehow I noticed that when I did npm audit fix -force
after installing the latest version of this package it fixed 7 moderate severity vulnerabilities but the package went back to 1.1.3 as can be seen here
I continued using the package and still added the puppeteerPath
I mentioned above and it fetches the chat object quickly. I've observed it also consume less RAM. I'm not sure whether if it's the audit fix or the 1.1.3 version itself. I might try 1.1.3 without an audit fix see if it still works the same.
from node_characterai.
@JamesVausch thanks for the extra info, I'll try it out soon
from node_characterai.
Yep, that's definitely the problem. I changed headless
to false
, and the page wasn't loading. Then I checked the page's dev console and a script that loads the characters had a 403 error.
I then went to that URL that gave the error, and it was blocked by cloudflare and there was a recaptcha. The source of this entire issue is that in the package, some code somewhere is requesting a page and parsing the content but throws an error when the content is HTML form (from redirecting to the challenge page).
from node_characterai.
I also tried adding in a chrome profile (wasn't signed in, just a chrome profile from my computer). It didn't work.
This whole issue can be solved if there is a way to stop cloudflare from detecting it is a bot. I have already tried using Firefox instead of chrome for puppeteer, no luck.
I appreciate help from anyone that has a solution to this.
EDIT: After I rolled back to v1.1.3 like @JamesVausch did, my script works! Glad to know this isn't a character.ai specific thing, and it can be fixed.
from node_characterai.
I also tried adding in a chrome profile (wasn't signed in, just a chrome profile from my computer). It didn't work.
This whole issue can be solved if there is a way to stop cloudflare from detecting it is a bot. I have already tried using Firefox instead of chrome for puppeteer, no luck.
I appreciate help from anyone that has a solution to this.
EDIT: After I rolled back to v1.1.3 like @JamesVausch did, my script works! Glad to know this isn't a character.ai specific thing, and it can be fixed.
I'm glad to hear it helped, tho how will it affect the newer versions?
from node_characterai.
@JamesVausch I'm going to do some digging around in requester.js and see what's changed that possibly makes it do this.
from node_characterai.
Hello again, I suspect that the newer versions have too much checks and redirections that cause long waiting times.
from node_characterai.
@realcoloride yep, and it's all in the requester.js
file. You could overwrite that file with the one from version 1.1.3 and check it. I'll test it myself too.
from node_characterai.
It's a lot better than overwriting the entire package with 1.1.3, it will remove newer necessary features.
from node_characterai.
@JamesVausch that's awesome to hear! :)
from node_characterai.
This issue can be closed since it has been resolved.
from node_characterai.
Related Issues (20)
- Which method should I use? HOT 2
- Add Auto Close Chromium Process in requester.js HOT 1
- Cannot statically analyse 'require(…, …)' in line 11 HOT 1
- Cannot create object HOT 1
- Cannot read properties of undefined (reading 'length')
- ProtocolError HOT 14
- Character AI - New TTS system HOT 16
- Chat history endpoints changed HOT 2
- authenticateAsGuest() fails with error: Failed to fetch a lazy token HOT 1
- is there a way to get the generated image from the ai? HOT 1
- Cannot read properties of undefined (reading 'status') HOT 7
- Feature request: Character information HOT 2
- Timeout ms HOT 7
- createOrContinueChat issue HOT 5
- module completely errors after 2 messages at relatively the same time HOT 1
- How do you install chromium? HOT 7
- need hep stuck with problem for 4 weeks 😭😭😭 HOT 1
- Multiple conversation HOT 3
- Error: Could not get the full reply because it was aborted. This happens often when the output was filtered for violent or explicit content. HOT 15
- Thinking about rewriting the whole package in TypeScript (2.0 roadmap) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node_characterai.