Ejemplo n.º 1
0
 private void OnDeleteSession(DetailedResponse <object> response, IBMError error)
 {
     Log.Debug("ExampleAssistantV2.OnDeleteSession()", "Session deleted.");
     deleteSessionTested = true;
 }
Ejemplo n.º 2
0
 private void OnMessage0(DetailedResponse <MessageResponse> response, IBMError error)
 {
     Log.Debug("ExampleAssistantV2.OnMessage0()", "response: {0}", response.Result.Output.Generic [0].Text);
     messageTested0 = true;
 }
Ejemplo n.º 3
0
 void OnMessageRecieved(DetailedResponse <MessageResponse> response, IBMError error)
 {
     Debug.Log("[" + name + "] OnMessageRecieved response = " + response.Result.Output.Generic [0].Text);
     messageTested1 = true;
 }
Ejemplo n.º 4
0
 private void OnCreateSession(DetailedResponse <SessionResponse> response, IBMError error)
 {
     Log.Debug("SimpleBOt.OnCreateSession()", "Session: {0}", response.Result.SessionId);
     sessionId           = response.Result.SessionId;
     createSessionTested = true;
 }
Ejemplo n.º 5
0
 private void OnMessage(DetailedResponse <MessageResponse> response, IBMError error)
 {
     _testString   = response.Result.Output.Generic[0].Text.ToString();
     messageTested = true;
 }
Ejemplo n.º 6
0
 private void OnDeleteSession(DetailedResponse <object> response, IBMError error)
 {
     deleteSessionTested = true;
 }
Ejemplo n.º 7
0
    private void OnResponseReceived(DetailedResponse <MessageResponse> response, IBMError error)
    {
        if (response.Result.Output.Generic != null && response.Result.Output.Generic.Count > 0)
        {
            Debug.Log("DialogueService response: " + response.Result.Output.Generic[0].Text);
            if (response.Result.Output.Intents.Capacity > 0)
            {
                Debug.Log("    -> " + response.Result.Output.Intents[0].Intent.ToString());
            }
        }

        // check if Watson was able to make sense of the user input, otherwise ask to repeat the input
        if (response.Result.Output.Intents == null && response.Result.Output.Actions == null)
        {
            Debug.Log("I did not understand");
            dSpeechOutputMgr.Speak("I don't understand, can you rephrase?");
        }
        else
        {
            if (response.Result.Output.Intents != null && response.Result.Output.Intents.Count > 0)
            {
                string answerIntent = response.Result.Output.Intents[0].Intent.ToString();

                switch (answerIntent)
                {
                case "MakeDance":
                    MakeDance();
                    break;

                case "name":
                    username = response.Result.Output.Entities.Find((x) => x.Entity.ToString() == "sys-person").Value.ToString();
                    Debug.Log("username = "******"makeWave":
                    dAImgr.Animate("waving");
                    break;

                default:
                    break;
                }
            } // any action recognised?

            if (response.Result.Output.Generic != null && response.Result.Output.Generic.Capacity > 0)
            {
                dSpeechOutputMgr.Speak(response.Result.Output.Generic[0].Text); // + ", " + username
            }
            else                                                                // no Generic response coming back, so say something diplomatic
            {
                dSpeechOutputMgr.Speak("OK.");
            }

            // now all data has been extracted, so we can run through the list of exclusions
            //UpdateExercises();
        } // Watson did understand the user
    }     // end of method OnResponseReceived