我需要通过我的dialogflow chatbot Google助手从Firebase存储中检索图像。我已经将映像上传到存储,并将http链接添加到firebase云数据库。如果我向Google助手(测试应用程序)询问“显示我的照片”,它应该会收到来自Firebase的图像响应。我已经在dialogflow中启用了webhook并使用index.js文件进行编码。 请帮助我添加用于图像检索的代码。 在此处填写代码
案例“ photo.database”: 请在此处填写代码。 休息;
现有代码
const functions = require('firebase-functions');
var admin = require('firebase-admin');
admin.initializeApp(functions.config().firebase);
var firestore = admin.firestore();
// // Create and Deploy Your First Cloud Functions
// // https://firebase.google.com/docs/functions/write-firebase-functions
exports.MyInformation = functions.https.onRequest((request, response) => {
console.log("request.body.result.parameters: ",
request.body.result.parameters);
let params = request.body.result.parameters;
switch (request.body.result.action) {
case 'write.database':
firestore.collection(${params.name}).doc(${params.document}).set(params)
.then(() => {
if((params.name) === Riyas Elliyas){
response.send({
speech:Your database has been updated with ${params.document} -
${params.content}
});
}
else{
response.send({
speech:Database of ${params.name} has been updated with ${params.document} -
${params.content}
});
}
})
.catch((e => {
console.log("error: ", e);
response.send({
speech: "something went wrong when writing on database"
});
}))
break;
case 'photo.database':
*** Imaging retrieving code is here ***
break;
default:
response.send({
speech: "no action matched in webhook"
});
}
});