Skip to content

Commit

Permalink
Pass qnaId in value attribute of multiturn prompts (#4262)
Browse files Browse the repository at this point in the history
  • Loading branch information
Arsh-Kashyap authored Jun 15, 2022
1 parent 9c4f44d commit a39a86b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
6 changes: 4 additions & 2 deletions libraries/botbuilder-ai/src/qnaCardBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ export class QnACardBuilder {

result.context?.prompts?.forEach((prompt) => {
buttonList.push({
value: prompt.displayText,
type: 'imBack',
value: prompt.qnaId,
type: 'messageBack',
title: prompt.displayText,
text: prompt.displayText,
displayText: prompt.displayText,
});
});

Expand Down
12 changes: 10 additions & 2 deletions libraries/botbuilder-ai/src/qnaMakerDialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -749,8 +749,16 @@ export class QnAMakerDialog extends WaterfallDialog implements QnAMakerDialogCon
}

private resetOptions(dc: DialogContext, dialogOptions: QnAMakerDialogOptions) {
// Resetting context and QnAId
dialogOptions.qnaMakerOptions.qnaId = 0;
// Resetting QnAId if not present in value
const qnaIdFromContext = dc.context.activity.value;

if (qnaIdFromContext != null) {
dialogOptions.qnaMakerOptions.qnaId = qnaIdFromContext;
} else {
dialogOptions.qnaMakerOptions.qnaId = 0;
}

// Resetting context
dialogOptions.qnaMakerOptions.context = { previousQnAId: 0, previousUserQuery: '' };

// Check if previous context is present, if yes then put it with the query
Expand Down

0 comments on commit a39a86b

Please sign in to comment.