【发布时间】:2018-08-19 11:54:20
【问题描述】:
我在 Firebase 中有一个实时数据库,并在 Google Cloud 的 Dialogflow 中设置了一个代理。此代理代理正在获取有关公交路线名称的数据。最终用户被要求提供巴士号码,并且代理应该根据该路线号码获取相关信息。我可以调用数据库,但只能调用一个设定的巴士号码。
例如,下面我可以基于将snapshot.child 设置为100 来获取100 的总线信息。但我希望 snapshot.child 根据 Dialogflow 中的 askBus 参数进行更改。有什么建议么?
function handleBus(agent) {
const bus = agent.parameters.bus;
agent.add(`Thank you...`);
return admin.database().ref('Routes').once("value").then((snapshot) => {
var routeInfo = snapshot.child('100/route_desc').val();
var routeName = snapshot.child('100/route_long_name').val();
agent.add(`Bus info is ` + routeInfo + ' and is called ' + routeName);
【问题讨论】:
标签: firebase firebase-realtime-database dialogflow-es