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

Commit dd78bde

Browse files
authored
Hospitality sample and skill changes (#2236)
* Adding updated hospitality skill * restaurant booking fixes * weather skill .lu file update * Update skill manifests * skills updates * Add files for event skill from skill template * fix bugs * Add event skill to sample * room service dialog bug fix * for event, news, and weather skills populate location state from semantic action * customize VA start card * Add available items and room service menu item * Hospitality skill available items updates * Sample small updates and add Bing Search skill * Support adaptive cards being used in Teams for Hospitality and Event skills * fixes for better funcitonality in Teams * Fix Teams intro card issue
1 parent 8ace622 commit dd78bde

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+918
-234
lines changed
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
{
2+
"type": "AdaptiveCard",
3+
"id": "EventCard",
4+
"body": [
5+
{
6+
"type": "Container",
7+
"items": [
8+
{
9+
"type": "ColumnSet",
10+
"columns": [
11+
{
12+
"type": "Column",
13+
"verticalContentAlignment": "Center",
14+
"items": [
15+
{
16+
"type": "TextBlock",
17+
"id": "title",
18+
"size": "Large",
19+
"weight": "Bolder",
20+
"color": "Dark",
21+
"text": "Local Event"
22+
}
23+
],
24+
"width": "stretch"
25+
}
26+
]
27+
}
28+
]
29+
},
30+
{
31+
"type": "Image",
32+
"url": "{ImageUrl}"
33+
},
34+
{
35+
"type": "TextBlock",
36+
"text": "**{Title}**",
37+
"size": "Medium",
38+
"weight": "Bolder"
39+
},
40+
{
41+
"type": "Container",
42+
"items": [
43+
{
44+
"type": "TextBlock",
45+
"text": "{StartDate}",
46+
"spacing": "Small"
47+
},
48+
{
49+
"type": "TextBlock",
50+
"text": "{Location}",
51+
"spacing": "Small"
52+
},
53+
{
54+
"type": "TextBlock",
55+
"text": "{Price}",
56+
"spacing": "Small"
57+
}
58+
]
59+
},
60+
{
61+
"type": "TextBlock",
62+
"text": "Powered by **Eventbrite**",
63+
"horizontalAlignment": "Right",
64+
"size": "Small"
65+
}
66+
],
67+
"actions": [
68+
{
69+
"type": "Action.OpenUrl",
70+
"title": "Get Tickets",
71+
"url": "{Url}"
72+
}
73+
],
74+
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
75+
"version": "1.0",
76+
"speak": "{Speak}"
77+
}

skills/src/csharp/experimental/eventskill/Dialogs/EventDialogBase.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
using Luis;
1313
using Microsoft.Bot.Builder;
1414
using Microsoft.Bot.Builder.Dialogs;
15+
using Microsoft.Bot.Builder.Dialogs.Choices;
1516
using Microsoft.Bot.Builder.Skills;
1617
using Microsoft.Bot.Builder.Solutions.Authentication;
1718
using Microsoft.Bot.Builder.Solutions.Responses;
1819
using Microsoft.Bot.Builder.Solutions.Util;
20+
using Microsoft.Bot.Connector;
1921
using Microsoft.Bot.Schema;
2022

2123
namespace EventSkill.Dialogs
@@ -175,5 +177,16 @@ protected async Task HandleDialogExceptions(WaterfallStepContext sc, Exception e
175177
var state = await StateAccessor.GetAsync(sc.Context);
176178
state.Clear();
177179
}
180+
181+
// Get card that renders for adaptive card 1.0
182+
protected string GetCardName(ITurnContext context, string name)
183+
{
184+
if (Channel.GetChannelId(context) == Channels.Msteams)
185+
{
186+
name += ".1.0";
187+
}
188+
189+
return name;
190+
}
178191
}
179192
}

skills/src/csharp/experimental/eventskill/Dialogs/FindEventsDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ private async Task<DialogTurnResult> FindEvents(WaterfallStepContext sc, Cancell
9595
Url = item.Url
9696
};
9797

98-
cards.Add(new Card("EventCard", eventCardData));
98+
cards.Add(new Card(GetCardName(sc.Context, "EventCard"), eventCardData));
9999
}
100100

101101
await sc.Context.SendActivityAsync(ResponseManager.GetCardResponse(FindEventsResponses.FoundEvents, cards, null));

skills/src/csharp/experimental/eventskill/Dialogs/MainDialog.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ private async Task<InterruptionAction> OnLogout(DialogContext dc)
237237

