Search in sources :

Example 26 with Reprompt

use of com.amazon.speech.ui.Reprompt in project amos-ss17-alexa by c-i-ber.

the class AmosAlexaSpeechlet method getHelpResponse.

/**
     * Creates a {@code SpeechletResponse} for the help intent.
     *
     * @return SpeechletResponse spoken and visual response for the given intent
     */
private SpeechletResponse getHelpResponse() {
    String speechText = "You can say hello to me!";
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("HelloWorld");
    card.setContent(speechText);
    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);
    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);
    return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
Also used : SimpleCard(com.amazon.speech.ui.SimpleCard) Reprompt(com.amazon.speech.ui.Reprompt) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 27 with Reprompt

use of com.amazon.speech.ui.Reprompt in project amos-ss17-alexa by c-i-ber.

the class AmosAlexaSpeechlet method getWelcomeResponse.

/**
     * Creates and returns a {@code SpeechletResponse} with a welcome message.
     *
     * @return SpeechletResponse spoken and visual response for the given intent
     */
private SpeechletResponse getWelcomeResponse() {
    String speechText = "Welcome to the Alexa Skills Kit, you can say hello";
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("HelloWorld");
    card.setContent(speechText);
    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);
    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);
    return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
Also used : SimpleCard(com.amazon.speech.ui.SimpleCard) Reprompt(com.amazon.speech.ui.Reprompt) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 28 with Reprompt

use of com.amazon.speech.ui.Reprompt in project amos-ss17-alexa by c-i-ber.

the class AmosAlexaSpeechlet method getCreditLimitResponse.

/**
     * Creates and returns a {@code SpeechletResponse} with the current account balance.
     *
     * @return SpeechletResponse spoken and visual response for the given intent
     */
private SpeechletResponse getCreditLimitResponse() {
    double creditLimit = 2000.91;
    String speechText = "Your credit limit is " + Double.toString(creditLimit);
    // Create the Simple card content.
    SimpleCard card = new SimpleCard();
    card.setTitle("CreditLimit");
    card.setContent(speechText);
    // Create the plain text output.
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText(speechText);
    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);
    return SpeechletResponse.newAskResponse(speech, reprompt, card);
}
Also used : SimpleCard(com.amazon.speech.ui.SimpleCard) Reprompt(com.amazon.speech.ui.Reprompt) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Example 29 with Reprompt

use of com.amazon.speech.ui.Reprompt in project amos-ss17-alexa by c-i-ber.

the class StandingOrderService method getCorrectionResponse.

/**
 * Creates a {@code SpeechletResponse} that asks the user if he wants to correct his previous input.
 * Should be called after an Amazon.NoIntent
 *
 * @return SpeechletResponse spoken and visual response for the given intent
 */
private SpeechletResponse getCorrectionResponse(Intent intent, Session session) {
    String dialogContext = (String) session.getAttribute(DIALOG_CONTEXT);
    LOGGER.info("Context: " + dialogContext);
    Map<String, Slot> slots = intent.getSlots();
    LOGGER.info("Slots: " + slots);
    String standingOrderToModify = (String) session.getAttribute("StandingOrderToModify");
    // Default
    String answer = "Okay, bitte wiederhole die Anweisung oder breche den Vorgang ab, indem du \"Alexa, Stop!\" sagst.";
    if (dialogContext.equals("StandingOrderDeletion")) {
        answer = "Okay, sage die Nummer des Dauerauftrags, den du stattdessen loeschen willst oder " + "breche den Vorgang ab, indem du \"Alexa, Stop!\" sagst.";
    } else if (dialogContext.equals("StandingOrderModification")) {
        answer = "Okay, den Betrag, auf den du Dauerauftrag Nummer " + standingOrderToModify + " stattdessen" + " aendern willst, wiederhole die gesamte Aenderungsanweisung oder breche den Vorgang ab, indem du" + " \"Alexa, Stop!\" sagst.";
    }
    answer = "<speak>\n" + "    <emphasis level=\"reduced\">" + answer + "</emphasis> \n" + "</speak>";
    SsmlOutputSpeech speech = new SsmlOutputSpeech();
    speech.setSsml(answer);
    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);
    return SpeechletResponse.newAskResponse(speech, reprompt);
}
Also used : Reprompt(com.amazon.speech.ui.Reprompt) Slot(com.amazon.speech.slu.Slot) SsmlOutputSpeech(com.amazon.speech.ui.SsmlOutputSpeech)

