Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

newPrompt returns before receiving a spoken response #100

Open
dominicklee opened this issue Feb 16, 2021 · 0 comments
Open

newPrompt returns before receiving a spoken response #100

dominicklee opened this issue Feb 16, 2021 · 0 comments

Comments

@dominicklee
Copy link

I am running on Artyom.window.min.js v1.0.6 and I am trying to use newPrompt with this following example:

function startPrompt()
{
  artyom.newPrompt({
      question:"How many centimeters should I cut?",
      //We set the smart property to true to accept wildcards
      smart:true,
      options:["Cut * centimeters","Remove * centimeters"],
      beforePrompt: () => {
          console.log("Before ask");
      },
      onStartPrompt:  () => {
          console.log("The prompt is being executed");
      },
      onEndPrompt: () => {
          console.log("The prompt has been executed succesfully");
      },
      onMatch: (i,wildcard) => {// i returns the index of the given options
          var action;
  
          var totalCentimeters = parseInt(wildcard);
  
          action = () => {
              alert(wildcard + " centimeters will be removed of your sandwich!");
          };
  
          // A function needs to be returned in onMatch event
          // in order to accomplish what you want to execute
          return action;                       
      }
  });
}

When I run that startPrompt() function above, in the console, I see the onStartPrompt, onEndPrompt, but it returns instantly without the onMatch prompt. It never waited for the user to speak the centimeters before it closed. I don't know what is causing it to end prematurely without waiting for a reply.

I am using Google Chrome v70. Here is how I initialized Artyom:

  artyom.initialize({
	  lang:"en-GB",
	  //Listen Forever
	  continuous:true,
	  // Log everything in the console
	  debug:true,
	  // Keyword used to end a command forcefully
	  executionKeyword: "now",
	  // Initialize artyom !
	  listen:true,
	  soundex: true,
	  name: "vox"
  });

Can someone please help? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant