actions-on-google / actions-on-google-nodejs

Node.js client library for Actions on Google
https://actions-on-google.github.io/actions-on-google-nodejs
Apache License 2.0
900 stars 194 forks source link

Context is remembered of the optional parameter during slot filling of another. #402

Open DeveloperBSHTG opened 4 years ago

DeveloperBSHTG commented 4 years ago

Context of an optional parameter is remembered during slot filling of another required parameter. This should not happen in this use case. image

If I try to modify the context it won't overwrite the values.

conv.contexts.set('user_product_get_brand', 1, parameters = {
      'dummy': '',
      'notAvailableBrand': '',
    });

Will result in:

{
  name: 'myProject',
  lifespan: 1,
  parameters: {
    brand: '',
    'brand.original': '',
    notAvailableBrand: 'Andrelon',
    'notAvailableBrand.original': 'Andrelon',
    dummy: ''
  }
}

The 'notAvailableBrand' shouldn't be remembered, because of dialog branching. If the user says something that is not recognized or inaudible, after being prompted to give a valid brand, the dialog flow should ask: 'Sorry, could you repeat that?'. However, that is not possible at the moment, because the 'notAvailableBrand' is remembered over multiple conversation turns.

Is there any way to forget the value of 'notAvailableBrand' on every query, while slot filling the 'brand' parameter?