realcoloride/node_characterai

Error with history

Closed this issue · 2 comments

When using history, I am getting an error from this line in chat.js

const ai = continueBody.participants.find((participant) => participant.is_human === false);

The error:

[node_characterai] Puppeteer - Done with setup
[node_characterai] Puppeteer - Eval-fetching is an experimental feature and may be slower. Please report any issues on github
Error:  TypeError: Cannot read properties of undefined (reading 'find')

My code:

const CAI = require('node_characterai');
const client = new CAI();
await client.authenticateWithToken('token');
const chat = await client.createOrContinueChat('char id', 'hist id);
const response = await chat.sendAndAwaitResponse("Hey!", true);
console.log(response.text)

This only happens when I use history.

Found another thing, the history it created has the (I think old fashion version) id different, it looks more like a character id than a history id

edit: it also works with the weird id, the id it created a chat with is this jWlp4WyZfBvQAwWS0Op2OvPYW_QJbsnpOjyILLjfusw, all the others are similar to this 2efa7c13-8f06-415b-b9e7-99cefbb5c0b0 (when created by me)

edit 2: i see, chat v1 works fine with the api, chat v2 doesn't. Any plans on supporting chat 2?

Hello, I will investigate on this issue.

As of chat v2 (neo), I will think of it. This could probably cause some compatibility issues with older versions but I think it might be benefic. However, it could require for me to do a big rewrite.

Cheers