irsat000 / CAI-Tools

82 stars 22 forks source link

Issue with Duplicating/ Importing Chat #46

Closed SolsticeX2 closed 5 months ago

SolsticeX2 commented 5 months ago

Hi! I'm trying to duplicate/ import a very long chat because the original chat window got buggy and suddenly can not generate new responses anymore. During the process of replication, I found that the process stops after a specific message and is unable to continue. The same happens if I download the offline history and import it. I was wondering what could be causing the problem.

屏幕截图 2024-05-29 033229 屏幕截图 2024-05-29 033240
irsat000 commented 5 months ago

Okay, this is a CAI error message I didn't know existed. Could you right click, copy object and paste here again? This isn't the full version.

Paste here IF this is a specific point that it keeps giving error at. Must be repetitive. Because error says code 500, which is server error, not client(you) error. Specifically "Internal Server Error". So it may happen because it's simply way too much message and somewhere the server throws an error.

SolsticeX2 commented 5 months ago

<AioRpcError of RPC that terminated with: status = StatusCode.UNKNOWN details = "response not ok. {"error":{"code":500,"message":"unhandled errors in a TaskGroup (1 sub-exception)"}}" debug_error_string = "UNKNOWN:Error received from peer {created_time:"2024-05-29T10:20:48.049888972+00:00", grpc_status:2, grpc_message:"response not ok. {\"error\":{\"code\":500,\"message\":\"unhandled errors in a TaskGroup (1 sub-exception)\"}}"}"

