Exemplo n.º 1
0
        private async Task <DialogDto> StartFlowAnswer(QandA answer, string conversationId)
        {
            MoMoBotAssert.ValueNullOrWhiteSpace(answer.FlowId);

            var start = await _mapContext.StartAsync(answer.FlowId, conversationId);

            return(new DialogDto(conversationId, answer.Id, answer.Intent, start?.Question, AnswerTypes.ProcessFlow));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Map(string answer, [FromHeader(Name = "x-yc-conversationId")] string conversationId)
        {
            await _knowledgeMap.StartAsync("travel_application_test", conversationId);

            if (_knowledgeMap.HasNext())
            {
                var step = await _knowledgeMap.ContinueAsync(answer, conversationId);

                return(Ok(new { _knowledgeMap.Next, step.Question }));
            }
            var state = await _knowledgeMap.GetStateAsync(conversationId);

            await _knowledgeMap.DestroyAsync(conversationId);

            return(Ok(state));
        }