【发布时间】:2021-06-17 18:43:02
【问题描述】:
我想在 Dialogflow GUI 上显示来自 OMDB API 的数据,但它没有发生。数据在 Google Cloud Console 上显示良好。
function infoHandler(agent){
let movieName = agent.parameters.movie;
agent.add(`The information for ${movieName} is as follow`);
fetch('http://www.omdbapi.com/?apikey=e255decd%20&s='+ movieName)
.then(result => result.json())
.then((json) => {
let id = json.Search[0].imdbID;
fetch('http://www.omdbapi.com/?apikey=e255decd%20&i=' + id)
.then(result => result.json())
.then((json) => {
agent.add(json.Title + json.Plot + json.imdbRatinng);
return;
}).catch((ex) => {
console.log(ex);
});
})
.catch((e) => {console.log(e);});
【问题讨论】:
标签: fetch-api dialogflow-es-fulfillment