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

Apply Expression equal function in LG library #5517

Merged
merged 3 commits into from Apr 27, 2021
Merged

Conversation

Danieladu
Copy link
Collaborator

Fixes #5508

Description

Firstly, let me explain the cause of the bug:

        {
          "$kind": "Microsoft.SetProperty",
          "property": "$answer",
          "value": {
            "score": 1
          }
        },

Here is a SetProperty action, and in the LG template, the customer uses :
${$answer.score} to achieve the score.

Actually, In dialog memory manager, if the value is a JObject, it would use jobj.TryGetValue to get the result.

jobj.TryGetValue(property, StringComparison.InvariantCultureIgnoreCase, out var value);

And, the result would be a long int(Int64) format data but not a Int32 format data. So, the result is actually 1L, but not 1

Another side, In the comparison of switch expression and case expression, the LG SDK treat they are different.
Original code:

if (switchExprResult == caseExprResult || (switchExprResult != null && switchExprResult.Equals(caseExprResult)))

Specific Changes

Unify the comparison mechanism of LG and expression. Apply the equal function of Expression in LG library.

@Danieladu Danieladu requested review from a team as code owners April 22, 2021 07:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[LG] Switch template not matching cases
2 participants