Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: enable composer to call a remote skill #2233

Merged
merged 28 commits into from
Mar 16, 2020
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
2d67b7b
support call remote skill in composer
luhan2017 Mar 11, 2020
6d7ecb5
Update BotProject.csproj
luhan2017 Mar 11, 2020
7546da7
Update sdk.schema
luhan2017 Mar 11, 2020
ca55f90
Merge branch 'master' into luhan/skill
cwhitten Mar 12, 2020
a591828
Plumb Skill schema into app
cwhitten Mar 12, 2020
6146cda
Update BotProject.csproj
luhan2017 Mar 13, 2020
36db397
visual schema for SkillDialog
yeze322 Mar 13, 2020
618ff45
Merge branch 'luhan/skill' of https://github.com/microsoft/BotFramewo…
yeze322 Mar 13, 2020
73becfc
add skill label map
yeze322 Mar 13, 2020
d17a416
remove colon in uischema
yeze322 Mar 13, 2020
39daa6f
Merge branch 'master' into luhan/skill
yeze322 Mar 13, 2020
8ecefe9
Merge branch 'master' into luhan/skill
luhan2017 Mar 13, 2020
620d5fb
correct schema of SkillDialog
yeze322 Mar 13, 2020
1b5769f
fix sdk.schema
yeze322 Mar 13, 2020
6d27a2d
fix wrong schema binding
yeze322 Mar 13, 2020
22c7837
fix uischema order
yeze322 Mar 13, 2020
adb9144
provide customized title
yeze322 Mar 13, 2020
e14d5db
support copy-paste of SkillDialog
yeze322 Mar 13, 2020
3e09669
Merge branch 'master' into luhan/skill
cwhitten Mar 13, 2020
11bbfd0
Merge branch 'master' into luhan/skill
cwhitten Mar 13, 2020
15e64c6
Bad Merge
cwhitten Mar 13, 2020
39e2c63
Merge branch 'master' into luhan/skill
yeze322 Mar 14, 2020
722bd68
Add draft doc
luhan2017 Mar 16, 2020
1c58277
Update how-to-connect-to-remote-skill.md
luhan2017 Mar 16, 2020
ac430ce
Create Begin-a-skill.png
luhan2017 Mar 16, 2020
a44e259
Merge branch 'luhan/skill' of https://github.com/microsoft/BotFramewo…
luhan2017 Mar 16, 2020
40e7c54
Add link
cwhitten Mar 16, 2020
5d79178
Merge branch 'master' into luhan/skill
cwhitten Mar 16, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions BotProject/Templates/CSharp/BotProject.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@
<CodeAnalysisRuleSet>BotProject.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Bot.Builder" Version="4.8.0-preview-200227-109209" />
<PackageReference Include="Microsoft.Bot.Builder.ApplicationInsights" Version="4.8.0-preview-200227-109209" />
<PackageReference Include="Microsoft.Bot.Builder.Azure" Version="4.8.0-preview-200227-109209" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Adaptive" Version="4.8.0-preview-200227-109209" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Debugging" Version="4.8.0-preview-200227-109209" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Declarative" Version="4.8.0-preview-200227-109209" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.ApplicationInsights.Core" Version="4.8.0-preview-200227-109209" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.8.0-preview-200227-109209" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.8.0-preview-200227-109209" />
<PackageReference Include="Microsoft.Bot.Connector" Version="4.8.0-preview-200227-109209" />
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.2" />
<PackageReference Include="Microsoft.Bot.Builder" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Builder.ApplicationInsights" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Builder.Azure" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Adaptive" Version="4.8.0-rc5-preview" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Debugging" Version="4.8.0-rc5-preview" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs.Declarative" Version="4.8.0-rc5-preview" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.ApplicationInsights.Core" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Builder.Integration.AspNet.Core" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Builder.Dialogs" Version="4.8.0" />
<PackageReference Include="Microsoft.Bot.Connector" Version="4.8.0" />
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.66">
<PrivateAssets>all</PrivateAssets>
Expand Down
8 changes: 5 additions & 3 deletions BotProject/Templates/CSharp/ComposerBot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.Bot.Builder.Dialogs.Debugging;
using Microsoft.Bot.Builder.Dialogs.Declarative;
using Microsoft.Bot.Builder.Dialogs.Declarative.Resources;
using Microsoft.Bot.Builder.Skills;

namespace Microsoft.Bot.Builder.ComposerBot.Json
{
Expand All @@ -22,14 +23,15 @@ public class ComposerBot : ActivityHandler
private readonly ISourceMap sourceMap;
private readonly string rootDialogFile;

public ComposerBot(string rootDialogFile, ConversationState conversationState, UserState userState, ResourceExplorer resourceExplorer, ISourceMap sourceMap)
public ComposerBot(ConversationState conversationState, UserState userState, ResourceExplorer resourceExplorer, BotFrameworkClient skillClient, SkillConversationIdFactoryBase conversationIdFactory)
{
HostContext.Current.Set(skillClient);
HostContext.Current.Set(conversationIdFactory);
this.conversationState = conversationState;
this.userState = userState;
this.dialogState = conversationState.CreateProperty<DialogState>("DialogState");
this.sourceMap = sourceMap;
this.resourceExplorer = resourceExplorer;
this.rootDialogFile = rootDialogFile;
this.rootDialogFile = "Main.dialog";
LoadRootDialogAsync();
}

Expand Down
52 changes: 52 additions & 0 deletions BotProject/Templates/CSharp/Controllers/SkillController.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

using System;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Bot.Builder.Integration.AspNet.Core;
using Microsoft.Bot.Builder.Skills;
using Microsoft.Bot.Schema;

namespace Microsoft.Bot.Builder.TestBot.Json.Controllers
{
/// <summary>
/// A controller that handles skill replies to the bot.
/// This example uses the <see cref="SkillHandler"/> that is registered as a <see cref="ChannelServiceHandler"/> in startup.cs.
/// </summary>
[ApiController]
[Route("api/skills")]
public class SkillController : ChannelServiceController
{
public SkillController(ChannelServiceHandler handler)
: base(handler)
{
}

public override Task<IActionResult> ReplyToActivityAsync(string conversationId, string activityId, Activity activity)
{
try
{
return base.ReplyToActivityAsync(conversationId, activityId, activity);
}
catch (Exception ex)
{
Console.WriteLine(ex);
throw;
}
}

public override Task<IActionResult> SendToConversationAsync(string conversationId, Activity activity)
{
try
{
return base.SendToConversationAsync(conversationId, activity);
}
catch (Exception ex)
{
Console.WriteLine(ex);
throw;
}
}
}
}
Loading