gpt4 book ai didi

node.js - Dialogflow - Node SDK 不保留 session 中的上下文

转载 作者:搜寻专家 更新时间:2023-10-31 22:49:16 25 4
gpt4 key购买 nike

我正在使用 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 吗?这样就可以解释了。

关于node.js - Dialogflow - Node SDK 不保留 session 中的上下文,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47885172/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com