Forum Discussion

VijayDev23's avatar
VijayDev23
Copper Contributor
Jun 29, 2023

Waterfall Dialog Second step not waiting

//Code within my function that creates the dialog state
 
const memoryStorage = new MemoryStorage();
const conversationState = new ConversationState(memoryStorage);
const dialogStateProperty = conversationState.createProperty('dialogState');
const dialogSet = new DialogSet(dialogStateProperty);

 

const textPrompt = new TextPrompt('textPrompt');
dialogSet.add(textPrompt);
const waterfallSteps: WaterfallStep[] = [
askQuestion.bind(this),
processResponse.bind(this),
];
 
const waterfallDialog = new WaterfallDialog('waterfallDialog', waterfallSteps);
dialogSet.add(waterfallDialog);

 

async function askQuestion(stepContext😞 Promise<DialogTurnResult<any>> {
return await stepContext.prompt('textPrompt', 'Please enter your question.');
//return stepContext.next();
}

 

 
async function processResponse(stepContext😞 Promise<DialogTurnResult<any>> {
console.log("hi");
const answer = stepContext.result as string;
console.log(answer)
}
 
//Code that instantiates the dialog
const dialogContext = await dialogSet.createContext(context);
await dialogContext.beginDialog('waterfallDialog');
 
 
My dialog will start running however after the question is asked to the user and the user inputs something it simply waits and does not execute the rest of the dialog which in this case simply prints to the console what the user typed. Is there something missing in my askQuestion method that is not allowing the waterfall dialog to continue.
Thanks

Resources