Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
chtrembl committed Dec 18, 2023
1 parent cdbeee8 commit 9061fc1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,10 @@ protected CompletableFuture<Void> onMessageActivity(TurnContext turnContext) {
//MessageFactory.text(this.WELCOME_MESSAGE)).thenApply(sendResult -> null);
//}
}
else
{
return null;
}
//if we have user state in the turn context use that instead
//else if (sessionID != null && csrfToken != null) {
// azurePetStoreSessionInfo = new AzurePetStoreSessionInfo(sessionID, csrfToken, text);
Expand All @@ -123,27 +127,18 @@ protected CompletableFuture<Void> onMessageActivity(TurnContext turnContext) {
dpResponse = this.azurePetStore.updateCart(azurePetStoreSessionInfo, dpResponse.getResponseProductIDs().get(0));
}
}
else {
dpResponse.setDpResponseText("Once I get your session information, I will be able to update your shopping cart.");
}
break;
case VIEW_SHOPPING_CART:
if(azurePetStoreSessionInfo != null)
{
dpResponse = this.azurePetStore.viewCart(azurePetStoreSessionInfo);
}
else {
dpResponse.setDpResponseText("Once I get your session information, I will be able to display your shopping cart.");
}
break;
case PLACE_ORDER:
if(azurePetStoreSessionInfo != null)
{
dpResponse = this.azurePetStore.completeCart(azurePetStoreSessionInfo);
}
else {
dpResponse.setDpResponseText("Once I get your session information, I will be able to place your order.");
}
break;
case SEARCH_FOR_PRODUCTS:
dpResponse = this.azureOpenAI.completion(text, dpResponse.getClassification());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@
import com.chtrembl.petstoreassistant.service.AzureOpenAI.Classification;

public class DPResponse {
Classification classification = null;
private Classification classification = null;
private String dpResponseText = "I am not sure how to handle that.";
List<Product> products = null;
List<String> responseProductIDs = null;
boolean updateCart = false;
boolean completeCart = false;

private List<Product> products = null;
private List<String> responseProductIDs = null;
private boolean updateCart = false;
private boolean completeCart = false;
private String aoaiResponse = null;

public DPResponse() {
super();
}
Expand Down Expand Up @@ -56,4 +57,10 @@ public boolean isCompleteCart() {
public void setCompleteCart(boolean completeCart) {
this.completeCart = completeCart;
}
public String getAoaiResponse() {
return aoaiResponse;
}
public void setAoaiResponse(String aoaiResponse) {
this.aoaiResponse = aoaiResponse;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public DPResponse completion(String text, Classification classification) {
dpResponse.setDpResponseText(PetStoreAssistantUtilities.cleanDataFromAOAIResponseContent(content));
break;
}

dpResponse.setAoaiResponse(content);
LOGGER.info("completion response for text {} was {}", text, content);
}
} catch (Exception e) {
Expand Down

0 comments on commit 9061fc1

Please sign in to comment.