realcoloride / node_characterai

Unofficial Character AI wrapper for node.
https://beta.character.ai/
347 stars 73 forks source link

Character AI takes far too long to load #68

Closed Aadit420 closed 1 year ago

Aadit420 commented 1 year ago

I currently am using a project called "Desktop-waifu" by "Alizer-Uncaged". Long story short, I had a few issues, and after ironing them out, I experience character AI taking too long to load character data. it gets stuck at authenticating. This project uses both Python and NodeJs. Essentially, the voice gets recorded and transcripted using openAI(I changed it to WhisperAI) in Python, then the transcripted text gets sent to CharacterAI through your service. After receiving the response from the bot, the response will be sent to a TTS service called "eleven labs", which will convert the received string of text to speech. At the same time, Vtube studio will be connected. Once the TTS speech is played. the mouth of the model in Vtube studio will be moved slightly

I've tried editing runner.js (one that shows authenticating status) and changed AuthenticateAsGuest to AuthenticateWithToken (i followed caps as given here) and pasted my access token in the brackets. it still doesn't work

Parking-Master commented 1 year ago

Hello. This is a temporary issue caused by an API change from the official Character.AI site. This issue is still looking for a proper solution. But for now, follow the steps of this comment.

I hope this solves your issue. If it doesn't work also try doing this:

Add this line:

page.deleteCookie();

Right after this line:

const client = await page.target().createCDPSession();
await client.send('Network.clearBrowserCookies');
await client.send('Network.clearBrowserCache');

The goal of both of these methods is to clear any browser data in chromium from puppeteer. I still don't know why this works but it is most likely an API change on the official website and local browser cache must be messing up authentication.

In "node_modules/node_characterai/requester.js" line 108.

If that doesn't work wait until the real owner responds with more information.

Aadit420 commented 1 year ago

I'm unable to clear cache with the new tab (Error "Status breakpoint" in chrome) How do I solve this? Or should I wait for the owner of this project to respond?

realcoloride commented 1 year ago

Hello, I am aware of this ongoing issue and apologize for it. But CharacterAI's API keeps changing and adding barriers that make it harder to do scrapping.

In the meantime, you should try @Parking-Master fix and tell me how it goes. I will release an urgent patch soon.

This issue is linked to #62 aswell.

Parking-Master commented 1 year ago

@realcoloride thank you! I really wish Character.AI wouldn't have changed their authentication method. I have also discovered that loading beta.character.ai in any puppeteer page (even when clearing storage data) hangs when loading. I don't know why they are changing it but I hope it can be fixed easily and ASAP.

realcoloride commented 1 year ago

Hello, I've tried using Parking-Master's fix and it seems to be working well. I will push an update with their fix.

Parking-Master commented 1 year ago

@Aadit420 have you tried clearing the data manually like in the linked comment?

realcoloride commented 1 year ago

Commit https://github.com/realcoloride/node_characterai/commit/880515fd08173e2e8972e4d62ca1e8962072e77d

Hello, experimental patch update 1.1.8 was pushed, update the package & please let me know if it works for you.

Aadit420 commented 1 year ago

I did, but the tab shows an error and the site cannot be accessed (Error: Status breakpoint)

Parking-Master commented 1 year ago

@Aadit420 ok, wait until the changes from @realcoloride's push are successful, then try reinstalling the package. Let me know how it goes :)

realcoloride commented 1 year ago

Hello, I also want to point out that if it does not WORK the first time, try deleting your node_modules folder and doing npm i again to clear any potential cache files.

Parking-Master commented 1 year ago

@realcoloride thanks for the update and extra info. We'll let you know how it goes after reinstalling it.

Aadit420 commented 1 year ago

dum question but is there any special command to install this? I'm scared it's not gonna install this new update

realcoloride commented 1 year ago

What command do you need to know exactly?

Aadit420 commented 1 year ago

the install command

Parking-Master commented 1 year ago

@Aadit420 npm install node_characterai

or rm -rf node_modules; npm i

realcoloride commented 1 year ago

Side question, have you been using an older version of node_characterai the whole time? You should update the package frequently or look in this issue tab whenever you encounter issues.

Aadit420 commented 1 year ago

I have no idea, the project I use uses a venv and i have no idea how to npm install in this venv But I think so, but the batch file constantly installs node_characterai

Edit: I tried to reinstall node-characterai but it's throwing 'module not found" error

realcoloride commented 1 year ago

@Aadit420 I've contacted the owner of the repository you are talking about to inform them about the issue. They currently have old builds of node_characterai located in (version 1.1.3, which is really old!) https://github.com/AlizerUncaged/desktop-waifu/tree/master/character_ai ./chararacter_ai/

What you should do currently is replace the files from the code source directly.

Parking-Master commented 1 year ago

@Aadit420 typo, the dash is supposed to be an underscore lol

Aadit420 commented 1 year ago

Oh goodness, how do i do this? I'm trying to reinstall node_characterai but it's giving me 'module not found' errors

Aadit420 commented 1 year ago

