无法将参数参考值分配给新变量

时间:2018-08-15 15:35:02

标签: javascript node.js actions-on-google

const bobS = new Details("Bob", "Smith", "bob@smith.com");
const janeD = new Details("Jane", "Doe", "jane@doe.com");

function Details(first, last, email) {
    this.firstName = first;
    this.lastName = last;
    this.email = email;
}    

app.intent('2.1 - Our People - person', (conv, params) => {
    let person = params.person;
    conv.close(person.lastName);
});

当我在Google助手模拟器中运行以上代码时,只要我提及bobS的名字,该意图就会为其分配参考值。从理论上讲,它应该输出Bob的姓氏,但会出现一个非常普通的错误:

  

“无法将Dialogflow响应解析为AppResponse”

奇怪的是,当我在不将参数值分配给变量的情况下进行测试时,效果很好。

const bobS = new Details("Bob", "Smith", "bob@smith.com");
const janeD = new Details("Jane", "Doe", "jane@doe.com");

function Details(first, last, email) {
    this.firstName = first;
    this.lastName = last;
    this.email = email;
}    

app.intent('2.1 - Our People - person', (conv, params) => {
    conv.close(bobS.lastName);
});

我很确定我只是没有正确地将params.person的引用值分配给变量。谁能帮我吗?预先感谢。

0 个答案:

没有答案