Giter VIP home page Giter VIP logo

cxuesong / botbuilder.standard Goto Github PK

View Code? Open in Web Editor NEW
22.0 6.0 9.0 192.74 MB

An unofficial CoreCLR targeted .NET Standard ported version of BotBuilder.

Home Page: https://github.com/CXuesong/BotBuilder.Standard/wiki

License: MIT License

C# 66.34% Batchfile 0.24% ASP 0.04% HTML 1.81% CSS 3.23% JavaScript 15.51% TypeScript 12.80% PowerShell 0.03%
bot microsoft-bot-framework bot-builder bot-framework

botbuilder.standard's Issues

Scorable is not fired

Bot Info

  • App ID:
  • SDK Platform: .NET Core
  • SDK Version: 3.12.2.6-int0
  • CXuesong.Ported.Microsoft.Bot.Builder Version="3.12.2.5"
  • CXuesong.Ported.Microsoft.Bot.Connector Version="3.12.2.6-int0"
  • CXuesong.Ported.Microsoft.Bot.Builder.Autofac" Version="3.12.2.5"
  • Active Channels: emulator
  • Deployment Environment: localhost

Issue Description

Scorable is not fired

Code Example

public sealed class SampleScorable : ScorableBase<IActivity, string, double>
{
    private readonly IDialogStack stack;
    private readonly IBotData botData;
    private readonly IBotToUser botToUser;
    private readonly string command = "Help";

    public SampleScorable(IDialogStack stack, IBotData botData, IBotToUser botToUser)
    {
        SetField.NotNull(out this.stack, nameof(stack), stack);
        SetField.NotNull(out this.botData, nameof(botData), botData);
        SetField.NotNull(out this.botToUser, nameof(botToUser), botToUser);
    }

    protected override async Task<string> PrepareAsync(IActivity activity, CancellationToken token)
    {
        var message = activity as IMessageActivity;
        if (message != null && message.Text != null)
        {
            var text = message.Text;
            if (command.Equals(command))
            {
                return message.Text;
            }
        }

        return null;
    }

    protected override bool HasScore(IActivity item, string state)
    {
        return state != null;
    }

    protected override double GetScore(IActivity item, string state)
    {
        return 1.0;
    }

    protected override async Task PostAsync(IActivity item, string state, CancellationToken token)
    {
        await botToUser.PostAsync("^^");
    }
    protected override Task DoneAsync(IActivity item, string state, CancellationToken token)
    {
        return Task.CompletedTask;
    }
}

Dialog register

builder.Register(c => new SampleScorable(c.Resolve(), c.Resolve(), c.Resolve()))
.As<IScorable<IActivity, double>>()
.InstancePerLifetimeScope();

Reproduction Steps

Expected Behavior

User Input on Bot: Help
Bot Response: ^^

Actual Results

Continue in current Dialog and not interrupted

'IDialogContext' does not contain a definition for 'Done'

Bot Info

  • SDK Platform: .NET
  • SDK Version: CXuesong.Ported.Microsoft.Bot.Builder 3.12.2.5
  • Active Channels: emulator
  • Deployment Environment: localhost

Issue Description

'Microsoft.Bot.Builder.Dialogs.IDialogContext' does not contain a definition for 'Done'

Code Example

   public Task StartAsync(IDialogContext context)
    {
        context.PostAsync($"[CatalogDialog] I am the Catalog dialog.");
        context.Call(new CatalogFilterDialog(), ExecutedCatalogFilterAsync);
        return Task.CompletedTask;
    }
  private async  Task ExecutedCatalogFilterAsync(IDialogContext context, IAwaitable<CatalogFilter> result)
    {
        var catalogFilter = await result;          /// <-- Excpetion throw here
        context.Wait(MessageReceivedAsync);
    }

  public class CatalogDialog : IDialog<object>
  {
       [...]
       context.Done(filter);
       [...]
  }

Expected Behavior

  retrieve filter object on ExecutedCatalogFilterAsync

Actual Results

Exception: 'Microsoft.Bot.Builder.Dialogs.IDialogContext' does not contain a definition for 'Done'

PromptDialog.Confirm loop in .NET Core 2.0

Bot Info

  • App ID:
  • SDK Platform: .NET Framework & .NET Core
  • SDK Version: 3.12.2.4 (.NET Framework) and 3.12.2.5 (.NET Core)
  • Active Channels: Bot Emulator
  • Deployment Environment: Bot Emulator

Issue Description

I have the same code inside a .NET Framework 4.6.1 Web API project referencing the latest official Microsoft.Bot.* packages and a .NET Core 2.0 Web API project referencing the latest CXuesong.Ported.Microsoft.Bot.* packages. The root dialog is a LUIS dialog and what I am trying to do is respond with a confirm prompt in the None intent. This works as expected in the .NET Framework version, but results in a loop in the .NET Core version, where responding to the prompt results in another prompt.

Code Example

In the MessagesController:

if (activity != null && activity.GetActivityType() == ActivityTypes.Message)
{
    await Conversation.SendAsync(activity, () => new BasicLuisDialog());                
}
else
{
    HandleSystemMessage(activity);
}
return new HttpResponseMessage(System.Net.HttpStatusCode.Accepted);

In the BasicLuisDialog:

[LuisIntent("None")]
public async Task NoneIntent(IDialogContext context, LuisResult result)
{
    PromptDialog.Confirm(context, AfterAskInvestigate, "Would you like us to investigate and follow-up?");
}

private async Task AfterAskInvestigate(IDialogContext context, IAwaitable<bool> result)
{
    var investigate = await result;

    if (investigate)
        await context.PostAsync("OK, we're on the case.");
    else
        await context.PostAsync("No problem, we'll leave it.");

    context.Wait(MessageReceived);
}

Reproduction Steps

  1. Fire up the bot emulator and send it a message that matches the None intent.
  2. A confirm prompt is sent back to the user.
  3. Click on either Yes or No.

Expected Behavior

After responding to the confirm prompt, the ResumeAfter function should execute.

Actual Results

This works as expected in the .NET Framework version, but in .NET Core 2.0 any response to the confirm prompt is treated like a new conversation and you are presented with the prompt again - the ResumeAfter function never executes.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.