OvidijusParsiunas / deep-chat

Fully customizable AI chatbot component for your website
https://deepchat.dev
MIT License
1.27k stars 175 forks source link

How to set messages in the chat list #75

Closed TasonIV closed 5 months ago

TasonIV commented 6 months ago

Unfortunately, I heard that the addMessages method was removed in version 1.4.6. In my project, a wake-up function was implemented, which requests the interface and renders a message "Hey, you haven't talked to me for a long time. Let me tell you a job" when no input is detected within 1 minute. Previously, I used the addMessages method to implement it. Now, after deleting this method, how should I add messages? image

OvidijusParsiunas commented 6 months ago

Hi @TasonIV.

The reason why addMessage method was removed is because the other properties were able to do everything that it did, such as initialMessages, hence there was no real purpose to overcomplicate the offered API and maintain another method.

Your use-case is very unique and something that usual chats don't exhibit. I can perhaps add an unofficial property called _addMessage that you can use, but I will not add it to the documentation for the aforementioned reasons. I will update this thread when the update has been done.

OvidijusParsiunas commented 6 months ago

The _addMessage method is now available in the deep-chat-dev and deep-chat-react-dev packages version 9.0.105. These packages work exactly the same as the core packages it's just their names are different and I will be including this method in the next core package release.

The _addMessage method itself works just like the old addMethod, except the name has an underscore to indicate that this is not one of the official methods. Thanks!

TasonIV commented 6 months ago

Thank you for your prompt response and understanding. We look forward to the next update. Wishing you a happy life!

OvidijusParsiunas commented 5 months ago

Hi, this has now been released in deep-chat and deep-chat-react package versions of 1.4.7.