Example 30 with Reprompt

use of com.amazon.speech.ui.Reprompt in project amos-ss17-alexa by c-i-ber.

the class StandingOrderService method smartCreateStandingOrderResponse.

/**
 * Creates a {@code SpeechletResponse} for the standing orders intent.
 *
 * @return SpeechletResponse spoken and visual response for the given intent
 */
private SpeechletResponse smartCreateStandingOrderResponse(Session session) {
    SimpleCard card = new SimpleCard();
    card.setTitle("Daueraufträge");
    LOGGER.info("SmartStandingOrders create called.");
    int standingOrderToModify = (int) session.getAttribute("StandingOrderToModify");
    String newAmount = (String) session.getAttribute("NewAmount");
    StandingOrder oldStandingOrder = AccountAPI.getStandingOrder(ACCOUNT_NUMBER, standingOrderToModify);
    StandingOrder standingOrder = new StandingOrder();
    standingOrder.setAmount(Integer.parseInt(newAmount));
    standingOrder.setDescription("description");
    standingOrder.setDestinationAccount(oldStandingOrder.getDestinationAccount());
    standingOrder.setExecutionRate(oldStandingOrder.getExecutionRate());
    standingOrder.setFirstExecution(oldStandingOrder.getFirstExecution());
    standingOrder.setPayee(oldStandingOrder.getPayee());
    standingOrder.setSourceAccount(oldStandingOrder.getSourceAccount());
    standingOrder.setStatus(oldStandingOrder.getStatus());
    AccountAPI.createStandingOrderForAccount(ACCOUNT_NUMBER, standingOrder);
    // Create the plain text output
    PlainTextOutputSpeech speech = new PlainTextOutputSpeech();
    speech.setText("Der neue Dauerauftrag für " + oldStandingOrder.getPayee().toLowerCase() + " über " + newAmount + " Euro wurde erfolgreich eingerichtet");
    // delete session attributes
    session.removeAttribute("SmartCreateStandingOrderIntent");
    session.removeAttribute("StandingOrderToModify");
    session.removeAttribute("NewAmount");
    // Create reprompt
    Reprompt reprompt = new Reprompt();
    reprompt.setOutputSpeech(speech);
    return SpeechletResponse.newTellResponse(speech, card);
}
Also used : StandingOrder(model.banking.StandingOrder) SimpleCard(com.amazon.speech.ui.SimpleCard) Reprompt(com.amazon.speech.ui.Reprompt) PlainTextOutputSpeech(com.amazon.speech.ui.PlainTextOutputSpeech)

Aggregations

Reprompt (com.amazon.speech.ui.Reprompt)30 PlainTextOutputSpeech (com.amazon.speech.ui.PlainTextOutputSpeech)22 Slot (com.amazon.speech.slu.Slot)10 SimpleCard (com.amazon.speech.ui.SimpleCard)10 SsmlOutputSpeech (com.amazon.speech.ui.SsmlOutputSpeech)9 ArrayList (java.util.ArrayList)4 StandingOrder (model.banking.StandingOrder)3 List (java.util.List)2 Card (model.banking.Card)2 StandingOrder (model.banking.account.StandingOrder)2 Contact (model.db.Contact)2 ApiHelper (amosalexa.ApiHelper)1 SpeechletException (com.amazon.speech.speechlet.SpeechletException)1 JSONException (com.amazonaws.util.json.JSONException)1 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 IOException (java.io.IOException)1 DateFormat (java.text.DateFormat)1 SimpleDateFormat (java.text.SimpleDateFormat)1 LinkedList (java.util.LinkedList)1 Security (model.banking.Security)1