content.js:876 CAI Tools retrieved font settings: {fontSize: '16', fontStyle: 'default'} _app-4b165e9e666fbafb.js:20 onClick is deprecated, please use onPress (anonymous) @ _app-4b165e9e666fbafb.js:20 onClick @ _app-4b165e9e666fbafb.js:58 (anonymous) @ _app-4b165e9e666fbafb.js:1321 (anonymous) @ _app-4b165e9e666fbafb.js:1321 eB @ framework-09a26a95bf54b83b.js:25 eH @ framework-09a26a95bf54b83b.js:25 (anonymous) @ framework-09a26a95bf54b83b.js:25 re @ framework-09a26a95bf54b83b.js:25 rt @ framework-09a26a95bf54b83b.js:25 (anonymous) @ framework-09a26a95bf54b83b.js:25 uP @ framework-09a26a95bf54b83b.js:25 eM @ framework-09a26a95bf54b83b.js:25 ru @ framework-09a26a95bf54b83b.js:25 tB @ framework-09a26a95bf54b83b.js:25 tD @ framework-09a26a95bf54b83b.js:25 a @ _app-4b165e9e666fbafb.js:21 content.js:283 FINISHED (19029) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, …] content.js:2660 Cloning: (19029) [{…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, …] content.js:2758 https://old.character.ai/chat2?char=zitOTgYr191cBDnMMvTIg5JLWoaO7dKI-2zoAerKZsM&hist=814009c8-d137-4735-a6c8-24ca6c7fbdd2 https://character.ai/chat/zitOTgYr191cBDnMMvTIg5JLWoaO7dKI-2zoAerKZsM?hist=814009c8-d137-4735-a6c8-24ca6c7fbdd2 zitOTgYr191cBDnMMvTI…aO7dKI-2zoAerKZsM:1 Uncaught (in promise) Error: A listener indicated an asynchronous response by returning true, but the message channel closed before a response was received content.js:3047 WS Data: {command: 'neo_error', request_id: '46c3f494-e96c-4cfe-8d71-0c16b700ac30', comment: '<AioRpcError of RPC that terminated with:\n\tstatus … errors in a TaskGroup (1 sub-exception)\"}}"}"\n>', error_code: 500, sub_code: null}command: "neo_error"comment: "<AioRpcError of RPC that terminated with:\n\tstatus = StatusCode.UNKNOWN\n\tdetails = \"response not ok. {\"error\":{\"code\":500,\"message\":\"unhandled errors in a TaskGroup (1 sub-exception)\"}}\"\n\tdebug_error_string = \"UNKNOWN:Error received from peer {created_time:\"2024-05-29T10:20:48.049888972+00:00\", grpc_status:2, grpc_message:\"response not ok. {\\"error\\":{\\"code\\":500,\\"message\\":\\"unhandled errors in a TaskGroup (1 sub-exception)\\"}}\"}\"\n>"error_code: 500request_id: "46c3f494-e96c-4cfe-8d71-0c16b700ac30"sub_code: null[[Prototype]]: Objectconstructor: ƒ Object()assign: ƒ assign()length: 2name: "assign"arguments: (...)

Sorry, I'm not too good with codes so I'm not sure what exactly you need to see. I pasted a part of the the log here that I think is related to the issue. Let me know if there's more than I can do. Thank you.

irsat000 commented 5 months ago

That's a relief, it has nothing to do with the creation of the chat. It has something to do with the way WebSocket connection functions, it's a way for machines to talk to each other fyi. Apparently it timeouts or something similar, like faltering internet connection, CAI server load issues. Simply the WebSocket closes because it's fragile piece of work. It's bound to happen when duplicating a book sized chat, touch some grass hahaha.

When I come up with a potential fix, would you be kind enough to test it out as unpackaged extension? You are not the only one experiencing it, I had some other people contacting me about this with similar length chats. But I had no way of identifying or replicating the issue for obvious reasons. You did great by showing me the console.

SolsticeX2 commented 5 months ago

Of course. Thank you so much for taking the time to work on this. I will be more than happy to test it out for you. Please don't hesitate to reach out once you come up with a fix. I have chat logs of various sizes saved so I can potentially test out a limit for the maximum amount of messages allowed before this problem occurs....

irsat000 commented 5 months ago

Alright, even better news. I tested with an infinite loop since I don't have such chats. I got the same error.

The good news is, my web socket is not at fault at all, their server can't process just one little message at some point when it normally can just fine. My web socket is still open and functioning. So it can continue where it's left off just fine. Should be fixed soon with some code adjustments.

SolsticeX2 commented 5 months ago

Great! Looking forward to it. Thank you!

irsat000 commented 5 months ago

Testing is a pain. There is 4 different errors, three are solved which includes yours. They are slight different error messages, that's all.

The 4th one happened once so I implemented a better system. Testing again with 15k messages chat. Let's see if it works, I will time skip by sleeping this time hehe.

SolsticeX2 commented 5 months ago

Hi! I just tested out the new extension package. I noticed a few things.

  1. I tried out the new chat duplication option. It is now able to fully duplicate the 19000 of my messages

  2. However, the duplicated messages didn't all end up in the same chat box. After a certain period of time(1 to 3 hours), the replication process will be cut off in the previous chat box and start a new chat box to continue. (For example, the 1 to 4000 messages will be in one chat box, and 4001 to 7500 will be in another, and 7501 to 13000 will be in another... I don't think there's a specific time in which it will stop in the previous chat box and move on to the next, neither is there a specific number of characters...I will paste the web console below so you can take a look at it.)

  3. I also tested out the CHAT GPT summary option, which I don't think is working very well yet...For starters, I wasn't able to figure out how to select the range of the messages I wanted it to summarize, and I think the maximum length might be # of characters related. Also, the current summary just seems to be summarizing/shortening each individual message instead of summarizing what's going on in the grand scheme of things. (I'm using CHAT GPT 4o by the way, if it makes any difference.)

Here is the console below:

屏幕截图 2024-05-31 214342 屏幕截图 2024-05-31 214428 屏幕截图 2024-05-31 214440 屏幕截图 2024-05-31 214451
irsat000 commented 5 months ago

Lmao I thought I deleted the comment before you saw it.

Yeah I fixed the issues with duplication, it's just I keep forgeting some tiny codes. The one I am working on seems to be perfected.

Also GPT summary is still being developed lol, quit using it. It's a premium one, but I will make Import Character free, and make an another free feature right afterwards (saving and naming conversations somewhere else, because tbh native history is really bad, chats get lost too easily)

SolsticeX2 commented 5 months ago

Ah well, I thought the website just went buggy and ate your messages, but I retrieved the packaged extension through my email.

Anyway, wonderful news. Thank you for working on those. I was also wondering for the new features would it be possible to develop something that allows us to delete individual chat boxes? I think the only current way to do it is to scroll to the start to rewind and delete everything.

irsat000 commented 5 months ago

I don't think there is a way to delete the chat itself, they simply didn't put the option. Rewinding to start seems to be the only option.

The extension could hide the chat from history but the new feature I mentioned would make it unnecessary.

Since I have more work to do on the extension, I could give the one I am using tomorrow. If you are still willing to test it and wait that long. Just so you know, I made a 15k chat with some code so don't feel obligated because you said you would try it.

SolsticeX2 commented 5 months ago

Oh, I don't mind testing it out. Keep me updated if you will. Thanks a million.

irsat000 commented 5 months ago

CAI-Tools-Test.zip

Let's hope this one works. I didn't get a problem.

SolsticeX2 commented 5 months ago

I tested it out, it works perfectly for me too! Thank you!