When I use some chatbots, I see it actively listen for a short period (2-5 seconds) before giving back an answer. With that, the bot can answer correctly when I send multiple message, e.g:
[0:00] Hi
[0:01] Can you tell me
[0:03] How to check my balance?
I am curious about the method behind that. Currently I think about debouncing in two ways:
-
The chatbot uses reset-on-input. When receiving new message during 5 seconds timeout, it stores the message and the timeout will be resetted. After 5 seconds without any new message, the chatbot collects and joins all received message and forwards to other functions.
-
The chatbot uses fixed-time checking. When receiving new message, it stores the message and runs a 5-second timeout function that check if the received message is equal to current last message (which could be no if during that window there are new messages from user). If yes, the chatbot collects and joins all received message and forwards.
Which method is better?