@Aadit420 typo, the dash is supposed to be an underscore lol

yes, i checked, all the commands I ran had the underscore sry

Parking-Master commented 1 year ago

Can you paste the exact command you ran?

Aadit420 commented 1 year ago

npm install node_characterai

it's stated in your readme.md (description of the repo)

Parking-Master commented 1 year ago

Wow, that's the strangest thing ever. Module not found means it couldn't find the requested package, even know it exists

realcoloride commented 1 year ago

Go in the package chrome_JXrQEXQkVX And download directly from the source. explorer_v2UXjLb1va Then replace the old characterai files with the new ones.

I don't exactly know is there are particular changes to make in order to make it correctly function with the project, however I have contacted the owner of the repository and will wait for their answer for an official patch.

Parking-Master commented 1 year ago

Could you also paste the output of the command?

Parking-Master commented 1 year ago

@realcoloride good solution lol, I forgot about direct downloads

realcoloride commented 1 year ago

chrome_67NYa8x8b9 (Replace the files in this folder by the way)

Aadit420 commented 1 year ago

Could you also paste the output of the command? C:\Users\USER\Downloads\desktop-waifu-master\waifu\Scripts>npm install node_characterai node:internal/modules/cjs/loader:1085 throw err; ^

Error: Cannot find module 'C:\Users\USER\Downloads\desktop-waifu-master\waifu\Scripts\node_modules\npm\bin\npm-cli.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15) at Module._load (node:internal/modules/cjs/loader:928:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Node.js v20.0.0 node:internal/modules/cjs/loader:1085 throw err; ^

Error: Cannot find module 'C:\Users\USER\Downloads\desktop-waifu-master\waifu\Scripts\node_modules\npm\bin\npm-cli.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15) at Module._load (node:internal/modules/cjs/loader:928:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Node.js v20.0.0

C:\Users\USER\Downloads\desktop-waifu-master\waifu\Scripts>npm install node_characterai node:internal/modules/cjs/loader:1085 throw err; ^

Error: Cannot find module 'C:\Users\USER\Downloads\desktop-waifu-master\waifu\Scripts\node_modules\npm\bin\npm-cli.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15) at Module._load (node:internal/modules/cjs/loader:928:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Node.js v20.0.0 node:internal/modules/cjs/loader:1085 throw err; ^

Error: Cannot find module 'C:\Users\USER\Downloads\desktop-waifu-master\waifu\Scripts\node_modules\npm\bin\npm-cli.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15) at Module._load (node:internal/modules/cjs/loader:928:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Parking-Master commented 1 year ago

That appears to be errors from the desktop-waifu-master/waifu module that is using old package versions, not that it can't find the package itself.

Try running "npm rebuild" or "npm i"

Aadit420 commented 1 year ago

I replaced the files in that folder with yours, and I get this error

node js: Running on port 40102 with character 1CT5t0sTaxNEGEpB6E0OaDCiMkpLgwWO0RN8nH2BqxU node js: node:internal/modules/cjs/loader:1042 node js: throw err; node js: ^ node js: node js: Error: Cannot find module 'jimp' node js: Require stack: node js: - C:\Users\USER\Downloads\desktop-waifu-master\character_ai\chat.js node js: - C:\Users\USER\Downloads\desktop-waifu-master\character_ai\client.js node js: - C:\Users\USER\Downloads\desktop-waifu-master\character_ai\runner.js node js: at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15) node js: at Module._load (node:internal/modules/cjs/loader:885:27) node js: at Module.require (node:internal/modules/cjs/loader:1105:19) node js: at require (node:internal/modules/cjs/helpers:103:18) node js: at Object. (C:\Users\USER\Downloads\desktop-waifu-master\character_ai\chat.js:3:14) node js: at Module._compile (node:internal/modules/cjs/loader:1218:14) node js: at Module._extensions..js (node:internal/modules/cjs/loader:1272:10) node js: at Module.load (node:internal/modules/cjs/loader:1081:32) node js: at Module._load (node:internal/modules/cjs/loader:922:12) node js: at Module.require (node:internal/modules/cjs/loader:1105:19) { node js: code: 'MODULE_NOT_FOUND', node js: requireStack: [ node js: 'C:\Users\USER\Downloads\desktop-waifu-master\character_ai\chat.js', node js: 'C:\Users\USER\Downloads\desktop-waifu-master\character_ai\client.js', node js: 'C:\Users\USER\Downloads\desktop-waifu-master\character_ai\runner.js' node js: ] node js: }

btw yes i type slow, and yes,will do

realcoloride commented 1 year ago

As any related problem from node_characterai's end (specifically this issue) is solved, this issue will be closed.

For all users coming from desktop waifu, please read https://github.com/realcoloride/node_characterai/issues/68#issuecomment-1637294108 and https://github.com/realcoloride/node_characterai/issues/68#issuecomment-1637294647 The issue is that they're running an old broken version of this package. Replace the files from source directly and it should work.

Any related issue to their package should be reported to them. The issue will not be locked however.

In case of any problem related to node_characterai, please re-open a new issue.

