Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Commit

Permalink
[HospitalitySkill] Fix reservation data issue and clean up files (#2053)
Browse files Browse the repository at this point in the history
* Remove file paths from luis files

* Update manifest template

* Change title in default.htm

* Remove end of dialog error responses

* Fix reservation data issue with HotelService

* remove unnecessary usings
  • Loading branch information
litofish committed Aug 8, 2019
1 parent e64bb9b commit c5e4319
Show file tree
Hide file tree
Showing 19 changed files with 42 additions and 85 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Collections.Specialized;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using HospitalitySkill.Models;
using HospitalitySkill.Responses.CheckOut;
using HospitalitySkill.Services;
using Microsoft.Bot.Builder;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.Dialogs.Choices;
using Microsoft.Bot.Builder.Solutions.Responses;

namespace HospitalitySkill.Dialogs
Expand Down Expand Up @@ -118,11 +114,6 @@ private async Task<DialogTurnResult> EndDialog(WaterfallStepContext sc, Cancella
await sc.Context.SendActivityAsync(ResponseManager.GetResponse(CheckOutResponses.SendEmailMessage, tokens));
await sc.Context.SendActivityAsync(ResponseManager.GetResponse(CheckOutResponses.CheckOutSuccess));
}
else
{
// didn't check out, help with something else
await sc.Context.SendActivityAsync(ResponseManager.GetResponse(CheckOutResponses.CheckOutError));
}

return await sc.EndDialogAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using HospitalitySkill.Models;
Expand Down Expand Up @@ -266,10 +265,6 @@ private async Task<DialogTurnResult> EndDialog(WaterfallStepContext sc, Cancella
var reply = ResponseManager.GetCardResponse(ExtendStayResponses.ExtendStaySuccess, new Card("ReservationDetails", cardData), tokens);
await sc.Context.SendActivityAsync(reply);
}
else
{
await sc.Context.SendActivityAsync(ResponseManager.GetResponse(ExtendStayResponses.ExtendStayError));
}

return await sc.EndDialogAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

namespace HospitalitySkill.Dialogs
{

public class HospitalityDialogBase : ComponentDialog
{
private HotelService _hotelService;
Expand Down Expand Up @@ -64,9 +63,6 @@ public HospitalityDialogBase(

protected override async Task<DialogTurnResult> OnBeginDialogAsync(DialogContext dc, object options, CancellationToken cancellationToken = default(CancellationToken))
{
var userState = await UserStateAccessor.GetAsync(dc.Context, () => new HospitalityUserSkillState());
userState.UserReservation = await _hotelService.GetReservationDetailsAsync();

await GetLuisResult(dc);
return await base.OnBeginDialogAsync(dc, options, cancellationToken);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,6 @@ private async Task<DialogTurnResult> EndDialog(WaterfallStepContext sc, Cancella
var reply = ResponseManager.GetCardResponse(LateCheckOutResponses.MoveCheckOutSuccess, new Card("ReservationDetails", cardData), tokens);
await sc.Context.SendActivityAsync(reply);
}
else
{
await sc.Context.SendActivityAsync(ResponseManager.GetResponse(LateCheckOutResponses.MoveCheckOutError));
}

return await sc.EndDialogAsync();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// Licensed under the MIT License.

using System;
using System.Collections.Generic;
using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
Expand All @@ -14,7 +13,6 @@
using Microsoft.Bot.Builder;
using Microsoft.Bot.Builder.Dialogs;
using Microsoft.Bot.Builder.Skills;
using Microsoft.Bot.Builder.Skills.Models;
using Microsoft.Bot.Builder.Solutions;
using Microsoft.Bot.Builder.Solutions.Dialogs;
using Microsoft.Bot.Builder.Solutions.Responses;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization;
using System.IO;
using System.Linq;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using Luis;
using System;

namespace HospitalitySkill.Models
{
Expand All @@ -11,6 +11,12 @@ public HospitalityUserSkillState()
{
CheckedOut = false;
LateCheckOut = false;
UserReservation = new ReservationData
{
CheckInDate = DateTime.Now.ToString("MMMM d, yyyy"),
CheckOutDate = DateTime.Now.AddDays(4).ToString("MMMM d, yyyy"),
CheckOutTime = "12:00 pm"
};
}

public bool CheckedOut { get; set; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class CheckOutResponses : IResponseIdCollection
public const string ConfirmCheckOut = "ConfirmCheckOut";
public const string RetryConfirmCheckOut = "RetryConfirmCheckOut";
public const string CheckOutSuccess = "CheckOutSuccess";
public const string CheckOutError = "CheckOutError";
public const string EmailPrompt = "EmailPrompt";
public const string InvalidEmailPrompt = "InvalidEmailPrompt";
public const string SendEmailMessage = "SendEmailMessage";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,6 @@
}
],
"inputHint": "acceptingInput"
},
"CheckOutError": {
"replies": [
{
"text": "It seems like you don't want to check out. Is there something else I can help you with?",
"speak": "It seems like you don't want to check out. Is there something else I can help you with?"
}
],
"inputHint": "acceptingInput"
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ public class ExtendStayResponses : IResponseIdCollection
public const string ConfirmExtendStay = "ConfirmExtendStay";
public const string RetryConfirmExtendStay = "RetryConfirmExtendStay";
public const string ExtendStaySuccess = "ExtendStaySuccess";
public const string ExtendStayError = "ExtendStayError";
public const string SameDayRequested = "SameDayRequested";
public const string NotFutureDateError = "NotFutureDateError";
public const string NumberEntityError = "NumberEntityError";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@
],
"inputHint": "acceptingInput"
},
"ExtendStayError": {
"replies": [
{
"text": "Ok. Let me know if there is anything else I can help you with!",
"speak": "Ok. Let me know if there is anything else I can help you with!"
}
],
"inputHint": "acceptingInput"
},
"SameDayRequested": {
"replies": [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ public class LateCheckOutResponses : IResponseIdCollection
public const string MoveCheckOutPrompt = "MoveCheckOutPrompt";
public const string RetryMoveCheckOut = "RetryMoveCheckOut";
public const string MoveCheckOutSuccess = "MoveCheckOutSuccess";
public const string MoveCheckOutError = "MoveCheckOutError";
public const string HasLateCheckOut = "HasLateCheckOut";
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@
],
"inputHint": "acceptingInput"
},
"MoveCheckOutError": {
"replies": [
{
"text": "Ok. Let me know if there is anything else I can help you with!",
"speak": "Ok. Let me know if there is anything else I can help you with!"
}
],
"inputHint": "acceptingInput"
},
"HasLateCheckOut": {
"replies": [
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated>
// Code generated by LUISGen C:\Users\t-luitof\source\repos\botframework-solutions\skills\src\csharp\experimental\hospitalityskill\Deployment\Resources\LU\en\General.luis -cs Luis.GeneralLuis -o C:\Users\t-luitof\source\repos\botframework-solutions\skills\src\csharp\experimental\hospitalityskill\Services
// Code generated by LUISGen
// Tool github: https://github.com/microsoft/botbuilder-tools
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// <auto-generated>
// Code generated by LUISGen C:\Users\t-luitof\source\repos\botframework-solutions\skills\src\csharp\experimental\hospitalityskill\Deployment\Resources\LU\en\Hospitality.luis -cs Luis.HospitalityLuis -o C:\Users\t-luitof\source\repos\botframework-solutions\skills\src\csharp\experimental\hospitalityskill\Services
// Code generated by LUISGen
// Tool github: https://github.com/microsoft/botbuilder-tools
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using HospitalitySkill.Models;
using static Luis.HospitalityLuis._Entities;
Expand All @@ -10,17 +9,8 @@ namespace HospitalitySkill.Services
// Should replace with real apis
public class HotelService : IHotelService
{
private ReservationData _reservationData;

public HotelService()
{
// mock data for hotel reservation
_reservationData = new ReservationData
{
CheckInDate = DateTime.Now.ToString("MMMM d, yyyy"),
CheckOutDate = DateTime.Now.AddDays(4).ToString("MMMM d, yyyy"),
CheckOutTime = "12:00 pm"
};
}

public async Task<string> GetLateCheckOutAsync()
Expand All @@ -31,16 +21,15 @@ public async Task<string> GetLateCheckOutAsync()
return await Task.FromResult(lateTime);
}

public async Task<ReservationData> GetReservationDetailsAsync()
public Task<ReservationData> GetReservationDetails()
{
// make request for reservation details
return await Task.FromResult(_reservationData);
return Task.FromResult(new ReservationData());
}

public void UpdateReservationDetails(ReservationData reservation)
{
// make request to update user's reservation details
_reservationData = reservation;
}

public async Task<bool> RequestItems(List<ItemRequestClass> items)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace HospitalitySkill.Services
public interface IHotelService
{
// get reservation details
Task<ReservationData> GetReservationDetailsAsync();
Task<ReservationData> GetReservationDetails();

// update reservation
void UpdateReservationDetails(ReservationData reservation);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"id": "hospitalitySkill",
"name": "Hospitality Skill",
"description": "The Hospitality skill provides capabilities that may be needed in a hotel room.",
"description": "The Hospitality skill provides capabilities that are needed in a hotel room, such as checking out, changing your reservation, and requesting items.",
"iconUrl": "",
"authenticationConnections": [],
"actions": [
{
"id": "HospitalitySkill_checkOut",
"id": "hospitalitySkill_checkOut",
"definition": {
"description": "Check out of room",
"description": "Check out of room.",
"slots": [],
"triggers": {
"utteranceSources": [
Expand All @@ -23,7 +23,7 @@
}
},
{
"id": "HospitalitySkill_extendStay",
"id": "hospitalitySkill_extendStay",
"definition": {
"description": "Extend reseravation for current room.",
"slots": [],
Expand All @@ -40,7 +40,7 @@
}
},
{
"id": "HospitalitySkill_getReservation",
"id": "hospitalitySkill_getReservation",
"definition": {
"description": "Get current reservation details.",
"slots": [],
Expand All @@ -57,9 +57,9 @@
}
},
{
"id": "HospitalitySkill_lateCheckOut",
"id": "hospitalitySkill_lateCheckOut",
"definition": {
"description": "Change to late check out",
"description": "Change to late check out.",
"slots": [],
"triggers": {
"utteranceSources": [
Expand All @@ -72,6 +72,23 @@
]
}
}
},
{
"id": "hospitalitySkill_requestItem",
"definition": {
"description": "Request items to be brought to your room.",
"slots": [],
"triggers": {
"utteranceSources": [
{
"locale": "en",
"source": [
"Hospitality#RequestItem"
]
}
]
}
}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Skill Template</title>
<title>Hospitality Skill</title>
<style>
body {
margin: 0px;
Expand Down Expand Up @@ -392,14 +392,14 @@
<header class="header">
<div class="header-inner-container">
<div class="header-icon" style="display: inline-block"></div>
<div class="header-text" style="display: inline-block">Skill Template</div>
<div class="header-text" style="display: inline-block">Hospitality Skill</div>
</div>
</header>
<div class="row">
<div class="column" class="main-content-area">
<div class="content-title">Your Skill is ready!</div>
<div class="content-title">Your Hospitality Skill is ready!</div>
<div class="main-text main-text-p1">
You can test your Skill in the Bot Framework Emulator<br />
You can test your skill in the Bot Framework Emulator<br />
by opening the Emulator and providing the Endpoint shown below along with the Microsoft AppId and Password which you can find in appsettings.json.<br />
</div>
<div class="main-text download-the-emulator">
Expand Down

0 comments on commit c5e4319

Please sign in to comment.