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 26, 2024
1 parent 88c02de commit 82feeeb
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ protected CompletableFuture<Void> onMessageActivity(TurnContext turnContext) {
if (azurePetStoreSessionInfo != null) {
azurePetStoreSessionInfo
.addPrompt(new Prompt(dpResponse.getClassification(), text, dpResponse.getDpResponseText()));

LOGGER.info("onMessageActivity() caching session " + azurePetStoreSessionInfo.getId() + " for text: " + text);

this.cache.put(azurePetStoreSessionInfo.getId(), azurePetStoreSessionInfo);

this.cosmosDB.storePrompt(this.cache.getIfPresent(azurePetStoreSessionInfo.getId()));
Expand Down Expand Up @@ -304,10 +307,12 @@ private AzurePetStoreSessionInfo configureSession(TurnContext turnContext, Strin
text = incomingAzurePetStoreSessionInfo.getNewText();
// turnContext.getActivity().getId() is unique per browser over the broken
// recipient for some reason
LOGGER.info("configureSession() incoming text contains new session info, caching session " + id + " for text: " + text);
this.cache.put(id, incomingAzurePetStoreSessionInfo);
azurePetStoreSessionInfo = incomingAzurePetStoreSessionInfo;
azurePetStoreSessionInfo.setId(id);
} else if (azurePetStoreSessionInfo != null) {
LOGGER.info("configureSession() incoming text does not contain new session info, using existing session " + azurePetStoreSessionInfo.getId() + " for text: " + text);
azurePetStoreSessionInfo.setNewText(text);
}

Expand Down

0 comments on commit 82feeeb

Please sign in to comment.