简体   繁体   English

IBM Watson Assistant:如何确保退房日期晚于入住日期

[英]IBM Watson Assistant: How to ensure check-out date is after check-in date

I am creating a hotel room booking chat bot using IBM Watson Assistant.我正在使用 IBM Watson Assistant 创建酒店客房预订聊天机器人。 How can I make sure (probably with conditions) that the check-out date entered by the client is after the check-in date they entered?我如何确保(可能有条件地)客户输入的退房日期在他们输入的入住日期之后? Conditions in Watson Assistant can only compare a date relative to a user time and not to the input! Watson Assistant 中的条件只能比较相对于用户时间的日期,而不是输入! The image here process will show the process that I am working on.此处的图像过程将显示我正在处理的过程。

You can use context variables or entities.您可以使用上下文变量或实体。

With context variables, save the dates into context variables.使用上下文变量,将日期保存到上下文变量中。 You can then compare the two date context variables, using any of the date comparison methods - https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-methods#dialog-methods-date-time然后,您可以使用任何日期比较方法来比较两个日期上下文变量 - https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-methods#dialog-methods-date-time

<? $checkinDate.before($checkoutDate) ?>

If you use entities pulled out from the input, then this will be:如果您使用从输入中提取的实体,那么这将是:

<? @checkinDate.before(@checkoutDate) ?>

You can also mix and match, say you have the checkinDate already (and its in the future) and you have stashed the value in context.您还可以混合搭配,假设您已经拥有 checkinDate(以及未来的)并且您已将值存储在上下文中。 Then your next utterance may ask for the checkout date, in which case your check becomes.然后你的下一句话可能会询问结账日期,在这种情况下你的支票就变成了。

<? $checkinDate.before(@checkoutDate) ?>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM