You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Alexa技能ASKMODE下Help/Cancel/StopIntent处理异常求助

Fixing Alexa Skill Intent Routing in ASKMODE

Hey Thom, I’ve looked over your code and the issue you’re describing—where saying "Help" in ASKMODE lands you in the PlayPitch intent instead of AMAZON.HelpIntent—is a common snag with Alexa skill state management. Let’s break down what’s going on and fix it properly.

Why This Happens

The root cause almost always boils down to one of two things:

  1. Overly broad utterances in your PlayPitch intent: If your interaction model’s PlayPitch intent includes sample phrases that overlap with built-in intent triggers (like "help" or "can you help me"), Alexa’s NLP will incorrectly route those requests to PlayPitch instead of the intended built-in intent.
  2. Missing built-in intents in your interaction model: If you haven’t explicitly added AMAZON.HelpIntent, AMAZON.CancelIntent, and AMAZON.StopIntent to your skill’s interaction model, Alexa won’t recognize those requests as separate intents at all.

Step 1: Fix Your Interaction Model

First, head to the Alexa Developer Console and open your skill’s Interaction Model:

  • Navigate to the Intents tab and select your PlayPitch intent. Delete any sample utterances that include words like "help", "cancel", "stop", or phrases that could be confused with built-in triggers (e.g., change "help me play a note" to "play a note for me").
  • Add the required built-in intents: Click Add Intent, select Use an existing intent from Alexa’s built-in library, and search for AMAZON.HelpIntent, AMAZON.CancelIntent, and AMAZON.StopIntent to add them to your model.
  • Save and build the interaction model before moving on to code tweaks.

Step 2: Optimize Your State Handler Code

Your followUpHandlers already has the right built-in intent definitions, but we can refine it to handle edge cases and make the logic clearer. Here’s the adjusted code:

const followUpHandlers = Alexa.CreateStateHandler("ASKMODE", {
  // Prioritize built-in intents first (order doesn't affect routing, but makes code easier to follow)
  'AMAZON.HelpIntent': function () {
    const speechOutput = 'Pitch Pipe will play any note of the 12 tone scale surrounding A440 ';
    const reprompt = 'Simply speak the name of a note, such as e flat.';
    this.response.speak(speechOutput).listen(reprompt);
    this.emit(':responseReady');
  },
  'AMAZON.CancelIntent': function () {
    this.response.speak('Goodbye!');
    this.emit(':responseReady');
  },
  'AMAZON.StopIntent': function () {
    this.response.speak('See you later!');
    this.emit(':responseReady');
  },
  'PlayPitch': function () {
    const noteSlot = this.event.request.intent.slots.Note;
    let noteName;
    if (noteSlot && noteSlot.value) {
      noteName = noteSlot.value.toLowerCase();
      var speech = resultingSpeech(noteName);
      this.response.speak(speech);
    } else {
      // Only trigger a note-specific reprompt if the request was meant for PlayPitch
      const speechOutput = 'I don\'t recognize that note. ';
      const reprompt = 'Try saying a note like e flat.';
      this.response.speak(speechOutput).listen(reprompt);
    }
    this.emit(':responseReady');
  },
  'Unhandled': function () {
    this.response.speak('I think you asked for a note, but I don\'t understand.');
    this.emit(':responseReady');
  }
});

Key Changes Explained

  • Reordered intent handlers: While Alexa doesn’t rely on order for routing, putting built-in intents at the top makes your code more readable and emphasizes their priority.
  • Refined PlayPitch fallback: When the Note slot is empty, we now clarify that we don’t recognize the note (instead of repeating general help text), which avoids confusion with the actual HelpIntent.

Final Check

After updating the interaction model and code, test your skill by:

  1. Launching it to enter ASKMODE.
  2. Saying "Help"—it should now trigger the AMAZON.HelpIntent and play your help message.
  3. Testing "Cancel" and "Stop" to ensure they exit the skill correctly.

This should resolve the routing issue without needing temporary workarounds.

内容的提问来源于stack exchange,提问作者Thom

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.15 07:29:01