【发布时间】:2020-04-24 10:28:17
【问题描述】:
我正在 Alexa 中开发一种简单的“技能”,我会在其中问她问题,而答案是代码中的“硬编码”,因为它们是固定答案。
其中一个意图是通过“告诉我...的 9 条规则”来激活的。问题是这些规则很长,用户很快就会感到厌烦。
我希望 Alexa 告诉我规则 1、2 和 3,然后问:“你想继续听吗?”如果你说:
- 是的,她告诉我以下三个规则,依此类推。
- 不,她回到初始菜单,“技能调用”。
有可能这样做吗?
这是我现在拥有的那个 Intent 的代码:
class TheNineRulesIntentHandler(AbstractRequestHandler):
"""Handler for TheNineRulesIntent."""
def can_handle(self, handler_input):
# type: (HandlerInput) -> bool
return ask_utils.is_intent_name("TheNineRulesIntent")(handler_input)
def handle(self, handler_input):
# type: (HandlerInput) -> Response
speak_output =
"The Nine Rules are:\
1. Long Text...\
2. Long Text...\
3. Long Text...\
4. Long Text...\
5. Long Text...\
6. Long Text...\
7. Long Text...\
8. Long Text...\
9. Long Text... "
return (
handler_input.response_builder
.speak(speak_output)
.ask(speak_output)
.response
)
【问题讨论】:
标签: alexa alexa-skill