QnA Maker is a cloud-based Natural Language Processing (NLP) service that easily creates a natural conversational layer over your data.
Wechaty QnAMaker can be used to find the most appropriate answer for WeChat users, from your custom knowledge base (KB) of information.
Wechaty QnAMaker Plugin helps you to answer questions in WeChat with the power of https://QnAMaker.ai.
To use the plugin:
import { WechatyQnAMaker } from 'wechaty-qnamaker' const config = { mention: true, // default true: require mention the bot in room. room: true, contact: true, // enable direct message. /** * Language of Questions & Score of Answers */ language: 'english', scoreThreshold: 50, // minimum score for the answer /** * QnAMaker Service API */ endpointKey: '705a3468-12bb-4e10-a314-7daa947f18d6', knowledgeBaseId: '254e33ad-ca6d-405d-980d-dbd3615e2605', resourceName: 'wechaty', } const QnAMakerPlugin = WechatyQnAMaker(config) const wechaty = new Wechaty() wechaty.use(QnAMakerPlugin)
We also provide a Vorpal Command:
import { WechatyVorpal, WechatyVorpalConfig, } from 'wechaty-vorpal' import { Faq } from 'wechaty-qnamaker' const vorpalConfig: WechatyVorpalConfig = { contact : true, mention : true, room : true, silent : true, use: [ Faq(configCeibs), ], } const VorpalPlugin = WechatyVorpal(vorpalConfig) const wechaty = new Wechaty() wechaty.use(VorpalPlugin)
endpointKey
: Endpoint Key for QnAMaker.aiknowledgeBaseId
: Knowledge Base ID for your knowledge base (KB)resourceName
: Resource Name for your Cognitive Service. (for example, wechaty
is the Resource Name for https://wechaty.azurewebsites.net
)config.language
: If set to a language ('chinese', 'english', etc), then the plugin will only reply message text in that specified language. (default: match all languages)config.scoreThreshold
: If the answer from QnAMaker.ai service has a score below the scoreThreshold
, then that answer will not be used. (A perfect score is 100
)config.contact
: Whether to allow direct message to be sync with ticket reply. false
to deny all, true
for allow all; Supports contact id(string
) and contact name(RegExp
). You can also mix them in array.config.room
: The room id of your service WeChat room.config.mention
: Whether require the message mention the bot.config.skipMessage
: If set it to string
or RegExp
, then the message text that match the config will not be processed by the plugin. Array supported.The following two environment variables will be used if the required information is not provided by the config.
WECHATY_PLUGIN_QNAMAKER_ENDPOINT_KEY
process.env.WECHATY_PLUGIN_QNAMAKER_ENDPOINT_KEY
will be used if the config.endpointKey
is not provided.
WECHATY_PLUGIN_QNAMAKER_KNOWLEDGE_BASE_ID
process.env.WECHATY_PLUGIN_QNAMAKER_KNOWLEDGE_BASE_ID
will be used if the config.knowledgeBaseId
is not provided.
WECHATY_PLUGIN_QNAMAKER_RESOURCE_NAME
process.env.WECHATY_PLUGIN_QNAMAKER_RESOURCE_NAME
will be used if the config.resourceName
is not provided.
Our Friday BOT are using wechaty-qnamaker
to connect our WeChat conversations with QnAMaker.
Note: our question & answer pairs sheet are open to edit. Please feel free to add question & answer pair if you believe it's necessary, and thank you for your contribution!
Release v1.0
faq
minScore
to scoreThreshold
in configOptions
.wechaty-plugin-qnamaker
to wechaty-qnamaker
Huan LI (李卓桓), Microsoft Regional Director & AI MVP, <zixia@zixia.net>