bespoken / virtual-google-assistant

🤖 Easily test and debug Actions on Google programmatically https://bespoken.io
Apache License 2.0
23 stars 10 forks source link

Followup Intent not picked up #44

Closed AngavaiS closed 5 years ago

AngavaiS commented 5 years ago

Is your feature request related to a problem? Please describe. A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like A clear and concise description of what you want to happen.

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

AngavaiS commented 5 years ago

The follow up intent of find_store is (yes/no) which is not picked up properly. Instead it is picking the affirmation intent which is having the same follow up (Yes/No). Please help me what changes I have to make in order to pick up the correct follow up or context.

{ originalDetectIntentRequest: { source: 'google', version: '2', payload: { user: {} } }, responseId: '4b6e726-447b-b27f-181fde7befea', queryResult: { queryText: 'GOOGLE_ASSISTANT_WELCOME', allRequiredParamsCollected: true, parameters: { address: 'fremont ca' }, outputContexts: [], intent: { name: '9f36a9c2-8648-43b9-8b89-992b780d4ed3', webhookState: 'true', displayName: 'find_store', matchedParameters: [Array] }, diagnosticInfo: { webhookLatencySeconds: 1 }, fulfillmentText: '', fulfillmentMessages: [ [Object] ], intentDetectionConfidence: 1, languageCode: 'en-us', action: 'find_store' }, session: '1517462114' }

console.log src/test/TestBuilder.ts:119 { originalDetectIntentRequest: { source: 'google', version: '2', payload: { user: {} } }, responseId: 'c03da4f9-21650a259cfb', queryResult: { queryText: 'GOOGLE_ASSISTANT_WELCOME', allRequiredParamsCollected: true, parameters: {}, outputContexts: [ [Object], [Object], [Object] ], intent: { name: 'fecaac37-a4b3-4af3-b352-9f6c0f80563d', webhookState: 'true', displayName: 'affirmations-no' }, diagnosticInfo: { webhookLatencySeconds: 1 }, fulfillmentText: '', fulfillmentMessages: [ [Object] ], intentDetectionConfidence: 1, languageCode: 'en-us', action: 'affirmations.affirmations-no' }, session: '15181232114' }

describe(‘Location Details and change location, function () {

it('it should return welcome intent', function () {
    res2 = await ga.utter(‘talk to staging’);
     });

it('it should return location intent', function () {
    res2 = await ga.utter(‘get me nearest store’);
      });

it('it should return different location details’, function () {
   res2 = await ga.utter(‘no’);
});

}); Dialog flow.docx

AngavaiS commented 5 years ago

The same works fine for Alexa. Do we need to change the request before we send for follow up or YES intent ?

AngavaiS commented 5 years ago

I just got it resolved. Sorry for the confusion. I am still learning your library. res = await ga.intend('find_store-yes'); Can you confirm, is that the right way to handle ?

AngavaiS commented 5 years ago

res = await ga.intend('find_store_enrollment-yes'); The above request is not picking the proper Intent. Its because of the affectedContexts having the intents inside ? Can you help me how to fix it ?

{ "id": "7cd85468-1a29-444a-851a-a625714576e7", "name": "find_store_enrollment-yes", "auto": true, "contexts": [ "find_store_enrollment-followup" ], "responses": [ { "resetContexts": false, "action": "find_store.find_store-yes", "affectedContexts": [ { "name": "find_store_enrollment_phone-followup", "parameters": {}, "lifespan": 1 } ], "parameters": [], "messages": [ { "type": 0, "lang": "en", "speech": [] } ], "defaultResponsePlatforms": {}, "speech": [] } ], "priority": 500000, "webhookUsed": true, "webhookForSlotFilling": false, "lastUpdate": 1546246970, "fallbackIntent": false, "events": [] }

jkelvie commented 5 years ago

Hi @AngavaiS - @jperata I think can comment in more depth on the specific issue you are seeing.

However, have you tried using a filter? https://github.com/bespoken/virtual-google-assistant#using-the-request-filter

This will allow you to manipulate the JSON being sent to your service, so that it fits what is needed by your test. Let me know if that helps.

AngavaiS commented 5 years ago

