Dialogflow - Node SDK 不保留会话中的上下文
Dialogflow - Node SDK does not preserve contexts within session
我正在使用 dialogflow Node SDK 将 textRequests 和 eventRequests 发送到对话流。
fulfillment webhook 显示尽管 sessionId 相同,但上下文未保留。
使用来自 actions-on-google 助手的相同 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_2,而是默认的回退意图,除非我从 dialogflow 中的 INTENT_2 中删除输入上下文然后它被触发
您可能误用了 resetContexts
?这样就可以解释了。
我正在使用 dialogflow Node SDK 将 textRequests 和 eventRequests 发送到对话流。 fulfillment webhook 显示尽管 sessionId 相同,但上下文未保留。 使用来自 actions-on-google 助手的相同 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_2,而是默认的回退意图,除非我从 dialogflow 中的 INTENT_2 中删除输入上下文然后它被触发
您可能误用了 resetContexts
?这样就可以解释了。