Skip to content

Commit

Permalink
Update PetStoreAssistantBot.java
Browse files Browse the repository at this point in the history
  • Loading branch information
chtrembl committed Jan 8, 2024
1 parent 5c214f0 commit 862a7cd
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ protected CompletableFuture<Void> onMessageActivity(TurnContext turnContext) {

switch (dpResponse.getClassification()) {
case UPDATE_SHOPPING_CART:
dpResponse.setClassification(Classification.UPDATE_SHOPPING_CART);
if (azurePetStoreSessionInfo != null) {
dpResponse = this.azureOpenAI.search(text, Classification.SEARCH_FOR_PRODUCTS);
if (dpResponse.getProducts() != null) {
Expand All @@ -124,13 +125,15 @@ protected CompletableFuture<Void> onMessageActivity(TurnContext turnContext) {
}
break;
case VIEW_SHOPPING_CART:
dpResponse.setClassification(Classification.VIEW_SHOPPING_CART);
if (azurePetStoreSessionInfo != null) {
dpResponse = this.azurePetStore.viewCart(azurePetStoreSessionInfo);
} else {
dpResponse.setDpResponseText("view shopping cart request without session... text: " + text);
}
break;
case PLACE_ORDER:
dpResponse.setClassification(Classification.PLACE_ORDER);
if (azurePetStoreSessionInfo != null) {
dpResponse = this.azurePetStore.completeCart(azurePetStoreSessionInfo);
} else {
Expand Down Expand Up @@ -282,11 +285,11 @@ private CompletableFuture<Void> getDebug(TurnContext turnContext, String text,
attachment.setContentType("application/json");

attachment.setContent(new Gson().fromJson(jsonString, JsonObject.class));
attachment.setName("public-content-card");
attachment.setName("public-buttonWithImage");

return turnContext.sendActivity(
MessageFactory.attachment(attachment,
"I have something nice to show @showcards(content-card) you."))
"I have something nice to show @showcards(buttonWithImage) you."))
.thenApply(sendResult -> null);
}

Expand Down

0 comments on commit 862a7cd

Please sign in to comment.