如何使用 Azure Bot 从网站中提取纯文本?
How to pull plain text from website using Azure Bot?
我正在开发一个将连接到 Facebook Messenger 的 Azure 聊天机器人。该机器人的目的是或多或少地寻找当天的短语。我目前有一个 url returns 纯文本的当天短语。
我需要机器人做的是例如:
User: "Hi, what is the phrase for today?"
Bot 将搜索 url 并检索返回的纯文本。
Bot: "The phrase for today is 'Don't Give Up!'"
我目前正在将 QnA Maker 用于知识库,但它仅适用于静态常见问题解答,不适用于从网站提取文本。任何帮助将不胜感激。
谢谢,
阿克塞尔
有几种不同的方法可以解决这个问题:
以编程方式更新您的 QnA 知识库
您需要在机器人之外创建某种单独的函数(可能使用 Azure Functions),每天生成 this API request。
curl -v -X PATCH "https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/knowledgebases/{kbId}"
-H "Content-Type: application/json"
-H "Ocp-Apim-Subscription-Key: {subscription key}"
--data-ascii "{body}"
正文:
{
"add": {
"qnaList": [
{
"id": 0,
"answer": "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle",
"source": "Custom Editorial",
"questions": [
"How can I change the default message from QnA Maker?"
],
"metadata": []
},
[...]
让机器人使用 HTTP 请求获取每日短语
或者:
您可以从拦截 equal/contain:
的消息开始
"Hi, what is the phrase for today?"
或者,如果您希望用户的问题更灵活一点,您可以use LUIS to parse user input and return an intent。
将其编码到机器人中后,只需让机器人向您的网站发出常规 HTTP 请求,然后将其发送给用户即可。
如果需要,我可以提供一些代码示例,但请提供一个代码示例,说明您希望在您的机器人中发生这种情况的位置。您的短语 URL 也可能有帮助。
我正在开发一个将连接到 Facebook Messenger 的 Azure 聊天机器人。该机器人的目的是或多或少地寻找当天的短语。我目前有一个 url returns 纯文本的当天短语。
我需要机器人做的是例如:
User: "Hi, what is the phrase for today?"
Bot 将搜索 url 并检索返回的纯文本。
Bot: "The phrase for today is 'Don't Give Up!'"
我目前正在将 QnA Maker 用于知识库,但它仅适用于静态常见问题解答,不适用于从网站提取文本。任何帮助将不胜感激。
谢谢,
阿克塞尔
有几种不同的方法可以解决这个问题:
以编程方式更新您的 QnA 知识库
您需要在机器人之外创建某种单独的函数(可能使用 Azure Functions),每天生成 this API request。
curl -v -X PATCH "https://westus.api.cognitive.microsoft.com/qnamaker/v4.0/knowledgebases/{kbId}"
-H "Content-Type: application/json"
-H "Ocp-Apim-Subscription-Key: {subscription key}"
--data-ascii "{body}"
正文:
{
"add": {
"qnaList": [
{
"id": 0,
"answer": "You can change the default message if you use the QnAMakerDialog. See this for details: https://docs.botframework.com/en-us/azure-bot-service/templates/qnamaker/#navtitle",
"source": "Custom Editorial",
"questions": [
"How can I change the default message from QnA Maker?"
],
"metadata": []
},
[...]
让机器人使用 HTTP 请求获取每日短语
或者:
您可以从拦截 equal/contain:
的消息开始"Hi, what is the phrase for today?"
或者,如果您希望用户的问题更灵活一点,您可以use LUIS to parse user input and return an intent。
将其编码到机器人中后,只需让机器人向您的网站发出常规 HTTP 请求,然后将其发送给用户即可。
如果需要,我可以提供一些代码示例,但请提供一个代码示例,说明您希望在您的机器人中发生这种情况的位置。您的短语 URL 也可能有帮助。