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

QnAMaker Middleware calling context.Reply() directly #137

Closed
daltskin opened this issue Feb 16, 2018 · 2 comments
Closed

QnAMaker Middleware calling context.Reply() directly #137

daltskin opened this issue Feb 16, 2018 · 2 comments

Comments

@daltskin
Copy link
Contributor

QnAMaker Middleware is sending output directly to the user. What if developer needs to format the result/use adaptive card etc..

Workaround to clone the Microsoft.Bot.Builder.Ai.QnAMaker class and store QnA response in bot state (which seems hacky) eg:

       public async Task ReceiveActivity(IBotContext context, MiddlewareSet.NextDelegate next)
       {
           if (context.Request.Type == ActivityTypes.Message)
           {
               var messageActivity = context.Request.AsMessageActivity();
               if (!string.IsNullOrEmpty(messageActivity.Text))
               {
                   var results = await this.GetAnswers(messageActivity.Text.Trim()).ConfigureAwait(false);
                   if (results.Any())
                   {
                       // Store results in state for handling by TemplateRenderer later
                       context.State.Conversation["QnAResult"] = results;
                   }
               }
           }

           await next().ConfigureAwait(false);
       }
@Stevenic
Copy link
Contributor

So as a general rule, our goal is to make all of the built-in services usable both freestanding and as middleware. The JS SDK has the exact opposite problem that you can only use QnA Maker in freestanding mode right now. Please continue to file issues like this and we'll have all of these lose edges sewed up soon.

@cleemullins
Copy link
Contributor

For now, I think this is "By Design". As we move soon to a model where there is significantly improved stateful interactions between Middleware components, we should come back and revisit this.

ceciliaavila added a commit that referenced this issue Jun 25, 2019
…ker-issues

[StyleCop] Fix remaining warnings in BotWorker, DialogData, DialogElement and CMSConfiguration class
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

No branches or pull requests

3 participants