Dialogflow - 节点SDK不保留会话中的上下文

问题描述 投票:5回答:1

我正在使用dialogflow Node SDK将textRequests和eventRequests发送到对话框流。履行webhook显示虽然sessionId是相同的,但不保留上下文。使用来自action-on-google助手的相同对话框流程代理,将保留上下文。所以唯一的区别是我使用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,而是触发默认的回退意图,除非我从对话框流中的INTENT_2中删除输入上下文然后触发它

node.js actions-on-google dialogflow
1个回答
2
投票

你可能错误地使用resetContexts?这可以解释它。

© www.soinside.com 2019 - 2024. All rights reserved.