TheComamba / UnKenny

A FoundryVTT module providing NPCs with artificial intelligence.
MIT License
3 stars 5 forks source link

Make module configurable #19

Closed TheComamba closed 11 months ago

TheComamba commented 1 year ago

This might be especially interesting if we want to support several languages.

TheComamba commented 11 months ago

Yes, we can. Although it is not large.

TheComamba commented 11 months ago

I think we should offer the user choice of

Armandeus66 commented 11 months ago

If there were an option to send to chat using "/talk" we could integrate this with Talking Actors, which allows us to assign a token in a scene with an AI voice from an Elevenlabs subscription API. https://github.com/acd-jake/acd-talking-actors

TheComamba commented 11 months ago

@Armandeus66 And all we'd have to do is offer the option to add a /talk at the beginning of the reply, correct? That sounds brilliant! Thanks for the input.

TheComamba commented 11 months ago

@Armandeus66 I implemented the functionality with version 0.1.2. Could you verify that it works as expected? I do not have an Elevenlabs subscription. 🙂

Armandeus66 commented 11 months ago

Hi! Thanks for being interested in this!

OK, here are my results.

I made an actor and set its Uncanny text to "This character is a typical adventurer." I first made sure that Talking Actors worked properly before creating and using the macro. (You must set it up on a scene, using an actor-linked token, and select the token before typing "/talk Speak this." in chat.)

Both times I executed the macro, asked, "Please introduce yourself." and got a response. The first chat AI could introduce itself briefly, and the second told me an irrelevant story and was cut off after a character limit seemed to have been reached. On the first try, before getting a response, my browser froze for about 15 seconds when using the first AI, and about 5 using the second.

However, the "/talk" was output as part of the chat message (meaning you could see it in the text), not as a chat command, and so the integration with Talking Actors was unsuccessful. (output = /talk I am also pretty good at writing fiction and short stories, too.) I copied the text and saw that sometimes there was a lot of empty space after /talk.

Also, there were what appeared to be some character code problems with the first AI. The first characters of a word were switched to Chinese/Japanese characters, and the period was 2-byte Japanese also. (output = 我 nwere some funny memories of my childhood that were very much alive today。) Another thing is that it appended text emoji such as :)) which would affect what the Elevenlabs might say. (output = If you'd ike see it again soon you'll be glad you're here anyway! :)) )

The cheapest Elevenlabs subscription that gives you an API key is $5 a month, so it's not expensive just to test it for one month and quit.

TheComamba commented 11 months ago

Thanks for the report!

Yeah, the first model is a bit of a weirdo. I can confirm that it takes somewhat longer to generate Tokens, and they often contain non-Ascii characters and bizarre content. Good thing the model is configurable now.^^

I have the growing suspicion that the way I generate the chat messages somehow bypasses the text macro handling of foundry. I will investigate.

But the model is configurable now, so I will track this in the new issue #27.