Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 955b836

Browse files
authored
[QnA] Fix MultiTurnPrompt QnA conversation (#1204)
* Fix MultiTurn QnA conversation * Fix linter issue
1 parent 4a73dc2 commit 955b836

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

libraries/bot-ai-qna/src/main/java/com/microsoft/bot/ai/qna/dialogs/QnAMakerDialog.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -854,13 +854,9 @@ private CompletableFuture<DialogTurnResult> callGenerateAnswer(WaterfallStepCont
854854

855855
// Calling QnAMaker to get response.
856856
return this.getQnAMakerClient(stepContext).thenApply(qnaMakerClient -> {
857-
QueryResults response =
858-
(QueryResults) stepContext.getState().get(String.format("turn.qnaresult%s", this.hashCode()));
859-
if (response == null) {
860-
response = qnaMakerClient
857+
QueryResults response = qnaMakerClient
861858
.getAnswersRaw(stepContext.getContext(), dialogOptions.getQnAMakerOptions(), null, null)
862859
.join();
863-
}
864860

865861
// Resetting previous query.
866862
Integer previousQnAId = -1;
@@ -980,8 +976,11 @@ private CompletableFuture<DialogTurnResult> checkForMultiTurnPrompt(WaterfallSte
980976

981977
if (answer.getContext() != null && answer.getContext().getPrompts().length > 0) {
982978
Map<String, Integer> previousContextData =
983-
ObjectPath.getPathValue(stepContext.getActiveDialog().getState(), QNA_CONTEXT_DATA, Map.class);
984-
979+
ObjectPath.getPathValue(
980+
stepContext.getActiveDialog().getState(),
981+
QNA_CONTEXT_DATA,
982+
Map.class,
983+
new HashMap<>());
985984
for (QnAMakerPrompt prompt : answer.getContext().getPrompts()) {
986985
previousContextData.put(prompt.getDisplayText(), prompt.getQnaId());
987986
}

0 commit comments

Comments
 (0)