I have a simple chatterbot set up where multiple users can chat at once and I'm not really sure how to implement the session manager to "sessionalize" the conversations.
This is my code:
from chatterbot import ChatBot
user_id = [USER_ID]
chatbot = ChatBot(
"Chatbot",
storage_adapter='chatterbot.storage.JsonFileStorageAdapter',
input_adapter='chatterbot.input.VariableInputTypeAdapter',
output_adapter='chatterbot.output.OutputAdapter',
database='./database.json'
)
response = chatbot.get_response([INPUT])
print(response)
Don't worry about how I'm getting the USER_ID or the INPUT, I just need to implement sessions for the bot and the docs page is rather confusing. Thanks.
Note: the USER_ID is a unique string.
Hi @GRA0007, I don't have a perfect example of this to provide at the moment. I've added a task to my to-do list for adding an example to the project documentation.
Right now there _is_ a working example of conversation session management in the Django extension module. You can take a look at that and it might provide some insight on how to set this up.
https://github.com/gunthercox/ChatterBot/blob/master/chatterbot/ext/django_chatterbot/views.py
The important part of this is the session id that is getting passed into the get_response method.
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Most helpful comment
Hi @GRA0007, I don't have a perfect example of this to provide at the moment. I've added a task to my to-do list for adding an example to the project documentation.
Right now there _is_ a working example of conversation session management in the Django extension module. You can take a look at that and it might provide some insight on how to set this up.
https://github.com/gunthercox/ChatterBot/blob/master/chatterbot/ext/django_chatterbot/views.py
The important part of this is the session id that is getting passed into the
get_responsemethod.