Open diamondobama opened 4 years ago
Ok, I managed to solve this by digging a little deeper into the source code. I will outline my steps below.
As mentioned here, environment is assumed to be draft
and user to be -
if none is set.
You need Dialogflow v2beta1, in botlib/dialogflow_session_client.js, change
"dialogflow": "0.8.0"
to
"dialogflow": "0.9.1"
Change the constructor in botlib/dialogflow_session_client.js, from
constructor(projectId){
this.sessionClient = new dialogflow.SessionsClient();
this.projectId = projectId;
}
to
constructor(projectId, environmentId, userId){
this.sessionClient = new dialogflow.v2beta1.SessionsClient();
this.projectId = projectId;
this.environmentId = environmentId;
this.userId = userId;
}
detectIntent...
promise, change const sessionPath = this.sessionClient.sessionPath(
this.projectId, sessionId);
to
const sessionPath = this.sessionClient.environmentSessionPath(
this.projectId, this.environmentId, this.userId, sessionId);
const environmentId = 'YOUR_ENVIRONMENT_NAME';
const userId = 'ANY_36_CHARACTER_OR_LESS';
In the same server.js, change this line
const sessionClient = new dialogflowSessionClient(projectId);
to
const sessionClient = new dialogflowSessionClient(projectId, environmentId, userId);
Then re-deploy your integration using Cloud Run as per the instructions in the README.md
I will leave this open for now, for future visitors to easily find.
diamondobama, thanks for reporting the issue. Dialogflow team will be working on an improvement to support environment.
On the console, we are able to specify which environment to deploy to a particular integration and we are able to deploy incrementally with versions. For instance: we have Draft, QA, Staging, and Production.
How do we do the same with Cloud Run? Right now it seems to just use whatever is in the draft.