feat: add API Dashboard + filled icons + pipeline improvements
- Add /api-dashboard page with API connection status, env var checker, pipeline flow diagram, and cost estimator - Add 15 new filled SVG icons (Shield, Database, Server, Bolt, Eye, Copy, Check, Cross, Warning, Refresh, Flow, Coin, LinkExternal etc.) - Follow INFINITH design system: no emoji, no line icons, semantic status colors, diagonal shadows, brand gradients, font-serif headings - Improve Vision Analysis with base64 encoding fix - Add SectionErrorBoundary for graceful section-level error handling - Add Google Places API utility (prepared for future migration) - Fix Edge Function auth headers and report generation pipeline Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
2ca9ec0306
commit
ec991057e6
20 files changed
+1397
-109
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import "@supabase/functions-js/edge-runtime.d.ts";
|
||||
import { createClient } from "https://esm.sh/@supabase/supabase-js@2";
|
||||
import { normalizeInstagramHandle, normalizeYouTubeChannel } from "../_shared/normalizeHandles.ts";
|
||||
import { searchGooglePlace } from "../_shared/googlePlaces.ts";
|
||||
|
||||
const corsHeaders = {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
@@ -59,6 +60,7 @@ Deno.serve(async (req) => {
|
||||
|
||||
const APIFY_TOKEN = Deno.env.get("APIFY_API_TOKEN");
|
||||
if (!APIFY_TOKEN) throw new Error("APIFY_API_TOKEN not configured");
|
||||
const GOOGLE_PLACES_API_KEY = Deno.env.get("GOOGLE_PLACES_API_KEY") || "";
|
||||
|
||||
const enrichment: Record<string, unknown> = {};
|
||||
|
||||
@@ -135,50 +137,28 @@ Deno.serve(async (req) => {
|
||||
);
|
||||
}
|
||||
|
||||
// 2. Google Maps / Place Reviews
|
||||
if (clinicName || address) {
|
||||
// 2. Google Maps / Place Reviews (Google Places API New)
|
||||
if ((clinicName || address) && GOOGLE_PLACES_API_KEY) {
|
||||
tasks.push(
|
||||
(async () => {
|
||||
// Try multiple search queries for better hit rate
|
||||
const queries = [
|
||||
`${clinicName} 성형외과`,
|
||||
clinicName,
|
||||
`${clinicName} ${address || "강남"}`,
|
||||
];
|
||||
|
||||
let items: unknown[] = [];
|
||||
for (const query of queries) {
|
||||
items = await runApifyActor(
|
||||
"compass~crawler-google-places",
|
||||
{
|
||||
searchStringsArray: [query],
|
||||
maxCrawledPlacesPerSearch: 3,
|
||||
language: "ko",
|
||||
maxReviews: 10,
|
||||
},
|
||||
APIFY_TOKEN
|
||||
);
|
||||
if ((items as Record<string, unknown>[]).length > 0) break;
|
||||
}
|
||||
const place = (items as Record<string, unknown>[])[0];
|
||||
const place = await searchGooglePlace(
|
||||
clinicName || "",
|
||||
address || undefined,
|
||||
GOOGLE_PLACES_API_KEY,
|
||||
);
|
||||
if (place) {
|
||||
enrichment.googleMaps = {
|
||||
name: place.title,
|
||||
rating: place.totalScore,
|
||||
reviewCount: place.reviewsCount,
|
||||
name: place.name,
|
||||
rating: place.rating,
|
||||
reviewCount: place.reviewCount,
|
||||
address: place.address,
|
||||
phone: place.phone,
|
||||
clinicWebsite: place.website,
|
||||
mapsUrl: place.url || (place.title ? `https://www.google.com/maps/search/${encodeURIComponent(String(place.title))}` : ''),
|
||||
category: place.categoryName,
|
||||
clinicWebsite: place.clinicWebsite,
|
||||
mapsUrl: place.mapsUrl,
|
||||
placeId: place.placeId,
|
||||
category: place.category,
|
||||
openingHours: place.openingHours,
|
||||
topReviews: ((place.reviews as Record<string, unknown>[]) || [])
|
||||
.slice(0, 10)
|
||||
.map((r) => ({
|
||||
stars: r.stars,
|
||||
text: (r.text as string || "").slice(0, 200),
|
||||
publishedAtDate: r.publishedAtDate,
|
||||
})),
|
||||
topReviews: place.topReviews,
|
||||
};
|
||||
}
|
||||
})()
|
||||
|
||||
Reference in new issue
Block a user