diff --git a/js/Dialogflow_V2.js b/js/Dialogflow_V2.js index a04f0a6..e23a399 100644 --- a/js/Dialogflow_V2.js +++ b/js/Dialogflow_V2.js @@ -147,8 +147,8 @@ export class Dialogflow_V2 { } resetContexts(onResult, onError) { - let request = new ResetContextsRequest(this.client.getAccessToken(), this.client.getSessionId(), null); - request.perform().then(res => onResult(res)).catch(err => onError(err)); + let request = new ResetContextsRequest(this.accessToken, this.sessionId, this.projectId, null); + request.perform().then(res => onResult(res)).catch(err => onError(err)); }; /** diff --git a/js/ResetContextsRequest.js b/js/ResetContextsRequest.js index facc096..0f58e32 100644 --- a/js/ResetContextsRequest.js +++ b/js/ResetContextsRequest.js @@ -3,17 +3,15 @@ */ import { ApiAiRequestError } from "./Errors"; import XhrRequest from './XhrRequest'; -export const DEFAULT_BASE_URL = "https://api.api.ai/v1/"; - +export const DEFAULT_BASE_URL = "https://dialogflow.googleapis.com/v2/"; class ResetContextsRequest { - constructor(accessToken, sessionId, contextName) { + constructor(accessToken, sessionId, projectId, contextName) { if (contextName != null) { this.uri = DEFAULT_BASE_URL + "contexts/" + contextName + "?sessionId=" + sessionId; } else { - this.uri = DEFAULT_BASE_URL + "contexts?sessionId=" + sessionId; - } + this.uri = DEFAULT_BASE_URL + "projects/" + projectId + "/agent/sessions/" + sessionId + "/contexts"; } this.headers = { Authorization: "Bearer " + accessToken,