238238
private async Task PopulateStateFromSemanticAction(ITurnContext context)
239239
{
240-
// Example of populating local state with data passed through semanticAction out of Activity
240+
// Populating local state with data passed through semanticAction out of Activity
241241
var activity = context.Activity;
242242
var semanticAction = activity.SemanticAction;
243243
if (semanticAction != null && semanticAction.Entities.ContainsKey("location"))

skills/src/csharp/experimental/eventskill/EventSkill.csproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
</PropertyGroup>
88

99
<ItemGroup>
10+
<Content Remove="Content\EventCard.1.0.json" />
1011
<Content Remove="Content\EventCard.json" />
1112
<Content Remove="Responses\FindEvents\FindEventsResponses.json" />
1213
<Content Remove="Responses\Main\MainResponses.de.json" />
@@ -24,6 +25,7 @@
2425
</ItemGroup>
2526

2627
<ItemGroup>
28+
<EmbeddedResource Include="Content\EventCard.1.0.json" />
2729
<EmbeddedResource Include="Content\EventCard.json" />
2830
<EmbeddedResource Include="Responses\FindEvents\FindEventsResponses.json" />
2931
<EmbeddedResource Include="Responses\Main\MainResponses.de.json" />

skills/src/csharp/experimental/eventskill/Models/EventSkillState.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public class EventSkillState
1111

1212
public EventLuis LuisResult { get; set; }
1313

14-
public string CurrentCoordinates { get; internal set; }
14+
public string CurrentCoordinates { get; set; }
1515

1616
public void Clear()
1717
{
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"type": "AdaptiveCard",
3+
"id": "FoodItemCard",
4+
"body": [
5+
{
6+
"type": "ColumnSet",
7+
"columns": [
8+
{
9+
"type": "Column",
10+
"items": [
11+
{
12+
"type": "TextBlock",
13+
"text": "{Quantity}",
14+
"horizontalAlignment": "Center"
15+
}
16+
],
17+
"width": "auto"
18+
},
19+
{
20+
"type": "Column",
21+
"items": [
22+
{
23+
"type": "TextBlock",
24+
"text": "{Name}"
25+
},
26+
{
27+
"type": "TextBlock",
28+
"text": "{SpecialRequest}",
29+
"spacing": "None"
30+
}
31+
],
32+
"width": "stretch"
33+
},
34+
{
35+
"type": "Column",
36+
"items": [
37+
{
38+
"type": "TextBlock",
39+
"text": "${Price}",
40+
"horizontalAlignment": "Right"
41+
}
42+
],
43+
"width": "auto"
44+
}
45+
]
46+
}
47+
],
48+
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
49+
"version": "1.0",
50+
"speak": "{Speak}"
51+
}

skills/src/csharp/experimental/hospitalityskill/Content/FoodItemCard.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"horizontalAlignment": "Center"
1515
}
1616
],
17-
"width": "40px"
17+
"width": 10
1818
},
1919
{
2020
"type": "Column",
@@ -30,7 +30,7 @@
3030
"spacing": "None"
3131
}
3232
],
33-
"width": "stretch"
33+
"width": 70
3434
},
3535
{
3636
"type": "Column",
@@ -41,7 +41,7 @@
4141
"horizontalAlignment": "Right"
4242
}
4343
],
44-
"width": "auto"
44+
"width": 20
4545
}
4646
]
4747
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
{
2+
"type": "AdaptiveCard",
3+
"version": "1.0",
4+
"id": "FoodOrderCard",
5+
"body": [
6+
{
7+
"type": "Container",
8+
"items": [
9+
{
10+
"type": "ColumnSet",
11+
"columns": [
12+
{
13+
"type": "Column",
14+
"verticalContentAlignment": "Center",
15+
"items": [
16+
{
17+
"type": "TextBlock",
18+
"id": "title",
19+
"size": "Large",
20+
"weight": "Bolder",
21+
"color": "Dark",
22+
"text": "Current Order"
23+
}
24+
],
25+
"width": "stretch"
26+
}
27+
]
28+
}
29+
]
30+
},
31+
{
32+
"type": "Container",
33+
"id": "items",
34+
"items": []
35+
},
36+
{
37+
"type": "Container",
38+
"items": [
39+
{
40+
"type": "ColumnSet",
41+
"columns": [
42+
{
43+
"type": "Column",
44+
"items": [
45+
{
46+
"type": "TextBlock",
47+
"text": "Bill Total",
48+
"horizontalAlignment": "Right"
49+
}
50+
],
51+
"width": "stretch"
52+
},
53+
{
54+
"type": "Column",
55+
"items": [
56+
{
57+
"type": "TextBlock",
58+
"weight": "Bolder",
59+
"text": "${BillTotal}",
60+
"horizontalAlignment": "Right"
61+
}
62+
],
63+
"width": "auto"
64+
}
65+
]
66+
}
67+
]
68+
}
69+
],
70+
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json"
71+
}

skills/src/csharp/experimental/hospitalityskill/Content/FoodOrderCard.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
"horizontalAlignment": "Center"
6161
}
6262
],
63-
"width": "40px"
63+
"width": 10
6464
},
6565
{
6666
"type": "Column",
@@ -71,7 +71,7 @@
7171
"text": "Item"
7272
}
7373
],
74-
"width": "stretch"
74+
"width": 70
7575
},
7676
{
7777
"type": "Column",
@@ -83,7 +83,7 @@
8383
"horizontalAlignment": "Right"
8484
}
8585
],
86-
"width": "auto"
86+
"width": 20
8787
}
8888
]
8989
}

0 commit comments

Comments
 (0)