我正在使用dialogflow节点SDK向dialogflow发送textRequests和eventRequests。
fulfillment webhook显示,尽管sessionId相同,但上下文没有被保留。
使用来自google assistant上操作的同一dialogflow代理时,上下文将被保留。
所以唯一的区别是我使用Node SDK发送文本。
this.app = apiai(CLIENT_ACCESS_TOKEN);
this.options = {
sessionId: 'abc',
originalRequest: {
data: {
user: 'temp_user'
},
conversation: {
"conversationId": "123456789"
}
}
};
const request = this.app.textRequest('This is captured by INTENT_1 that triggers
a webhook that sets context to MY_CONTEXT', options);
const request = this.app.textRequest('This should be captured by INTENT_2
that has an input context of MY_CONTEXT', options);
第二个请求不会触发INTENT\u 2,而是默认的回退意图,除非我在dialogflow中从INTENT\u 2中删除输入上下文,然后触发它