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

自定义Alexa技能二次交互无响应问题求助

解决Alexa技能第二条消息无响应问题
  • 方法名拼写错误:ProgressRequestHandler中的处理方法写成了handlle(多了一个l),Alexa无法识别该方法,导致意图触发后没有响应,需修正为handle。
  • 冗余类继承括号:类定义class ProgressRequestHandler((AbstractRequestHandler)): 中多余了一层括号,建议修正为标准写法class ProgressRequestHandler(AbstractRequestHandler):。
  • 会话结束设置:如果希望用户能继续和技能交互,在ProgressRequestHandler的响应中需要添加set_should_end_session(False)和reprompt内容,否则会话会自动结束,无法接收后续指令。

修正后的代码:

class LaunchRequestHandler(AbstractRequestHandler):
    """Handler for Skill Launch."""
    def can_handle(self, handler_input):
        # type: (HandlerInput) -> bool
        return ask_utils.is_request_type("LaunchRequest")(handler_input)

    def handle(self, handler_input):
        speak_output = "Welcome to my skill. How can I help you today?"
        reprompt_text = "You can ask me to do something. How can I assist you?"

        return handler_input.response_builder.speak(speak_output).reprompt(reprompt_text).set_should_end_session(False).response

class ProgressRequestHandler(AbstractRequestHandler):
    def can_handle(self, handler_input):
        return ask_utils.is_intent_name("progress")(handler_input)
    
    def handle(self, handler_input):
        speak_output = "He is working on the hackathon project"
        reprompt_text = "Do you have other questions?"
        return (
            handler_input.response_builder.speak(speak_output)
            .reprompt(reprompt_text)
            .set_should_end_session(False)
            .response
        )

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.18 02:32:07