[英]how to get a text from an user of google assistant, and response something from a sqlite db
I want to make a 'question & answer' module using an express server and a sqlite db based on my vps webhook. 我想根据我的vps webhook使用快速服务器和sqlite数据库制作一个“问答”模块。
What is the correct way? 什么是正确的方法?
Thanks 谢谢
so far i've setup (without success) something like: 到目前为止我已经设置(没有成功)类似于:
https://gist.githubusercontent.com/antonyharfield/66f3a403b0fbd7fd490fc615d190dc0c/raw/a0c104da569a60f12de9fac02735f75f962caf39/simpleServer.js to start my server and get a welcome message from the google test console, and get the mic open for the query, but I can't get more... (i'm stucked on the first post query to my server). https://gist.githubusercontent.com/antonyharfield/66f3a403b0fbd7fd490fc615d190dc0c/raw/a0c104da569a60f12de9fac02735f75f962caf39/simpleServer.js启动我的服务器并从谷歌测试控制台获取欢迎消息,并打开麦克风查询,但我不能得到更多...(我被困在我的服务器的第一个帖子查询)。 I search a minimal of working code example. 我搜索最小的工作代码示例。
Using node-red webhook relay I've got the query and the answer from the db but I cannot send it back to the assistant and I've no Idea how to do it... 使用node-red webhook中继我已经从db获得了查询和答案,但我无法将其发送回助手,我不知道如何做到这一点......
I've tried also entities first in dialogflow. 我在dialogflow中首先尝试了实体。
Fast & Simple, (no code) but I do not like it. 快速和简单,(没有代码),但我不喜欢它。
In https://console.dialogflow.com , do https://dialogflow.com/docs/entities/create-manage-entities 在https://console.dialogflow.com中 ,执行https://dialogflow.com/docs/entities/create-manage-entities
I've now two columns where the first is the result and the second the matched query, then playing around in intents i've something like this dialogflow screenshot [nb: 'numeroptl' is the name of the entity value.] 我现在有两列,其中第一列是结果,第二列是匹配的查询,然后在意图中玩游戏我喜欢这个对话框流程截图 [nb:'numeroptl'是实体值的名称。
It works but catch only the first result. 它的工作原理只能抓住第一个结果。
Trying to make it a very simple question, in my csv: 试着把它变成一个非常简单的问题,在我的csv中:
"first street", "left side", "carlo" “第一街”,“左侧”,“卡洛”
"first street", "right side", "giovanna" “第一街”,“右边”,“giovanna”
"second street", "all", "mario" “第二街”,“全部”,“马里奥”
how can i tell to google assistant as example: 我怎么能告诉谷歌助手作为例子:
and have in response: 并作出回应:
You don't show the code from the "entities system", but it sounds like this is along the lines of what you need to do. 您不会显示“实体系统”中的代码,但这听起来像是您需要做的事情。 If you're getting multiple responses from your database, you will need to either merge the responses in some way, or determine how to let the user know there is additional information that they can get, and how to get it. 如果您从数据库中获得多个响应,则需要以某种方式合并响应,或者确定如何让用户知道他们可以获得的其他信息以及如何获取它们。
Talking about the csv example, map the left column to entities . 谈到csv示例,将左列映射到实体 。 For example, in this case first street and second street can be recognized as @sys.location entities. 例如,在这种情况下,第一街道和第二街道可以被识别为@ sys.location实体。
If you enable the webhook fulfillment , the parameters you define will be sent to your server on the intent detect. 如果启用webhook实现 ,则您定义的参数将通过intent检测发送到您的服务器。
You can use these parameters to do a sql query and get the results you want. 您可以使用这些参数执行SQL查询并获得所需的结果。 Finally send the response as text, or, since you are using Google Assistant, as a RichResponse . 最后将回复作为文本发送,或者,因为您使用的是Google 智能助理,所以作为RichResponse 。
//Using dialogflow-fulfillment-nodejs
function other(agent) {
// Parameters are located in agent.parameters
let locationInput = agent.parameters.location
// Your db code here
// Response using suggestions
agent.add(new Suggestion(`Carlo (left side)`));
agent.add(new Suggestion(`Giovanna (right side)`));
}
You can find a tutorial to Dialogflow here , and dialogflow-fulfillment samples here . 你可以找到一个教程Dialogflow 这里 ,和dialogflow履行样品在这里 。
Now, you don't have to use a library for the fulfillment, just follow the API requests and response formats. 现在,您不必使用库来实现,只需遵循API 请求和响应格式即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.