Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Pass qnaId in value attribute of multiturn prompts #4262

Merged
merged 1 commit into from
Jun 15, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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