如何将Dialog.Delegate指令返回给Alexa Skill模型?

编程入门 行业动态 更新时间:2024-10-08 03:47:52
本文介绍了如何将Dialog.Delegate指令返回给Alexa Skill模型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想用Alexa Skill模型创建一个简单的多轮对话。我的意图由3个插槽组成,每个插槽都必须满足该意图。我提示每个插槽并定义了所有需要的语音。

I want to create a simple multi-turn dialog with the Alexa Skill model. My intent consists of 3 slots, each of which are required to fulfill the intent. I prompt every slot and defined all of the needed utterances.

现在,我想使用Lambda函数处理请求。这是我针对特定Intent的函数:

Now I want to handle the request with a Lambda function. This is my function for this specific Intent:

function getData(intentRequest, session, callback) { if (intentRequest.dialogState != "COMPLETED"){ // return a Dialog.Delegate directive with no updatedIntent property. } else { // do my thing } }

那么我将如何继续使用Alexa文档中提到的 Dialog.Delegate 指令来建立响应?

So how would I go on to build my response with the Dialog.Delegate directive, as mentioned in the Alexa documentation?

https:// developer.amazon/docs/custom-skills/dialog-interface-reference.html#scenario-delegate

谢谢。

推荐答案

使用 Dialog.Delegate 指令无法发送 outputSpeech 或 reprompt 。而是使用交互模型中定义的那些。

With Dialog.Delegate directive you cannot send outputSpeech or reprompt from your code. Instead those defined in interaction model will be used.

请勿在对话框中包含outputSpeech或重新提示。 Alexa使用对话框模型中定义的提示向用户要求插槽值和确认。

Do not include outputSpeech or reprompt with the Dialog.Directive. Alexa uses the prompts defined in the dialog model to ask the user for the slot values and confirmations.

这意味着您不能委托并提供自己的响应,但是可以使用任何其他 Dialog 指令提供 outputSpeech 和 reprompt 。

What this means is that you cannot delegate and provide your own response, but instead you can use any other Dialog directive to provide your outputSpeech and reprompt.

例如: Dialog.ElicitSlot , Dialog.ConfirmSlot 和 Dialog.ConfirmIntent 。

在任何时候,您都可以接管对话框,而不必继续委托给Alexa。

At any point, you can take over the dialog rather than continuing to delegate to Alexa.

... const updatedIntent = handlerInput.requestEnvelope.request.intent; if (intentRequest.dialogState != "COMPLETED"){ return handlerInput.responseBuilder .addDelegateDirective(updatedIntent) .getResponse(); } else { // Once dialoState is completed, do your thing. return handlerInput.responseBuilder .speak(speechOutput) .reprompt(reprompt) .getResponse(); } ...

updatedIntent < addDelegateDirective()中的/ code>参数是可选的。 这是一个意图对象,代表发送给您的技能的意图。您可以使用此属性集,也可以根据需要更改插槽值和确认状态。

The updatedIntent parameter in addDelegateDirective() is optional. It is an intent object representing the intent sent to your skill. You can use this property set or change slot values and confirmation status if necessary.

有关Dialog指令的更多信息此处

More on Dialog directives here

更多推荐

如何将Dialog.Delegate指令返回给Alexa Skill模型?

本文发布于:2023-11-28 04:13:19,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1640910.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   指令   模型   Dialog   Delegate

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!