如何通过点击而不是语音来触发Alexa意图? [英] How can I trigger Alexa intent with clicks rather than voice?

查看:98
本文介绍了如何通过点击而不是语音来触发Alexa意图?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发与Alexa技能相关的烧瓶应用程序。当用户单击某些内容(例如通知)时,我正在尝试建立一种功能,Alexa询问用户是否希望继续,如果用户说是,则Alexa会将用户带到相关网页。

I am working on a flask app that links to Alexa skills. I am trying to building a capability when a user click on some content (e.g. notifications), Alexa asks if the user wish to proceed, if the user says 'yes', then Alexa takes the user to the relevant webpage.

我的问题是,是否可以通过点击网站内容而不是语音来触发Alexa意图?我的理解是意图只能通过语音来激活。

My question is, is it possible to trigger Alexa intent with clicks on the website content instead voice? My understanding that intent can only be activated through voice.

任何想法都会受到赞赏。

Any thoughts will be much appreciated.

推荐答案

正如您所说,意图是由语音触发的。相对简单的方法是:

As you say the intent is triggered by voice. A relatively easy way to do it would be:

使用polly工具生成表达意图的音频文件。例如。 播放我的歌曲
https://docs.aws .amazon.com / polly / latest / dg / API_SynthesizeSpeech.html

Generate the audio file expressing the intent using polly tool. E.g. "play my song" https://docs.aws.amazon.com/polly/latest/dg/API_SynthesizeSpeech.html

每当用户单击Web链接时,请使用PostContent API调用意图。

Whenever the user clicks on the web link, invoke the intent using the PostContent API. Basically pretending the user said it.

调用的示例为:

aws lex-runtime post-content  --bot-name yourBot --bot-alias \"\\$LATEST\"  --user-id youruserid--content-type \"audio/l16; rate=16000; channels=1\"  --input-stream request.wav answer.mp3

其中yourBot是您的Bot名称,而request.wav是以前由polly生成的音频文件。您将在文件answer.mp3

where yourBot is your Bot name and request.wav is the audio file previously generated with polly. You will get the audio answer in the file answer.mp3

缺点是您需要为此使用lex / lambda而不是仅烧瓶...
希望它有帮助!

Drawback is you need to use lex/lambda for this, not just flask... Hope it helped! Ester

这篇关于如何通过点击而不是语音来触发Alexa意图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