What happens when the user creates a loop with their input?

Let’s say the user is looking for a document.

The bot correctly finds one matching the user’s criteria and provides a link to it, as it should based on the story created.

But then the user says they want another one.

I can write a function that provides the next document in the bot’s results, but I also have to extend the story to make sure the bot can respond correctly.

But then the user says they want another one - once again.

And again.

Obviously I can’t write stories to match every number of rejection by the user. How can I make the program understand that this is a loop and go back to the previous stage of the story?

And what happens if the user says “okay, the one before the previous one was the best, give me that”? Can I store all the elements in the slots without defining in advance how many of these elements will appear in a loop like this?

Thanks.

Hi @ggabor i think for the last thing you described you can use knowledge bases: Knowledge Base Actions

As for the “next document” - you can just write one story with a “next” intent that executes an action to retrieve the next document - that should work fine multiple times.