如何从 Alexa 中的 url 编写流式音频的意图?
我需要在 lambda 函数中编写哪些更改或函数以在 alexa 中流式传输音频 url。
我已经浏览了 AWS 博客,但无法实现这一点。
我可以将我的 Amazon Alexa Skill 与两个外部服务相关联吗?
我想从他们两个汇总数据,但我需要使用两个不同的访问令牌。
我可以通过使用 Alexa 帐户链接来获取它们吗?
我有一个值存储在名为 myStation 的变量中。现在我想在位于另一个名为 station.js 的文件中的数组中找到该值。当我找到匹配项时,我想获取 stationID。我使用的代码let stationNewName = Stations.find((s) => s.stationName === myStation);导致错误“错误处理:Stations.find 不是函数”。我错过了什么?
我希望不必加载 Lodash 库的开销,并认为我应该能够使用基本的 javascript 代码来完成。以下是我的代码中与错误相关的摘录:
需要 station.js 文件
const Stations = require("./stations.js");
Run Code Online (Sandbox Code Playgroud)
这是导致错误的代码的摘录。下一行在我的一个处理程序中执行,其中 myStation 正在接收值“CBS”
const myStation = handlerInput.requestEnvelope.request.intent.slots.stationName.value;
Run Code Online (Sandbox Code Playgroud)
下一行产生错误:“错误处理:Stations.find 不是函数”。
let stationNewName = Stations.find((s) => s.stationName === myStation);
Run Code Online (Sandbox Code Playgroud)
这是我在stations.js 文件中的数组的摘录
STATIONS: [
{stationName: "CBS", stationID: "8532885"},
{stationName: "NBC", stationID: "8533935"},
{stationName: "ABC", stationID: "8534048"},
],
Run Code Online (Sandbox Code Playgroud)
更新 Array 以包含完整模块
'use strict';
module.exports = {
STATIONS: [
{stationName: "CBS", stationID: "8532885"},
{stationName: "NBC", stationID: "8533935"}, …Run Code Online (Sandbox Code Playgroud) 我希望Alexa能够接受我的自定义技能的可变长度的英文字母列表.它将允许用户基于字符串进行搜索.
这有两个步骤:
首先,一种方法是定义一个自定义槽,其中包含英文字母的枚举值:
SLOT_LETTER
ay
bee
see
dee
ee
eff
gee
... etc
Run Code Online (Sandbox Code Playgroud)
但这感觉很糟糕.亚马逊是否支持任何方式来实现这一目标,还是有更聪明的方式?
我真的不想使用北约语音("阿尔法布拉沃查理"用于"ABC"),因为它是一种糟糕的用户体验,很少有人真正了解它们.
对于第二个问题(示例话语),因为AMAZON.LITERAL我想定义类似的东西:
SpellIntent find me things starting with {first second|SLOT_LETTER}
SpellIntent find me things starting with {first second third|SLOT_LETTER}
SpellIntent find me things starting with {first second third fourth|SLOT_LETTER}
Run Code Online (Sandbox Code Playgroud)
但我不认为亚马逊会让你使用自定义插槽定义一个可变长度的LITERAL(因为它们是不同的"类型")?
amazon-web-services alexa alexa-skill alexa-skills-kit alexa-voice-service
我为亚马逊回声点创建了一个Java自定义Lambda技能.
该技能在N.Virginia中启用和冲洗(arn:aws:lambda:us-east-1 ....).
在用于在输入书面文本时测试技能的开发者控制台下,一切都没有问题.该技能尚未公布.
我希望用我的Echo Dot测试技能,该Echo Dot已注册到开发者帐户.我可以在Alexa App中看到You Apps列表中列出的技能.
我遇到的问题是,当我要求Echo Dot启动它时,它永远找不到我刚才创造的技能.
有任何想法吗 ?
调用名称是:building god
我不想将这项技能发布到全世界,因为我目前仍在学习,但我想用Echo Dot测试它,而不是仅使用浏览器打字模式.
在Alexa中创建技能时,每个插槽可以添加的最大值数是多少?
由于担心记录原始用户对话作为输入的技能,看起来AMAZON.LITERAL被弃用了.
如果用户原始输入无法记录,我有大量可能的值可用作输入.
我正在为亚马逊Alexa开发一项技能,我正在使用DynamoDB来存储有关用户最喜欢的对象的信息.我想在数据库中有3列:
我目前将Alexa userId作为主键.我遇到的问题是,如果我尝试使用相同的userId向数据库添加条目,它将覆盖已存在的条目.如何允许用户通过拥有多行来在db中将多个对象与它们相关联?我希望能够通过userId查询数据库并接收他们指定的所有对象.
如果我为每个条目创建一个唯一的id,并且有多个用户,我就不可能知道要查询的id来获取活动用户的对象.
在以下示例中:如果用户说太妃糖,那不应该翻译成糖果吗?我问,因为传递给我的意图的价值是“太妃糖”。所以不确定我有什么不对。
types":[
{
"name":"SHOPPING_LIST",
"values":[
{
"id":null,
"name":{
"value":"candy",
"synonyms":[
"toffee"
]
}
},
{
"name":"GetPrice",
"samples":[
"Get me the price of {item}",
"tell me the price of {item}",
],
"slots":[
{
"name":"item",
"type":"SHOPPING_LIST"
}
]
}
Run Code Online (Sandbox Code Playgroud) alexa aws-lambda alexa-skill alexa-skills-kit alexa-voice-service
关于如何将Cognito设置为Alexa中的帐户链接提供程序,我感到有点困惑.到目前为止,在Alexa,我有以下内容:
授权网址:
https://[domain].auth.us-east-1.amazoncognito.com/oauth2/authorize?response_type=code&client_id=[clientID]&redirect_uri=https://pitangui.amazon.com/api/skill/link/[random]
Run Code Online (Sandbox Code Playgroud)
这由此端点的文档备份.然后我认为访问令牌URI将遵循:
https://[domain].auth.us-east-1.amazoncognito.com/oauth2/token?grant_type=code&client_id=[clientID]&redirect_uri=https://pitangui.amazon.com/api/skill/link/[random]
Run Code Online (Sandbox Code Playgroud)
此端点也在文档中.但这不起作用,我也对Amazon如何将代码从auth端点传递到令牌端点感到困惑.我见过人们使用:
https://pitangui.amazon.com/api/skill/link/[random]?grant_type=code&client_id=[clientID]&redirect_uri=https://pitangui.amazon.com/api/skill/link/[random]
Run Code Online (Sandbox Code Playgroud)
哪个是帐户关联的重定向URI.在Alexa应用程序和Alexa网站中,我得到重定向不匹配.所有重定向都匹配.
我可以使用隐式流程来正常工作,但我需要让它与auth代码流一起工作,这样我就可以拥有自刷新令牌.
amazon-web-services amazon-cognito alexa-skill alexa-skills-kit
在我的Alexa技能的意图处理程序之一中,我的诺言一旦解决,我就必须返回响应。
代码如下:
var rcvPromise = receiveMsgQ();
rcvPromise.then(function(speechText) {
console.log('rcv Promise resolved with ',speechText);
return handlerInput.responseBuilder
.speak(speechText)
.withSimpleCard('skill_name', speechText)
.withShouldEndSession(false)
.getResponse();
});
Run Code Online (Sandbox Code Playgroud)
技能返回错误消息,没有有关错误的其他详细信息。
有什么办法可以解决这个问题?
PS:我需要使用promise作为receiveMsgQ()异步函数调用。
alexa-skills-kit ×10
alexa-skill ×6
alexa ×5
aws-lambda ×3
alexa-slot ×2
java ×1
javascript ×1
node.js ×1
python ×1