Alexmhack/Django-Rasa-Bot

session persistance with django

greenhats2110 opened this issue · 4 comments

hi,

After integrating django with rasa chatbot, on clearing the session of the django page, the rasa chat does not reload its session (Rasa), session remains same for all users..
Kinldy assist us, in solving the issue..

Which chat widget are you using for rasa ?

Hi
We are using rasa webchat from rasa githun and react chat widgets

Checkout Websocket-Channel, this is what is written over there,

By default, the socketio channel uses the socket id as sender_id, which causes the session to restart at every page reload. session_persistence can be set to true to avoid that. In that case, the frontend is responsible for generating a session id and sending it to the Rasa Core server by emitting the event session_request with {session_id: [session_id]} immediately after the connect event.

Since you are using rasa webchat widget, you can try sending customData with another session_id every time you want to clear the rasa session, maybe you can send some random strings as rasa session_id in the customData then whenever user logs out or sessionid is cleared you can change the session_id also.

I haven't tested the above solution due to lack of time, but you can test and let me know if this has worked.