@@ -22,26 +22,22 @@ public QnABot(Configuration withConfiguration) {
2222
2323 @ Override
2424 protected CompletableFuture <Void > onMessageActivity (TurnContext turnContext ) {
25- QnAMakerEndpoint qnAMakerEndpoint = new QnAMakerEndpoint () {
26- {
27- setKnowledgeBaseId (configuration .getProperty ("QnAKnowledgebaseId" ));
28- setEndpointKey (configuration .getProperty ("QnAEndpointKey" ));
29- setHost (configuration .getProperty ("QnAEndpointHostName" ));
30- }
31- };
25+ QnAMakerEndpoint qnAMakerEndpoint = new QnAMakerEndpoint () {{
26+ setKnowledgeBaseId (configuration .getProperty ("QnAKnowledgebaseId" ));
27+ setEndpointKey (configuration .getProperty ("QnAEndpointKey" ));
28+ setHost (configuration .getProperty ("QnAEndpointHostName" ));
29+ }};
3230
3331 QnAMaker qnaMaker = new QnAMaker (qnAMakerEndpoint , null );
3432
3533 LoggerFactory .getLogger (QnABot .class ).info ("Calling QnA Maker" );
3634
37- QnAMakerOptions options = new QnAMakerOptions () {
38- {
39- setTop (1 );
40- }
41- };
35+ QnAMakerOptions options = new QnAMakerOptions () {{
36+ setTop (1 );
37+ }};
4238
4339 // The actual call to the QnA Maker service.
44- qnaMaker .getAnswers (turnContext , options )
40+ return qnaMaker .getAnswers (turnContext , options )
4541 .thenCompose (response -> {
4642 if (response != null && response .length > 0 ) {
4743 return turnContext .sendActivity (MessageFactory .text (response [0 ].getAnswer ()))
@@ -52,7 +48,5 @@ protected CompletableFuture<Void> onMessageActivity(TurnContext turnContext) {
5248 .thenApply (sendResult -> null );
5349 }
5450 });
55-
56- return CompletableFuture .completedFuture (null );
5751 }
5852}
0 commit comments