繁体   English   中英

Microsoft QnA bot Node.js

[英]Microsoft QnA bot Node.js

好的,所以我放弃了我可以找到的所有说明,但是在设置好机器人之后,我只能

{“ statusCode”:404,“ message”:“找不到资源”}

var demo=JSON.stringify({"question":"Hi"});

var extServerOptionsPost={
    host:'westus.api.cognitive.microsoft.com',
    path:'/knowledgebases/*my_id*/generateAnswer',
    method:'POST',
    headers:{
        'Ocp-Apim-Subscription-Key':'*my_sub*',
        'Content-Type':'application/json',
        'Content-Length':Buffer.byteLength(demo)
}
};

var reqPost=http.request(extServerOptionsPost,function(res){
    console.log("response statusCode: ",res.statusCode);
    res.on('data',function(data){
        console.log('Posting Result:\n');
        process.stdout.write(data);
        console.log('\n\n POST Operation Completed');
    });
});


reqPost.write(demo);


reqPost.end();
reqPost.on('error',function(e){
    console.error(e);
});

任何想法? 谢谢!

喜,

您使用了错误的主机。 您可以使用主机: https : //westus.api.cognitive.microsoft.com/qnamaker/v1.0/knowledgebases/ / generateAnswer或https://westus.api.cognitive.microsoft.com/qnamaker/v2.0/知识库/ {knowledgeBaseID} / generateAnswer

另外,您可以在此处查看v2.0的完整文档: https : //westus.dev.cognitive.microsoft.com/docs/services/58994a073d9e04097c7ba6fe/operations/58994a073d9e041ad42d9baa

BR

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM