LT風味

一口アウトプット

QnA Maker + Azure Bot Serviceで"No good match in FAQ"以外を返すように設定する方法

QnA Maker API + Azure Bot Serviceで、想定外の質問がきた場合や、質問の表記揺れを吸収できなかった場合の返答方法を変更する。

f:id:tantal73:20180414160655p:plain

オンラインコードエディタでコードを編集する

ボットの管理 > ビルド > オンラインコードエディタで開く

WWWROOT > Dialog > BasicQnAMakerDialog.csより以下の部分を編集

[Serializable]
    public class BasicQnAMakerDialog : QnAMakerDialog
    {
        // Go to https://qnamaker.ai and feed data, train & publish your QnA Knowledgebase.        
        // Parameters to QnAMakerService are:
        // Required: subscriptionKey, knowledgebaseId, 
        // Optional: defaultMessage, scoreThreshold[Range 0.0 – 1.0]
        public BasicQnAMakerDialog() : base(new QnAMakerService(new QnAMakerAttribute(Utils.GetAppSetting("QnASubscriptionKey"), Utils.GetAppSetting("QnAKnowledgebaseId"), "No good match in FAQ", 0.5)))
        {}
    }

編集が完了したら、deploy.cmdを右クリック > Run from Console

f:id:tantal73:20180414161657p:plain

テスト

デプロイが完了したらテストしてみる。

f:id:tantal73:20180414162012p:plain

ちゃんと変更できていたらOK!