【发布时间】:2020-08-26 16:16:39
【问题描述】:
我正在尝试在我的 HTML 页面中检查我的 API 响应的可信度。 如果置信度为 0 {转到此页面} 如果置信度为 1 {转到此页面} 我可以检查其他事情,但不能检查意图信心我该怎么做?
fetch(`https://api.wit.ai/message?q=${transcript}`,
{
headers: {
Authorization: `Bearer ${token}`,
'Content-Type': 'application/json',
},
}).then(res => res.json())
.then(function (data){
if (data.intents[0].value==[0]) {
console.log("intent 1")
//throw "Error";
}
else if (data.text==="pay"){
console.log("works")
}
else {
if(data.intents==="checkout"){
console.log("intent 2");
}
}
})
【问题讨论】: