自动委派未触发

问题描述 投票:0回答:1

我正在尝试让 AutoDelegate 工作(或任何槽填充方法,因为似乎没有什么对我有用)。奇怪的是,我有一个完美运行的请求,但我从头开始创建的任何新内容都会失败,即使是最基本的示例也是如此。

本质上,槽委托根本不会被触发,它实际上直接进入“完成”阶段,无论是否需要槽,需要确认,如果整个请求需要确认 - 一切似乎都被忽略。如果我再一次听到或读到“在所有插槽都被填满之前,意图甚至不会被击中”,我就会失去理智。

事情是这样的:

  • 用无槽的话语触发意图
  • 点击
    InProgressSlotIntentHandler
    ,状态为
    STARTED
  • 返回
    addDelegateDirective(currentIntent)
  • 突然声明
    COMPLETED
    ,不填任何槽位
  • 点击
    SlotIntentHandler
    并且代码失败,因为插槽未填充

记录的请求数据还清楚地显示没有确认任何插槽,但它直接进入完成状态

{
    "type": "IntentRequest",
    "requestId": "amzn1.echo-api.request.786ea058-6258-4e8e-8eac-a777f561b3a6",
    "locale": "en-US",
    "timestamp": "2024-09-20T09:35:22Z",
    "intent": {
        "name": "SlotIntent",
        "confirmationStatus": "NONE",
        "slots": {
            "firstName": {
                "name": "firstName",
                "confirmationStatus": "NONE"
            },
            "testSlot": {
                "name": "testSlot",
                "confirmationStatus": "NONE"
            }
        }
    },
    "dialogState": "COMPLETED"
}

即使使用工作模板(例如 https://github.com/dabblelab/12-alexa-dialog-delegate-example-skill 来自 https://www.youtube.com/watch?v=NHtK_BbYb0) 1:1复制它不想工作。

这是我最基本的模型的摘录(简化)

{
    "interactionModel": {
        "languageModel": {
            "intents": [
                {
                    "name": "SlotIntent",
                    "slots": [
                        {
                            "name": "testSlot",
                            "type": "AMAZON.DATE",
                            "samples": [
                                "give me a fact about {testSlot}",
                                "tell me some facts about {testSlot}",
                                "{testSlot}"
                            ]
                        }
                    ],
                    "samples": [
                        "tell me",
                        "tell me about {testSlot}"
                    ]
                }
            ]
        },
        "dialog": {
            "intents": [
                {
                    "name": "SlotIntent",
                    "confirmationRequired": false,
                    "prompts": {},
                    "slots": [
                        {
                            "name": "testSlot",
                            "type": "AMAZON.DATE",
                            "confirmationRequired": false,
                            "elicitationRequired": true,
                            "prompts": {
                                "elicitation": "Elicit.Slot.251925459829.983270759031"
                            }
                        }
                    ]
                }
            ],
            "delegationStrategy": "ALWAYS"
        },
        "prompts": [
            {
                "id": "Elicit.Slot.251925459829.983270759031",
                "variations": [
                    {
                        "type": "PlainText",
                        "value": "Give me a date."
                    }
                ]
            }
        ]
    }
}

以及处理委托和最终输出的 2 个意图

const InProgressSlotIntentHandler = {
  canHandle(handlerInput) {
    const request = handlerInput.requestEnvelope.request;
    return request.type === 'IntentRequest' &&
      request.intent.name === 'SlotIntent' &&
      request.dialogState !== 'COMPLETED';
  },
  handle(handlerInput) {
    const currentIntent = handlerInput.requestEnvelope.request.intent;
    return handlerInput.responseBuilder
      .addDelegateDirective(currentIntent)
      .getResponse();
  },
};

const SlotIntentHandler = {
  canHandle(handlerInput) {
    return handlerInput.requestEnvelope.request.type === 'IntentRequest'
      && handlerInput.requestEnvelope.request.intent.name === 'SlotIntent';
  },
  async handle(handlerInput) {
    const responseBuilder = handlerInput.responseBuilder;

    let speechText = `Here's is your slot - ${handlerInput.requestEnvelope.request.intent.slots.testSlot}`;
    
    return responseBuilder
      .speak(speechText)
      .getResponse();
  },
};

Utterance Profiler
中它工作正常,但是一旦我部署并运行(在设备上、应用程序中或模拟器中),它会直接返回我“这是你的插槽 - 未定义”

这是 Alexa 当前的一个小问题,还是我在做一些根本性错误的事情,因为我看不到它(特别是因为我有一项技能,可以让代表团以另一个意图工作,但任何新的东西都不会......)

alexa-skills-kit alexa-slot
1个回答
0
投票

我没有真的有答案,但我从头开始创建了一个新的 HelloWorld 技能,并复制了其中的交互 JSON 模型 1:1 - 并且使用新技能,AutoDelegation 可以工作(尽管它很容易中断并退出)如果我修改内容,就会出现神秘的“找不到 en_US 的技能包元数据”错误 - 但至少看起来即使它尝试进行自动委托,它也会感到困惑,在哪里可以找到提示资源??)

所以我想我唯一的出路就是废弃现有技能并将所有数据复制到新技能?

幸运的是,该技能仍在开发中,但这并不是解决方案。我仍然不知道为什么会发生这种情况:-/

© www.soinside.com 2019 - 2024. All rights reserved.