35 lines
848 B
Python
35 lines
848 B
Python
|
|
import logging
|
||
|
|
|
||
|
|
from flask import Blueprint, render_template
|
||
|
|
from flask_ask import Ask, question, statement
|
||
|
|
|
||
|
|
|
||
|
|
blueprint = Blueprint('blueprint_api', __name__, url_prefix="/ask")
|
||
|
|
ask = Ask(blueprint=blueprint)
|
||
|
|
|
||
|
|
logging.getLogger('flask_ask').setLevel(logging.DEBUG)
|
||
|
|
|
||
|
|
|
||
|
|
@ask.launch
|
||
|
|
def launch():
|
||
|
|
speech_text = render_template('welcome')
|
||
|
|
return question(speech_text).reprompt(speech_text).simple_card('HelloWorld', speech_text)
|
||
|
|
|
||
|
|
|
||
|
|
@ask.intent('HelloWorldIntent')
|
||
|
|
def hello_world():
|
||
|
|
speech_text = render_template('hello')
|
||
|
|
return statement(speech_text).simple_card('HelloWorld', speech_text)
|
||
|
|
|
||
|
|
|
||
|
|
@ask.intent('AMAZON.HelpIntent')
|
||
|
|
def help():
|
||
|
|
speech_text = render_template('help')
|
||
|
|
return question(speech_text).reprompt(speech_text).simple_card('HelloWorld', speech_text)
|
||
|
|
|
||
|
|
|
||
|
|
@ask.session_ended
|
||
|
|
def session_ended():
|
||
|
|
return "{}", 200
|
||
|
|
|