Thanks @jkelvie for your response. I do have the below filter setup done already. No luck. ga.addFilter((request) => { request.queryResult.parameters.automation = true; });

I am able to see the proper display name and action in the request payload. But it triggers find_store Intent instead of find_store_enrollment-yes.

AngavaiS commented 5 years ago

To give you more insight, In the request its properly picking the Intent but the response it gave me was SR_info Intent instead of SR_phone_confirmation_followup-yes.

{ originalDetectIntentRequest: { source: 'google', version: '2', payload: { user: {} } }, responseId: '0a48-470b-b53b-63f6c4ff23d7', queryResult: { queryText: 'GOOGLE_ASSISTANT_WELCOME', allRequiredParamsCollected: true, parameters: { automation: true }, outputContexts: [], intent: { name: '488d-8619-48d9f1e010a8', webhookState: 'true', displayName: 'SR_phone_confirmation_followup-yes' }, diagnosticInfo: { webhookLatencySeconds: 1 }, fulfillmentText: '', fulfillmentMessages: [ [Object] ], intentDetectionConfidence: 1, languageCode: 'en-us', action: 'SR_info.SR_info-yes.SR_info-yes-custom.SR_info-phone-followup-yes' }, session: '1518537462114' }

Dialog Flow structure.

**SR_phone_confirmation_followup-yes

AngavaiS commented 5 years ago

When ran through my test script, I found that the context is not maintained. The outputContexts: [], seems to be null. Whereas, the other intents having the outputContext. I am able to see the outputContexts in Simulator and outputContexts is missing in response in Simulator. Whereas in our library, the context is null in both request and response. Do let me know If I am missing something here.

The intent where I got the context: outputContexts": [ { "name": "qa/agent/sessions/ABwppHHyqVsuF4WognlGPwymfrFP_DYhIEZJdnn06kkcnw3y1g_TgDgdiJtgXyfkRDrbMEsAgdgYtbohaYA/contexts/find_store_different" }, { "name": "qa/agent/sessions/ABwppHHyqVsuF4WognlGPwymfrFP_DYhIEZJdnn06kkcnw3y1g_TgDgdiJtgXyfkRDrbMEsAgdgYtbohaYA/contexts/actions_capability_screen_output" }, { "name": "qa/agent/sessions/ABwppHHyqVsuF4WognlGPwymfrFP_DYhIEZJdnn06kkcnw3y1g_TgDgdiJtgXyfkRDrbMEsAgdgYtbohaYA/contexts/find_store_no" }, { "name": "qa/agent/sessions/ABwppHHyqVsuF4WognlGPwymfrFP_DYhIEZJdnn06kkcnw3y1g_TgDgdiJtgXyfkRDrbMEsAgdgYtbohaYA/contexts/find_store-followup" }, { "name": "qa/agent/sessions/ABwppHHyqVsuF4WognlGPwymfrFP_DYhIEZJdnn06kkcnw3y1g_TgDgdiJtgXyfkRDrbMEsAgdgYtbohaYA/contexts/actions_capability_audio_output" }, { "name": "qa/agent/sessions/ABwppHHyqVsuF4WognlGPwymfrFP_DYhIEZJdnn06kkcnw3y1g_TgDgdiJtgXyfkRDrbMEsAgdgYtbohaYA/contexts/find_store" }, {

    "name": "qa/agent/sessions/ABwppHHyqVsuF4WognlGPwymfrFP_DYhIEZJdnn06kkcnw3y1g_TgDgdiJtgXyfkRDrbMEsAgdgYtbohaYA/contexts/google_assistant_input_type_keyboard"
  },
  {
    "name": "qa/agent/sessions/ABwppHHyqVsuF4WognlGPwymfrFP_DYhIEZJdnn06kkcnw3y1g_TgDgdiJtgXyfkRDrbMEsAgdgYtbohaYA/contexts/actions_capability_web_browser"
  },
  {
    "name": "qa/agent/sessions/ABwppHHyqVsuF4WognlGPwymfrFP_DYhIEZJdnn06kkcnw3y1g_TgDgdiJtgXyfkRDrbMEsAgdgYtbohaYA/contexts/actions_capability_media_response_audio"
  }
],