diff --git a/dialogflow/snippets/src/main/java/com/example/dialogflow/DetectIntentKnowledge.java b/dialogflow/snippets/src/main/java/com/example/dialogflow/DetectIntentKnowledge.java index 4fc3243ef57..04484eb50df 100644 --- a/dialogflow/snippets/src/main/java/com/example/dialogflow/DetectIntentKnowledge.java +++ b/dialogflow/snippets/src/main/java/com/example/dialogflow/DetectIntentKnowledge.java @@ -80,7 +80,11 @@ public static Map detectIntentKnowledge( System.out.format( "Detected Intent: %s (confidence: %f)\n", queryResult.getIntent().getDisplayName(), queryResult.getIntentDetectionConfidence()); - System.out.format("Fulfillment Text: '%s'\n", queryResult.getFulfillmentText()); + System.out.format( + "Fulfillment Text: '%s'\n", + queryResult.getFulfillmentMessagesCount() > 0 + ? queryResult.getFulfillmentMessages(0).getText() + : "Triggered Default Fallback Intent"); KnowledgeAnswers knowledgeAnswers = queryResult.getKnowledgeAnswers(); for (Answer answer : knowledgeAnswers.getAnswersList()) { System.out.format(" - Answer: '%s'\n", answer.getAnswer());