Update calculate_all_image_features.ts

main
qwertyforce 2023-07-05 20:56:14 +03:00
parent e5eebef7b1
commit a421ed83bf
1 changed files with 15 additions and 1 deletions

View File

@ -33,7 +33,21 @@ async function calculate_all_image_features(req: FastifyRequest<{ Body: FromSche
}
if (req.body.image_id.value) {
const image_id = parseInt(req.body.image_id.value)
const results = await image_ops.calculate_all_image_features(image_id, image_buffer)
const results:any = await image_ops.calculate_all_image_features(image_id, image_buffer)
console.log(results[3])
for(let i=0;i<results.length;i++){
const new_obj:any = {status:results[i].status}
if(results[i]?.reason?.message){
new_obj.reason = results[i].reason.message
}
if(results[i]?.value!==undefined){
new_obj.value=results[i].value
}
if(results[i]?.reason?.response?.data){
new_obj.data=results[i]?.reason?.response?.data
}
results[i] = new_obj
}
console.log(results)
res.send(results)
}