- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
下面是我使用 Node.js 中的请求模块调用 microsoft QnAmaker API 的代码。
var request=require('request');
var demo=[];
console.log("Doing the Post Operations...");
// Define an demo object with properties and values. This object will be used for POST request.
var demo=JSON.stringify({
"question": "Hi",
"top": 1
});
request({
uri:"https://westus.api.cognitive.microsoft.com/qnamaker/v2.0/knowledgebases/my_kb_id/generateAnswer",
method: "POST",
json: true,
headers:{
'Ocp-Apim-Subscription-Key':'my_key',
'Content-Type':'application/json'
},
body: demo
}, function (error, response, body){
console.log(response);
});
这给我返回了“Bad Argument”错误。我哪里出错了?
最佳答案
我编写了使用 Node.js 中的请求模块调用 Microsoft QnA Maker API 的代码。下面的代码工作正常。我没有使用 JSON.stringify 直接将演示作为 JSON 传递。
var request=require('request');
var demo={"question" : "hi",
"top": 4};
url='https://accountqna.azurewebsites.net/qnamaker/knowledgebases/my_kb_id/generateAnswer';
atuhorisationKey="EndpointKey <atuhorisationKey>"
request({
url: url,
method: "POST",
headers:{
'Authorization':atuhorisationKey,
'Content-Type': 'application/json'
},
json:demo
}, function (error, response, body) {
if (!error && response.statusCode === 200) {
console.log(body)
}
else {
console.log("error: " + error)
console.log("response.statusCode: " + response.statusCode)
console.log("response.statusText: " + response.json)
}
})
关于node.js - 使用请求模块从 Node.js 调用 Microsoft QnA 制造商 API,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44959488/
按照目前的情况,这个问题不适合我们的问答形式。我们希望答案得到事实、引用或专业知识的支持,但这个问题可能会引发辩论、争论、投票或扩展讨论。如果您觉得这个问题可以改进并可能重新打开,visit the
有谁知道以编程方式检索 ram 内存制造商的方法? 谢谢! 最佳答案 现代 RAM 芯片有一个额外的板载 EPROM,其中包含大量关于 RAM 的信息。这方面的标准是 SPD,即串行存在检测。至少某些
有人可以确认 Build.MANUFACTURER 的值在 LG G4 设备上是什么吗。 import android.os.Build; Log.v("foobar", Build.MANUFACT
当我们使用 OEM 部署我们的产品时,我们要求我们的公司名称不会出现在 add remove/other 中安装的 Publisher 属性中。 虽然我们有简单的方法为发布者选择中性名称,但我们希望能
是否可以让 ldapjs(使用 nodejs)使用 TLS 而不仅仅是 SSL? 如果是,我该如何设置? 如果不是,他们是否有任何其他支持 TLS 的 nodejs ldap 库? 我能找到的唯一信息
我打算编写一个 Windows 应用程序,如果该应用程序可以判断正在使用的显卡,那将会很有用。至少,看看 GPU 的制造商会有所帮助。到目前为止,我还没有设置编程语言。 什么 Windows 库公开了
我正在为 Windows 服务项目开发 VS2010 安装程序。我想为该项目设置 [manufacturer] 属性,但我看不到它在 2010 年的位置。 当我当前尝试安装时,它会将 [制造商] 转换
我正在尝试构建一个模式规则,允许我在宏调用中使用 % 但我没有得到我期望的结果。 模式规则: %.o: %.cpp $(%_H) g++ -o $@ $(FLAGS) -c $< 问题出在 $
我使用 Microsoft 机器人框架开发了聊天机器人,我的客户希望将所有服务保留在 vNet 内部,但在 vNet 内部分配后我们无法访问认知服务。 有人可以帮助我实现这一目标并让我的客户满意吗?
在 GNU Makefile(在 Ubuntu Linux 系统上)中,如何删除列表中每个文件名的文件名后缀,以便在第一个点处截断文件名? 假设我有 NAMES = file1.a.b.c file2
在 GNU Makefile(在 Ubuntu Linux 系统上)中,如何删除列表中每个文件名的文件名后缀,以便在第一个点处截断文件名? 假设我有 NAMES = file1.a.b.c file2
我正在开发 C# 应用程序。我的要求是,每当 USB 设备连接到 PC 时,我必须检测(触发事件),如果连接的设备供应商 ID/制造商是“FTDI”,则将该连接端口传递给另一个事件。 我的代码是: p
您能帮我理解 GNU Make(版本 3.81)如何处理简单的 Makefile 吗?这是文件: .PHONY: a b c e f a : b c @echo "> a(b,c)" e :
下面是我使用 Node.js 中的请求模块调用 microsoft QnAmaker API 的代码。 var request=require('request'); var demo=[]; con
我正在使用 ARCore SDK 1.0 中的示例 Hello AR 进行测试。如何在 2D 制造商上显示 3D 模型,例如 QRCode?是否有任何类可以检测 ARCore API 中的 QRCod
我是一名优秀的程序员,十分优秀!