有沒有辦法像DialogFlow ES版那樣直接用React原生App實作DialogFlow-cx? 我也在嘗試使用REST API,但沒有成功。
。我想從我的React-Native App中呼叫Dialogflow CX API,但我得到了404,我也從服務賬戶中下載了JSON檔案的私鑰。 以下是我嘗試過的示例代碼
let data = {
"queryInput": {
"文本"。{
"text": "嗨!"
},
"languageCode": "en"
},
"queryParams": {
"timeZone": "亞洲/科倫坡"
}
}
fetch(DEFAULT_BASE_URL this.projectId "/locations/" this.location "/agent/" this.agentId "/sessions/" this.sessionId ":detectIntent", {
方法。"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)。
};
uj5u.com熱心網友回復:
我把URL中的代理改成了代理,它就成功了。 這里有一個參考檔案 來自Google https://cloud.google.com/dialogflow/cx/docs/quick/api
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/327329.html
標籤:
