出现错误“读取机器人文件时出错。请确保您有有效的 botFilePath”在 Microsoft azure QnA Maker Bot Javascript 文件中

发布于 2025-01-09 17:10:13 字数 1127 浏览 5 评论 0原文

我正在使用 javascript 开发 Microsoft azure QnA Maker Bot。我在基于qnamaker.io的知识中添加了问题。我已经使用 botbuilder 创建了 javascript 项目,并创建了 .bot 文件来添加服务,例如,

{ “名称”:“qna-bot-v4”, “服务”:[ { “类型”:“端点”, "name":"开发", “端点”:“http://localhost:3978/api/messages”, “应用程序ID”:“”, "应用程序密码":"", “id”:“1” }, { “类型”:“qna”, “名称”:“xxx-test-kb”, "kbId":"d7e734bc-6e1b-499c-80bc-42eb6db2fb3d", “主机名”:“https://xxx-qna-service.cognitiveservices.azure.com/”, “端点密钥”:“78511920-63b0-4437-8a7e-9bafbac54ac3”, "订阅密钥":"1c44011f-1da7-4239-bd15-5be74bbfc664", “id”:“123” } ], “挂锁”:””, “版本”:“2.0” 我已经使用 botbuilderconfigurations 和 botbuilder-config 更新了 index.js文件

,并使用 .env 文件设置了 botfile 的路径。 当我使用命令 node index.js 运行 index.js 文件时,我收到以下错误。

读取机器人文件时出错。请确保您有有效的 botFilePath

  • botFileSecret 在您的 azure 机器人的 appsetting 下可用
  • 如果您在本地运行此机器人,请考虑添加新的 .env 文件 请参阅 https://aka.ms/about-bot-file 了解有关 .bot 的详细信息文件 D:\用户\演示\Azure_bot\qna-bot-v-4\index.js:51 const endpointConfig = botConfig.findServiceByNameOrId(BOT_CONFIGURATION); ^ 类型错误:无法读取未定义的属性“findServiceByNameOrId”。

I am developing Microsoft azure QnA Maker Bot with javascript. I have added questions in knowledge based of qnamaker.io. i have created javascript project with botbuilder and create .bot file for adding services like,

{
"name":"qna-bot-v4",
"services": [
{
"type":"endpoint",
"name":"development",
"endpoint":"http://localhost:3978/api/messages",
"appId":"",
"appPassword":"",
"id":"1"
},
{
"type":"qna",
"name":"xxx-test-kb",
"kbId":"d7e734bc-6e1b-499c-80bc-42eb6db2fb3d",
"hostname":"https://xxx-qna-service.cognitiveservices.azure.com/",
"endpointKey": "78511920-63b0-4437-8a7e-9bafbac54ac3",
"subscriptionKey":"1c44011f-1da7-4239-bd15-5be74bbfc664",
"id":"123"
}
],
"padlock":"",
"version":"2.0"
}

I have updated index.js file with botbuilderconfigurations and botbuilder-config and set the path of botfile with .env file.
When i run the index.js file with command node index.js then i'm getting following error.

Error reading bot file. please ensure you have valid botFilePath

  • The botFileSecret is availble under appsetting for your azure bot
  • If you are running this bot locally, consider adding a new .env file
    see https://aka.ms/about-bot-file to learn more about .bot file
    D:\user\Demos\Azure_bot\qna-bot-v-4\index.js:51
    const endpointConfig = botConfig.findServiceByNameOrId(BOT_CONFIGURATION);
    ^
    TypeError: Cannot read property 'findServiceByNameOrId' of undefined.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

青瓷清茶倾城歌 2025-01-16 17:10:13

考虑在 index.js 中加载机器人配置的 try...catch 块中打印错误。例如,console.error(err)。您遇到的错误类型可能与错误消息中所述的错误类型不同。
另请参阅类似的SO 线程

Consider printing the error in the try... catch block in index.js, where you're loading the Bot Configuration. console.error(err), for example. It's possible that you're experiencing a different type of error than the one stated in the error message.
Also please refer to this similar SO thread.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文