예제 #1
0
        private static void NavigateToNextNode(Dialog dialog, IDictionary <string, string> variablesValues, GotoNode gotoNode, DialogExecutionResult result)
        {
            // Adjust variables values
            ExecuteVariableAssignments(gotoNode, variablesValues);

            // Store the result of this execution
            var nodeExecution = new DialogNodeExecution(gotoNode);

            result.AddDialogNodeExecution(nodeExecution);

            // Error message if no target node found
            if (gotoNode.TargetNode == null)
            {
                result.LogMessage("Goto node is a dead end : the reference to target node id '" + gotoNode.TargetNodeId + "' could not be resolved");
            }
            else
            {
                // Contine with the target node and its siblings
                SelectChildNode(dialog, variablesValues, gotoNode.TargetNode.ParentNode, gotoNode.TargetNode, result);
            }
        }
예제 #2
0
        public static DialogExecutionResult AnalyzeInitialQuestion(Dialog dialog, string questionId, string questionText, string intentName)
        {
            var result = new DialogExecutionResult(questionId, questionText, intentName);

            MatchIntentAndEntities intent = null;

            if (!dialog.Intents.TryGetValue(intentName, out intent))
            {
                intent = dialog.Intents.Values.Where(i => i.Name.EndsWith(intentName)).FirstOrDefault();
            }

            if (intent != null)
            {
                ExecuteUserInputNode(dialog, intent, questionText, result);
            }
            else
            {
                result.LogMessage("Intent name " + intentName + " undefined in dialog file " + dialog.FilePath);
            }

            return(result);
        }