Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/Microsoft/BotBuilder
Browse files Browse the repository at this point in the history
  • Loading branch information
Stevenic committed Apr 3, 2016
2 parents 7ebbf20 + 688932a commit 9ec6f2e
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 22 deletions.
3 changes: 2 additions & 1 deletion CSharp/Library/Dialogs/Conversations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ internal static BinaryFormatter MakeBinaryFormatter(IServiceProvider provider)
};
var formatter = Conversation.MakeBinaryFormatter(provider);

IDialogContextStore store = new DialogContextStore(formatter);
IDialogContextStore contextStore = new DialogContextStore(formatter);
IDialogContextStore store = new ErrorResilientDialogContextStore(contextStore);

IDialogContext context;
if (!store.TryLoad(botData.PerUserInConversationData, BlobKey, out context))
Expand Down
29 changes: 29 additions & 0 deletions CSharp/Library/Dialogs/DialogContextStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,33 @@ void IDialogContextStore.Save(IDialogContext context, IBotDataBag bag, string ke
bag.SetValue(key, blobNew);
}
}

public sealed class ErrorResilientDialogContextStore : IDialogContextStore
{
private readonly IDialogContextStore store;

public ErrorResilientDialogContextStore(IDialogContextStore store)
{
SetField.NotNull(out this.store, nameof(store), store);
}

public void Save(IDialogContext context, IBotDataBag bag, string key)
{
this.store.Save(context, bag, key);
}

public bool TryLoad(IBotDataBag bag, string key, out IDialogContext context)
{
try
{
return this.store.TryLoad(bag, key, out context);
}
catch (Exception)
{
// exception in loading the serialized context data
context = null;
return false;
}
}
}
}
4 changes: 2 additions & 2 deletions CSharp/Library/Dialogs/LuisDialog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ protected async Task MessageReceived(IDialogContext context, IAwaitable<Message>
var message = await item;
var luisRes = await this.service.QueryAsync(message.Text);

var maximum = luisRes.Intents.Max(t => t.Score);
var intent = luisRes.Intents.FirstOrDefault(i => i.Score == maximum);
var maximum = luisRes.Intents.Max(t => t.Score ?? 0);
var intent = luisRes.Intents.FirstOrDefault(i => { var curScore = i.Score ?? 0; return curScore == maximum; });

IntentHandler handler = null;
if (intent == null || !this.handlerByIntent.TryGetValue(intent.Intent, out handler))
Expand Down
44 changes: 27 additions & 17 deletions CSharp/Library/Microsoft.Bot.Builder.nuspec
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
<?xml version="1.0"?>
<package xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>$id$</id>
<version>$version$</version>
<authors>Microsoft</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>The Microsoft.Bot.Builder is a framework for building bots based on a persistent dialog system</description>
<summary>The Microsoft.Bot.Builder is a framework for building bots based on a persistent dialog system</summary>
<language>en-US</language>
<dependencies>
<dependency id="Microsoft.AspNet.WebApi.Client" version="5.2.3" />
<dependency id="Microsoft.AspNet.WebApi.Core" version="5.2.3" />
<dependency id="Microsoft.Bot.Connector" version="1.0.0.0" />
<dependency id="Microsoft.Rest.ClientRuntime" version="1.8.2" />
<dependency id="Microsoft.WindowsAzure.ConfigurationManager" version="3.1.0" />
<dependency id="Newtonsoft.Json" version="7.0.1" />
</dependencies>
</metadata>
<metadata xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<id>$id$</id>
<version>$version$</version>
<authors>Microsoft</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>
Microsoft Bot Builder is a powerful framework for constructing bots that can handle both freeform interactions and more guided ones where the possibilities are explicitly shown to the user. It is easy to use and leverages C# to provide a natural way to write bots.

High Level Features:
* Powerful dialog system with dialogs that are isolated and composable.
* Built-in dialogs for simple things like Yes/No, strings, numbers, enumerations.
* Built-in dialogs that utilize powerful AI frameworks like LUIS http://luis.ai.
* Bots are stateless which helps them scale.
* Form Flow for automatically generating a Bot from a C# class for filling in the class and that supports help, navigation, clarification and confirmation.
See http://docs.botframework.com/sdkreference/csharp/ for documentation.
</description>
<summary>Microsoft.Bot.Builder is a framework for easily building stateless bots that span from regular expressions to AI based natural language.</summary>
<language>en-US</language>
<dependencies>
<dependency id="Microsoft.AspNet.WebApi.Client" version="5.2.3" />
<dependency id="Microsoft.AspNet.WebApi.Core" version="5.2.3" />
<dependency id="Microsoft.Bot.Connector" version="1.0.0.0" />
<dependency id="Microsoft.Rest.ClientRuntime" version="1.8.2" />
<dependency id="Microsoft.WindowsAzure.ConfigurationManager" version="3.1.0" />
<dependency id="Newtonsoft.Json" version="7.0.1" />
</dependencies>
</metadata>
</package>
4 changes: 2 additions & 2 deletions CSharp/Library/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.1.0")]
[assembly: AssemblyFileVersion("1.0.1.0")]

[assembly: InternalsVisibleTo("Microsoft.Bot.Builder.Tests")]

0 comments on commit 9ec6f2e

Please sign in to comment.