Skip to content

Commit

Permalink
Update AzureAIServices.java
Browse files Browse the repository at this point in the history
  • Loading branch information
chtrembl committed Feb 7, 2024
1 parent 7977230 commit 93c056d
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -206,43 +206,47 @@ public DPResponse search(String text, Classification classification) {

String filter = "";

// general product search content cards shown
if(classification.equals(Classification.SEARCH_FOR_PRODUCTS) )
{
dpResponse.setContentCard(true);
}

// specific product search content cards shown
if(!classification.equals(Classification.SEARCH_FOR_PRODUCTS))
{
dpResponse.setContentCard(true);
String category = "";
switch (dpResponse.getClassification()) {
case SEARCH_FOR_DOG_FOOD:
category = "Dog Food";
dpResponse.setContentCard(true);
break;
case SEARCH_FOR_DOG_TOYS:
category = "Dog Toy";
dpResponse.setContentCard(true);
break;
case SEARCH_FOR_CAT_FOOD:
category = "Cat Food";
dpResponse.setContentCard(true);
break;
case SEARCH_FOR_CAT_TOYS:
category = "Cat Toy";
dpResponse.setContentCard(true);
break;
case SEARCH_FOR_FISH_FOOD:
category = "Fish Food";
dpResponse.setContentCard(true);
break;
case SEARCH_FOR_FISH_TOYS:
category = "Fish Toy";
dpResponse.setContentCard(true);
break;
default:
break;
}

// no content cards shown, just product description text response
if(!classification.equals(Classification.MORE_PRODUCT_INFORMATION))
{
filter = "\"filter\": \"category/name eq '"+category+"'\",";
}
}


String body = String.format(this.semanticSearchRequestBodyBodyString,
text, filter);
Expand Down

0 comments on commit 93c056d

Please sign in to comment.