G. Micskei
G. Micskei

Reputation: 43

QNA chatbot "say the feedback" with Cortana

I created a QNA (qnamaker.ai) and a chatbot in Azure. They connected and doing what they should do. I activated Cortana channel on azure than if I use the right invocation method its giving the right feedback just it doesn’t talk at all. I saw that Cortana will answer verbally if you invoked or queried with speech but seems not working.

I tried to recreate the whole app but it doesn’t resolve my issue. I have created a basic C# UWP app with basic question and with that Cortana talks.

The code now is the default chatbot code from Microsoft.

I would ask your advice that if I miss some setting or I just need to modify the code?

Thanks for your help.

Gabor

    protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext, CancellationToken cancellationToken)
    {
        var httpClient = _httpClientFactory.CreateClient();

        var qnaMaker = new QnAMaker(new QnAMakerEndpoint
        {
            KnowledgeBaseId = _configuration["QnAKnowledgebaseId"],
            EndpointKey = _configuration["QnAAuthKey"],
            Host = GetHostname()
        },
        null,
        httpClient);

        _logger.LogInformation("Calling QnA Maker");

        // The actual call to the QnA Maker service.
        var response = await qnaMaker.GetAnswersAsync(turnContext);
        if (response != null && response.Length > 0)
        {
            await turnContext.SendActivityAsync(MessageFactory.Text(response[0].Answer), cancellationToken);
        }
        else
        {
            await turnContext.SendActivityAsync(MessageFactory.Text("No QnA Maker answers were found."), cancellationToken);
        }

Upvotes: 1

Views: 173

Answers (1)

Micromuncher
Micromuncher

Reputation: 903

Bot samples do not call the appropriate API to speak results. You need to add parameters for speech and input hints. Please see

https://github.com/microsoft/cortana-skills-samples/blob/master/Consumer/CSharp/V4Patches/11.qnamaker.diff

That shows a change to do this

                 await turnContext.SendActivityAsync(msg, speak: msg, inputHint: InputHints.AcceptingInput, cancellationToken: cancellationToken);

Upvotes: 0

Related Questions