重复最后一句话 [英] Repeat last sentence

查看:89
本文介绍了重复最后一句话的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Google行动和Dialogflow来构建机器人.

我想知道如何在用户询问时轻松地重复最后一句话(请重复").

一种方法是在Dialogflow中具有重复的跟踪意图,但是由于:

  • 您需要在每个意图之后添加一个,而我有很多
  • 在多用户环境中,您需要跟踪每个用户的最后一句话...

有人知道如何做到这一点吗?

解决方案

广义上讲,最好的方法是利用Dialogflow

@SysCoder有一个程序包,可帮助您为node.js执行此操作

澄清

这假设您正在通过实现来生成响应.在这种情况下,将要发送回的消息保存在两个位置而不是一个位置应该相当容易.诸如语音中继器

I am using actions-on-google and Dialogflow to build a bot.

I was wondering how I can easily repeat the last sentence when asked by the user ("repeat please").

One way would be to have repeat followup intents in Dialogflow but this is quite heavy since :

  • you need to add one after each intent and I have many
  • in a multi-user environment you need to keep track of the last sentence for every user ...

Does anyone know how to accomplish this?

解决方案

Broadly speaking, the best way would be to take advantage of Dialogflow Contexts. As you send the message, you can also add that message to a context (for example, you can call it "last_message"). You can then have another Intent that takes as an input context the "last_message" context and, if triggered, uses the value saved in the context to repeat it.

@SysCoder has a package that will help you do this for node.js.

Clarification

This assumes that you're generating the response through fulfillment. In cases like this, it should be fairly easy to save the message you're sending back in two places, rather than one. Libraries such as voice-repeater or multivocal handle much of this for you, but it isn't difficult to do yourself.

If you're handling all the replies through the Response section of the GUI, then this approach wouldn't work.

这篇关于重复最后一句话的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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