json Alexa技能的LaunchRequest不断失败:请求的技能响应有问题

w3nuxt5m  于 2023-10-21  发布在  其他
关注(0)|答案(1)|浏览(153)

Alexa无法启动我的Alexa技能。当我通过说“打开更大的大脑”或“启动更大的大脑”来测试它时,Alexa说“请求的技能响应有问题”。我已经尝试了一切我可以解决这个问题,检查了交互模型(JSON),函数代码,但它就是不工作。有什么建议来解决这个问题吗?
这是我处理LaunchRequest的Python函数代码:

import logging
import ask_sdk_core.utils as ask_utils
from ask_sdk_core.skill_builder import SkillBuilder
from ask_sdk_core.dispatch_components import AbstractRequestHandler, AbstractExceptionHandler
from ask_sdk_core.utils import is_intent_name
from ask_sdk_model import Response
from ask_sdk_model.ui import SimpleCard

shouldEndRequest = False

to create SkillBuilder instance and register the handlers
sb = SkillBuilder()

custom LaunchRequestHandler to handle the skill launch
class LaunchRequestHandler(AbstractRequestHandler):
def can_handle(self, handler_input):
return is_request_type("LaunchRequest")(handler_input)

def handle(self, handler_input):
speech_text = "Welcome to Bigger Brain, the interaction model that is cooler than Alexa. Let us chat. Ask me whatever you want."  

def handle(self, handler_input):
handler_input.response_builder.speak(speech_text).set_card(
SimpleCard("Bigger Brain", speech_text)).set_should_end_session(
False)
return handler_input.response_builder.response

sb.add_request_handler(LaunchRequestHandler())

这是用于LaunchRequest的JSON(此处仅显示LaunchRequest:)

{
    "interactionModel": {
        "languageModel": {
            "invocationName": "bigger brain",
            "intents": [
                {
                    "name": "LaunchRequest",
                    "slots": [],
                    "samples": [
                        "Start Bigger Brain",
                        "Launch Bigger Brain",
                        "Open Bigger Brain",
                        "Begin Bigger Brain",
                        "Begin",
                        "Alexa launch Bigger Brain"
                    ]
                },
a9wyjsp7

a9wyjsp71#

发送给您的技能的示例请求JSON及其响应的JSON将有助于确认,但我怀疑一个问题是您在交互模型中定义了LaunchRequest。只在里面定义意图。LaunchRequest和它的所有表达方式都是开箱即用的。请从您的交互模型中删除该意图,重新构建并部署您的技能,然后重试。如果仍然失败,请包含请求和响应JSON示例。

相关问题