現在JavaでAlexaのカスタムスキルを構築中です。JavaがAlexaカスタムスキルに足りないスロットを尋ねる
私はAlexaが既存のExchange Serverを使用して予定を設定するようにします。
私はAlexaが名前を確認してほしい、日付と時刻がユーザーによって与えられることを望みます。
場合(date.getValue()== NULL){ 戻りaskResponse( "予定を作成するために、日付を与えてください")
何が起こることはアレクサです:if文のような私はそう使用してください失われたスロットを尋ねるが、私がスキルに答えると、ただ終了する。私はAlexaに私の反応を認識させる方法を知らない。次のように
コードは次のとおりです。ここで
public SpeechletResponse getTerminResponse(Slot name, Slot date, Slot time, Session session, IntentRequest request) throws Exception {
if(time.getValue() == null) {
return askResponse("Please insert time");
} else if (date.getValue() == null) {
return askResponse("Please insert date");
} else if (name.getValue() == null) {
return askResponse("Please insert name");
} else {
try {
String[] datumArray = date.getValue().split("-");
String[] zeitArray = time.getValue().split(":");
Date startDate = new Date((Integer.parseInt(datumArray[0])-1900), (Integer.parseInt(datumArray[1])-1), (Integer.parseInt(datumArray[2])), (Integer.parseInt(zeitArray[0])), (Integer.parseInt(zeitArray[1])), 0);
Date endDate = new Date((Integer.parseInt(datumArray[0])-1900), (Integer.parseInt(datumArray[1])-1), (Integer.parseInt(datumArray[2])), (Integer.parseInt(zeitArray[0]))+1, (Integer.parseInt(zeitArray[1])), 0);
System.out.println(startDatum.toString());
System.out.println(endDatum.toString());
ExchangeHelper eh = new ExchangeHelper();
eh.createMeeting(name.getValue(), "Test", startDate, endDate);
return getTellSpeechletResponse("Appointment created successfully");
} catch (Exception e) {
System.out.println(e);
return askResponse("Failed to create appointment");
}
}
}
は、私は日のためにドキュメンテーションと例を研究してきたと私はちょうどそれが仕事を得ることができないので、私のInteraction Model
すべてのヘルプは非常にいただければ幸いです。
敬具
開発者ポータルで行ったインタラクションモデルを置くことはできますか? (インタラクションモデル、カスタムスロット、発言) –
@TaísBelliniコメントに絵を追加する方法がわからないので、元の投稿を編集しました。ドイツの意図とスロットを許してください。Datumは日付を意味します.Zeitは時間を意味し、Nameは自分が推測するように自分自身を説明しています;) – MCR
よろしくお願いします。そのスキルビルダーに直接「時間を挿入してください」などのプロンプトを入力することができます。コードを入力する必要はありません。あなたはそれをやりました?スロットをクリックすると「プロンプト」フィールドが表示され、それが処理されます。私が今思うことは、あなたがコード内でそれを扱っているので、あなたの発言はエントリーとして単一のスロットレスポンスを期待しないので、マッチがないので閉じます。 –