1
votes

Okay so I have the LUIS Bot to kickoff the conversation in my Post method in MessageController.cs

await Conversation.SendAsync(activity, () => new LUISDialog());

when the bot detects the None intent it will make a call to the QnA bot and forward the message to it

await context.Forward(new QnABot(), Whatever, result.Query, CancellationToken.None);

Here's my problem: When the QnA bot is started, method MessageReceivedAsync in QnAMakerDialog.cs class is throwing an exception on the parameter "IAwaitable<.IMessageActivity> argument"

[Microsoft.Bot.Builder.Internals.Fibers.InvalidTypeException] = {"invalid type: expected Microsoft.Bot.Connector.IMessageActivity, have String"}"

when trying to access it via --> var message = await argument;

I don't understand what the problem is, I'm typing a simple plain text in the qna bot, and my knowledge base has no problem returning a response when I tried it on the website. I'm not sure what's happening between the time StartAsync is called and MessageReceivedAsync is called that is causing the parameter 'argument' to fail.

1

1 Answers

4
votes

I think the problem is that you are sending a string (result.Query) and the QnAMakerDialog.cs is expecting an IMessageActivity.

Try updating your context.Forward call to:

var msg = context.MakeMessage();
msg.Text = result.Query;

await context.Forward(new QnABot(), Whatever, msg, CancellationToken.None);

Alternatively, you can update the signature of the None intent method to include the original IMessageActivity:

[LuistIntent("None"))]
public async Task None(IDialogContext context, IAwaitable<IMessageActivity> activity, LuisResult result)
{
   var msg = await activity;

   await context.Forward(new QnABot(), Whatever, msg, CancellationToken.None);
}