I
I
IvanOne2017-08-16 08:32:58
Python
IvanOne, 2017-08-16 08:32:58

How to make a dialogue in a chat bot?

Good afternoon! I wanted to write a bot for VKontakte, but not the usual one with a couple of three commands, namely, so that he could conduct a dialogue. For example, the question structure is as follows:

{'Вопрос 1': 
     {
      'Вопрос 1.1': {
           'Вариант 1': 'Ответ',
           'Вариант 2': 'Ответ'
      }, 
      'Вопрос 1.2': {
            'Вариант 1': 'Ответ',
            'Вариант 2': 'Ответ'
       }
       }
}

If you use the Callback Api, then the user’s message arrives at the server, but how can you understand at what level of questions the dialogue is, here in my head there is an option that somewhere in the database to store the dialogue chain, and every time the user writes, check if he has a dialogue in base or not. The second option is to do some kind of subscription (please do not throw stones at me !!!), i.e. during the dialogue we send a message to the user and put some kind of handler on his id, he answers and his answer goes to this same handler immediately, etc. , but are there any such solutions? Maybe someone came across a similar one, tell me the architecture or libraries, in general, share your experience.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konstantin Sazhenov, 2017-08-22
@IvanOne

Personally, I shove everything into db
Created a users table with id and last_command parameters
After each message, I record the state of this "dialog" in last_command

V
Vlad Grigoriev, 2017-08-16
@Vaindante

try reading about akinator maybe it will suit you better

K
Kirill Atstarov, 2017-08-17
@malkiel

dig information on recurrent neural networks and Neural conversation models
I saw several cases where neurons were trained on text dialogues from TV shows

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question