Alexa技能自定义日期时间插槽 [英] Alexa skills custom slot for date times

查看:130
本文介绍了Alexa技能自定义日期时间插槽的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

因此,我正在与Amazon Echo合作一个项目。我的目标是记录何时执行特定操作并将其记录到数据库中。我的问题是时区,我使用纪元时间来避免这种情况。但是,从我可以确定的意图的自定义广告位来看,我的选择是没有时间的格式化日期字符串,或者没有日期的格式化时间字符串,最重要的是,如果没有这些,我就无法抓住客户的时区



回声只是讨厌约会吗?



这似乎很简单,但我一直在努力寻找解决方法,而又不会感到尴尬并询问他们的住所,以便我可以查询他们的时区。我已经不得不从告诉他们做某事的具体时间到他们做某事多久了,因为我无法将日期传回Echo并期望它进行翻译,因此我已经做了一个工作。

解决方案

看来您还不能(但是)检测到用户的时区,但是您应该仍然能够实现您的目标。一些想法:




  • 您可以使系统完全不了解时区。每个用户可能具有不同的时区,但是特定用户的所有时间都将处于同一时区,因此任何持续时间计算都可以正常工作。

  • 没有DATETIME槽位类型,因此您需要将每个插槽分别作为AMAZON.DATE和AMAZON.TIME处理。例如在{TIME}在{DATE}标记完成时间

  • 此外,如果您是现实世界中的标记完成日期时间,您是否可以在代码内部生成时间戳,而不是让他们说

  • 如有必要,请求邮编可能是设置时区的快速方法。

  • Hacky:如果您使用帐户关联,则可以在登录页面上从客户端检测其时区。



在服务器时区和用户时区中的通话时间之间进行转换将是有问题的,但也许可以解决这个问题,直到亚马逊包括时区数据为止。


So, I'm working a project with the Amazon Echo. My goal is to record when I did a specific action and to record it into a DB. My issue is timezones, and I avoid this by using epoch time. However, from what I can tell of custom slots for an intent, my choices are formatted date strings with no time, or formatted time strings with no dates, and on top of all of that, I have no way of grabbing the client's timezone without specifically asking for it based on some forum posts I found with my google fu.

Does the echo just hate dates? This seems like something that should be really easy, but I'm struggling to figure out how to go about it without being really awkward and asking where they live so I can do a lookup of their timezone. I already had to make a pivot from telling them the specific time they did something to how long ago they did something because I can't pass dates back to the Echo and expect it to translate it. Is this another silly pivot I have to make?

解决方案

It looks like you cannot (yet) detect the user's timezone, but you should still be able to achieve your goals. A few thoughts:

  • You could just make the system ignorant of timezones altogether. Each user may have a different timezone, but all times for a particular user will be in the same timezone so any duration calculations will work fine.
  • There is no DATETIME slot type, so you need to handle each slot separately as AMAZON.DATE and AMAZON.TIME. e.g. "Mark completion on {DATE} at {TIME}"
  • Also, if you are real-world marking completion datetime, can you just generate the timestamp inside your code, rather than making them say it?
  • Requesting Zip could be a quick way to set timezone, if necessary.
  • Hacky: If you use Account Linking you may be able to detect their timezone from the client-side on your login page.

Converting between server timetamp and spoken times in the user's timezone will be problematic, but perhaps you can work around it until amazon includes timezone data.

这篇关于Alexa技能自定义日期时间插槽的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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