LoginSignup
3
0

More than 3 years have passed since last update.

[メモ]Alexaハッカソンに参加してASK SDK for Pythonで開発してみたら困ったことや小ネタ

Posted at

すみません、以下は殴り書きです。
公式のフォーラムに清書しようかなと思います。

永続アトリビュート の サンプルコードはどこに!?

ask new で high low game を選択するとsrc見れる

ユーザーからの返事がなかった時の発話 reprompt

なんで関数名がちがうんだろう

Node.jsは reprompt

const LaunchRequestHandler = {
  canHandle(handlerInput) {
    return handlerInput.requestEnvelope.request.type === 'LaunchRequest';
  },
  handle(handlerInput) {
    const speechText = 'ようこそ、アレクサスキルキットへ。こんにちは、と言ってみてください。';

    return handlerInput.responseBuilder
      .speak(speechText)
      .reprompt(speechText)
      .withSimpleCard('ハローワールド', speechText)
      .getResponse();
  },
};

Python3は ask

class LaunchRequestHandler(AbstractRequestHandler):
    """スキルを起動するハンドラーです。"""
    def can_handle(self, handler_input):
        # type: (HandlerInput) -> bool
        return is_request_type("LaunchRequest")(handler_input)

    def handle(self, handler_input):
        # type: (HandlerInput) -> Response
        speech_text = "ようこそ、アレクサスキルキットへ。こんにちは、と言ってみてください。"

        handler_input.response_builder.speak(speech_text).ask(
            "続けて、こんにちは、と言ってみてください。").set_card(
            SimpleCard("ハローワールド", speech_text))
        return handler_input.response_builder.response

Cloneするとvenvとlambda/pyがまとめられちゃう

概要

.venv内の pip のパッケージ一覧と、自分のsourceが同じDirにまとめられちゃう

再現手順

  1. ask clone

  2. あなたのAlexa project(python)を選択

で、自分でdeployしたprojectをcloneすると、

  • .venv/skill_env/lib/python3.7/site-packages/ 内の modules
  • skill.json/manifest.apis.custom.endpoint.sourceDir で定義したprojectのsource

が、lambda/${skill.json/manifest.apis.custom.endpoint.uri} にまとめられている...

Cloneすると、 .venv がない

requirements.txt はあるので、 .venv を自作するのかな...?
何も考えずにvenv作ってpip installするだけでは、lambdaにpackageを追加できなかった

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0