简体   繁体   中英

What can be used to return Neo4J data from a promise in a dialog context or waterfallStepContext step within the Microsoft Bot Framework Nodejs

In this waterfall step,

public async processRequest(stepContext: WaterfallStepContext): Promise<DialogTurnResult> { ...

I am trying to return or end the dialog with the following,

return await stepContext.endDialog(JSON.stringify(dataPayload));

However I can't return the step inside of the session.run(query) result.

Is there a way to use the Waterfall step to have a response function to return the stepContext?

Here is the sample Neo4j driver session,

session
  .run(query)
  .subscribe({
   onNext: function (record) {
   console.log(record);
   // return await stepContext.endDialog(JSON.stringify('dataPayload')); <-- not intiating
  },
  onCompleted: function () {
  session.close();
  },
  onError: function (error) {
  console.log(error);
  }
  });

If I understand the question correctly it appears that you would like to wait for the query to complete, buffering all results before proceeding in the waterfall step?

In that case use the promise api:

const result = await session.run(query);
session.close(); 
await stepContext.endDialog(JSON.stringify(dataPayload));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM