// Persistent cache check
const { data: cached, error: cacheError } = await supabase
.from('image_analysis_cache')
.select('result')
.eq('image_url', imageUrl)
.single();
if (cached && cached.result) {
console.log("[EdgeFunction DEBUG]: Returning cached Vision API response.");
return new Response(JSON.stringify(cached.result), {
headers: { 'Content-Type': 'application/json' },
});
}
else if (cacheError){
console.log("[EdgeFunction DEBUG]: error when fetching image from table: " + JSON.stringify(cacheError) );
}
// Persistent cache check
const { data: cached, error: cacheError } = await supabase
.from('image_analysis_cache')
.select('result')
.eq('image_url', imageUrl)
.single();
if (cached && cached.result) {
console.log("[EdgeFunction DEBUG]: Returning cached Vision API response.");
return new Response(JSON.stringify(cached.result), {
headers: { 'Content-Type': 'application/json' },
});
}
else if (cacheError){
console.log("[EdgeFunction DEBUG]: error when fetching image from table: " + JSON.stringify(cacheError) );
}