有没有办法像DialogFlow ES版本那样直接用React原生应用实现DialogFlow-cx?我也在尝试REST API,但不起作用。
我想从我的React-Native App.But调用Dialogflow CX API,我已经从服务帐户下载了私钥作为JSON文件。下面是我尝试过的示例代码
let data = {
"queryInput": {
"text": {
"text": "Hi!"
},
"languageCode": "en"
},
"queryParams": {
"timeZone": "Asia/Colombo"
}
}
fetch(DEFAULT_BASE_URL + this.projectId +"/locations/"+ this.location + "/agent/"+ this.agentId +"/sessions/" + this.sessionId + ":detectIntent", {
method: "POST",
headers: {
'Content-Type': 'application/json; charset=utf-8',
'Authorization': 'Bearer ' + this.accessToken,
'charset': "utf-8"
},
body: JSON.stringify(data)
})
.then(function (response) {
console.log("RESPONSE=== ");
console.log(response);
// var json = response.json().then(onResult)
})
.catch(onError);
};发布于 2021-09-17 10:55:12
我在URL中将代理更改为代理,它起作用了。这是一个来自Google https://cloud.google.com/dialogflow/cx/docs/quick/api的参考文档
https://stackoverflow.com/questions/69172819
复制相似问题