官术网_书友最值得收藏!

Managing context 

In any conversation, the context of conversation needs to be managed. Context can be maintained by creating a local cache where the information transferred between the two dialogue partners can be stored. For instance, the user may tell the chatbot their food preferences, and this information can be stored in context for future reference if not used immediately. Another instance is in a conversation where the user is asking questions about a story. These questions may be incomplete and may need to be interpreted in terms of the information available in the context. 

In this section, we will explore how context can be recorded and utilized during the conversation in Chatfuel. Let's take the task of finding a restaurant as part of your tour guide chatbot. The conversation between the chatbot and the user might go as follows:

User : Find a restaurant
Bot : Ok. Where?
User : City center.
Bot : Ok. Any cuisine that you fancy?
User : Indian
Bot : Ok. Let me see... I found a few Indian restaurants in the city center.
Here they are.

In the preceding conversation, up until the last bot utterance, the bot needs to save the information locally. When it has gathered all the information it needs, it can go off and search the database with appropriate parameters. Notice that it also needs to use that information in generating utterances dynamically. Let's explore how to do these two—dynamically generating utterances and searching the database.

First, we need to build the conversational flow to take the user through the conversation just as we discussed in the Next steps section. Let's assume that the user clicks the Find_a_restaurant button on the welcome block. Let's build the basic blocks with text messages and buttons to navigate through the conversation:

主站蜘蛛池模板: 兴安县| 中宁县| 苏尼特左旗| 监利县| 南城县| 阳高县| 紫金县| 河源市| 金平| 梁山县| 西乡县| 明水县| 伊金霍洛旗| 玉溪市| 鄯善县| 北宁市| 枞阳县| 郓城县| 陆河县| 兴义市| 榆林市| 黄平县| 富蕴县| 靖远县| 绥化市| 富锦市| 新安县| 兴国县| 德安县| 肇东市| 泸西县| 会东县| 罗江县| 神农架林区| 和静县| 靖安县| 滦南县| 萨嘎县| 昌乐县| 广平县| 西平县|