Parking-Master commented 1 year ago

@Aadit420 lol on typing slow, and also you just need to install the package "jimp":

npm i jimp --save

Aadit420 commented 1 year ago

That appears to be errors from the desktop-waifu-master/waifu module that is using old package versions, not that it can't find the package itself.

Try running "npm rebuild" or "npm i"

I still get this error

(waifu) C:\Users\USER\Downloads\desktop-waifu-master\waifu\Scripts>npm rebuild node:internal/modules/cjs/loader:1085 throw err; ^

Error: Cannot find module 'C:\Users\USER\Downloads\desktop-waifu-master\waifu\Scripts\node_modules\npm\bin\npm-cli.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15) at Module._load (node:internal/modules/cjs/loader:928:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Node.js v20.0.0 node:internal/modules/cjs/loader:1085 throw err; ^

Error: Cannot find module 'C:\Users\USER\Downloads\desktop-waifu-master\waifu\Scripts\node_modules\npm\bin\npm-cli.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1082:15) at Module._load (node:internal/modules/cjs/loader:928:27) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12) at node:internal/main/run_main_module:23:47 { code: 'MODULE_NOT_FOUND', requireStack: [] }

Node.js v20.0.0

running in venv so that the project's nodejs stuff get's affected

Parking-Master commented 1 year ago

Seems like every command you run with npm keeps throwing the same error. You're already on the right path by downloading directly from the source. Download "jimp" like I said in my previous comment then it should work

Aadit420 commented 1 year ago

Seems like every command you run with npm keeps throwing the same error. You're already on the right path by downloading directly from the source. Download "jimp" like I said in my previous comment then it should work

I reinstalled the project, installed the latest node_characterai, and set it up how I did it (Just without the temporary fix) and everything runs fine until characterAI still doesn't load the character details (Stuck at authenticating) Should I get to the temporary fix?

Error: You are in a virtual environment: "C:\Users\USER\Downloads\desktop-waifu-master\waifu"

C:\Users\USER\Downloads\desktop-waifu-master\waifu\lib\site-packages\whisper\timing.py:58: NumbaDeprecationWarning: The 'nopython' keyword argument was not supplied to the 'numba.jit' decorator. The implicit default value for this argument is currently False, but it will be changed to True in Numba 0.59.0. See https://numba.readthedocs.io/en/stable/reference/deprecation.html#deprecation-of-object-mode-fall-back-behaviour-when-using-jit for details. def backtrace(trace: np.ndarray): (133.9 MB) Unzipping...(133.9 MB) Already exists! Unzipping...websocket connected! node js: Running on port 40102 with character SzmRcZ6-F9FZdPDGTN0H7MB5_8iHflYY9tIVXi5C01E node js: Authenticating.... node js: [node_characterai] Puppeteer - This is an experimental feature. Please report any issues on github. node js: A client connected Welcome back, to speak press RIGHT_CTRL. You (mic [Transcribing (51.2 kB)]) > C:\Users\USER\Downloads\desktop-waifu-master\waifu\lib\site-packages\whisper\transcribe.py:114: UserWarning: FP16 is not supported on CPU; using FP32 instead warnings.warn("FP16 is not supported on CPU; using FP32 instead") You (mic) > Hello. node js: Unable to send message. node js: CharacterAI is still fetching character data! node js: If it's taking far too long please submit an issue.

Parking-Master commented 1 year ago

@Aadit420 I'm glad to hear it's finally running the latest version. I don't know why the new fix didn't work for you but you can still try out the manual fix to see if it works.

https://github.com/realcoloride/node_characterai/issues/62#issuecomment-1625507457

Aadit420 commented 1 year ago

Same as before, a chrome tab opens but an error in that tab is produced Error: Status breakpoint

Parking-Master commented 1 year ago

@Aadit420 annoying. Where is the error, is it in the console or on the page?

Aadit420 commented 1 year ago

on the chromium tab Screenshot (36)

Should I change the site that summons this tab to beta.character.ai and find a way to clear cache from there?

Parking-Master commented 1 year ago

https://stackoverflow.com/questions/69522753/status-breakpoint-chromium-preventative-measures

is likely an unintended Chromium bug or an unexpected state caused by your application that may or may not be supported by Chromium

Looks like it leads back to node_characterai. I think it may be caused by the timeout of the authentication or an old version of chromium, or even the desktop-waifu package messing up the environment.

Aadit420 commented 1 year ago

Huh, strange... I may need to update chrome... otherwise I have no idea what to do

Parking-Master commented 1 year ago

@Aadit420 lol, I know what that feeling is like. It may be the only option you have until the owner of desktop-waifu responds to that other issue you opened.

Aadit420 commented 1 year ago

The dev(s) aren't responding to my issue over there, so i contacted you btw thanks for being so responsive btw chrome is up to date

Parking-Master commented 1 year ago

@Aadit420 No problem ;)

The owners may not respond immediately but you have to wait at least 2-3 days on some repositories for a response.

Aadit420 commented 1 year ago

Yep, alright. I can wait