QnA Maker API + Azure Bot Serviceで、想定外の質問がきた場合や、質問の表記揺れを吸収できなかった場合の返答方法を変更する。
オンラインコードエディタでコードを編集する
ボットの管理 > ビルド > オンラインコードエディタで開く
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
テスト
デプロイが完了したらテストしてみる。
ちゃんと変更できていたらOK!