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

Support customize built-in expressions for LG and AdaptiveExpression #3130

Closed
luhan2017 opened this issue May 19, 2020 · 3 comments
Closed
Assignees
Labels
R10 Release 10 - August 17th, 2020

Comments

@luhan2017
Copy link
Contributor

Is your feature request related to a problem? Please describe.

Describe the solution you'd like

https://github.com/microsoft/BotBuilder-Samples/blob/master/samples/csharp_dotnetcore/language-generation/20.extending-with-custom-functions/Bots/CustomFunctionBot.cs
In this sample, we support user to add a custom expression function in code. But if we add this in composer runtime, we can't use it in composer UX, since the function is not registered in the LSP.

Here is the piece of code I add in composer runtime:

           const string mySqrtFnName = "contoso.sqrt";
           // Add custom sqrt function
            Expression.Functions.Add(mySqrtFnName, (args) =>
            {
                object retValue = null;
                if (args[0] != null)
                {
                    double dblValue;
                    if (double.TryParse(args[0], out dblValue))
                    {
                        retValue = System.Math.Sqrt(dblValue);
                    }
                }
                return retValue;
            });

But I will see this error in the UX:

image
image

The easy way might be we add those custom functions as a white list in composer?

Describe alternatives you've considered

Additional context

@didaskein
Copy link

Hi,
Also a question linked to the custom Function, Could it be possible to have natively access to the locale of the user inside the code of the function ?

I would like to avoid to add a parameter in the function (not very user friendly ;))

image

Thank you.

@cwhitten cwhitten added R10 Release 10 - August 17th, 2020 and removed Needs-triage A new issue that require triage labels Jun 16, 2020
@didaskein
Copy link

Also 2 features evolutions request linked to custom function :

  • Be able to Call Async code inside a custom function
  • Be able to return Activity (Speak,Event...) not only text

Thanks.

@cwhitten
Copy link
Member

cwhitten commented Aug 6, 2020

Closing this workitem as complete - see #3656 for continued investment in this area.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R10 Release 10 - August 17th, 2020
Projects
None yet
Development

No branches or pull requests

4 participants