我正在从https://dialogflow.com/docs/getting-started/integrate-services-actions-on-google
观看本教程。我已经设置了“名称”意图,配置了几个训练短语,以及一个响应。见下文。
训练短语:
响应: 我叫Dialogflow!
然后,我转到“实现”部分,启用了内联编辑器并粘贴了以下代码:
/**
* Copyright 2018 Google Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
const functions = require('firebase-functions')
const { dialogflow } = require('actions-on-google')
const app = dialogflow()
app.intent('Default Welcome Intent', conv => {
conv.ask('Welcome to my agent!')
})
app.intent('Default Fallback Intent', conv => {
conv.ask(`I didn't understand`)
conv.ask(`I'm sorry, can you try again?`)
})
app.intent('Name', conv => {
conv.ask('My name is Dialogflowwwww!')
})
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app)
然后单击“部署”。
然后转到“名称”意图,并向下滚动到“实现”部分并启用“为此意图启用webhook调用”。
再次进入“实现”并单击“部署”。
现在,在测试聊天窗口中,当我输入“您叫什么名字?”时,我收到了来自意图的响应-即“我的名字是Dialogflow!”
但是,我期望Fulfillment内联编辑器代码的答复是-“我的名字是Dialogflowwwww!”。
这里可能是什么问题?
答案 0 :(得分:1)
在“用于Google控制台的操作”中尝试此操作,方法是点击所示图片中的“ Google助手”链接。
这是因为您已使用Google助手的“谷歌操作”客户端库。
https://github.com/actions-on-google/actions-on-google-nodejs
答案 1 :(得分:0)
从意图定义内的“默认”响应中删除响应