Issue regarding the last message sent by the user in Session memory

Hello,

I am a new Botpress user and have some issue regarding the last message sent by the user which is stored in the memory. According to Botpress documentation:

https://botpress.com/docs/main/memory

Essentially the webpage states the following:

###### Session Memory

The session store is alive for the duration of the user’s session. How long is that? Well, it depends on the setting of sessionIntervalTimeout in botpress.config.json. )
(Currently this is set to 30 m.)

This is also where we keep the last messages sent by the user. This information is used by the Decision Engine to better understand the user’s will and to avoid repeating meaningless stuff.

-------------------------------------------------------

But, I want these variables also to assume current values obtained from the user but due to this functionality it takes the previous values and it leads to confusion.
Please note that I am not using any webchannel for this purpose but only testing a new bot.
Kindly let me know how to sort this issue.

Stated in a different way I would like to know the following:
Which variables are reset when the “create new session” button is used in the debugger? And how can the same functionality be achieved via Actions in the bot? Essentially. I would prefer to get the same functionality provided by the “create new session” button but using the nodes or implemented as an action.

Another related question:
What is the difference between ResetSession function and the create new session button in the debugger?

Thanks a lot,
Regards,
Vishwa

Hey @Vishwa

You can use the “Reset Session” Action. This will effectively clear the Session memory for the current user.

The Create New Session button will create a new Session and a new User.

1 Like

Hello @spgin
Thanks for your reply.

I could not locate the “Reset Session” action which you have mentioned.
I am enclosing a screenshot of what I see in the debugger.

I would appreciate your inputs.

Regards,
Vishwa

The Reset Action is available for your flow nodes.

Just create a Standard Node, and add an Action:

1 Like

Hello @spgin
Thanks for your response.

I remember trying this but this was not resetting the last user message stored. Hence, while testing/ debugging the bot if I restart the conversation, the NLU uses the previous values.

In order to overcome this problem, I tried the following custom action function.


“use strict”;
const resetFlow = () => {
event.state.session.extractedSlots = {};
event.state.temp = {};
event.state.session.slots = {};
event.state.session.lastMessages = {};

};
return resetFlow();


I have taken this code from Temp memory & end flow 11.8.4 - #8 by abdelazizelesh and modified a bit.

This code is able to remove the last user messages. It is working fine. But, I would like to know if this causes any disruption to the NLU functionality. Is this right way to overcome this issue?

While performing bot testing user messages will be repeated in consecutive tests. I guess it is expected that the bot should use the latest message/user input/values and not the previous values as considered by the current NLU. How can this be achieved without using an action like resetFlow() shown above?

Thanks,
Vishwa