fix: enrichment pipeline reliability + loading page gradient + button click area
- generate-report: filter empty strings from AI social handles, add saveError logging - useReport: 3-level fallback for social handles (report > clinicInfo > scrape_data) - useEnrichment: always trigger enrichment if clinicName exists (not just IG/YT handles) - Hero: pointer-events-none on decorative blobs (were blocking button clicks) - AnalysisLoadingPage: warm gradient on INFINITH logo text (#fff3eb → #e4cfff → #f5f9ff) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
72ea8f4a2d
commit
ad625e08ee
5 files changed
+43
-21
No files matched your search
@@ -34,8 +34,7 @@ export function useEnrichment(
|
||||
|
||||
useEffect(() => {
|
||||
if (!baseReport || !params?.reportId || hasTriggered.current) return;
|
||||
// Don't enrich if no social handles are available
|
||||
if (!params.instagramHandle && !params.instagramHandles?.length && !params.youtubeChannelId) return;
|
||||
// Always enrich if clinicName exists — Naver, 강남언니, Google Maps work with name alone
|
||||
|
||||
hasTriggered.current = true;
|
||||
setStatus('loading');
|
||||
|
||||
+20
-11
@@ -76,21 +76,30 @@ export function useReport(id: string | undefined): UseReportResult {
|
||||
},
|
||||
);
|
||||
|
||||
// Recover social handles: report.socialHandles > scrape_data.clinic.socialMedia
|
||||
let handles = (reportJson.socialHandles as Record<string, string | null>) || null;
|
||||
if (!handles && scrapeData) {
|
||||
const clinic = scrapeData.clinic as Record<string, unknown> | undefined;
|
||||
const socialMedia = clinic?.socialMedia as Record<string, string> | undefined;
|
||||
if (socialMedia) {
|
||||
// Recover social handles: report.socialHandles > AI clinicInfo.socialMedia > scrape_data
|
||||
let handles = (reportJson.socialHandles as Record<string, string | null | string[]>) || null;
|
||||
if (!handles) {
|
||||
// Try AI-generated socialMedia in clinicInfo
|
||||
const aiSocial = (reportJson.clinicInfo as Record<string, unknown>)?.socialMedia as Record<string, unknown> | undefined;
|
||||
const scrapeSocial = scrapeData
|
||||
? (scrapeData.clinic as Record<string, unknown>)?.socialMedia as Record<string, string> | undefined
|
||||
: undefined;
|
||||
|
||||
const igSource = aiSocial?.instagramAccounts || aiSocial?.instagram || scrapeSocial?.instagram;
|
||||
const ytSource = (aiSocial?.youtube as string) || scrapeSocial?.youtube;
|
||||
|
||||
if (igSource || ytSource) {
|
||||
handles = {
|
||||
instagram: normalizeInstagramHandle(socialMedia.instagram),
|
||||
youtube: socialMedia.youtube || null,
|
||||
facebook: socialMedia.facebook || null,
|
||||
blog: socialMedia.blog || null,
|
||||
instagram: Array.isArray(igSource)
|
||||
? igSource.map((h: string) => normalizeInstagramHandle(h)).filter(Boolean)
|
||||
: normalizeInstagramHandle(igSource as string),
|
||||
youtube: ytSource || null,
|
||||
facebook: (aiSocial?.facebook as string) || scrapeSocial?.facebook || null,
|
||||
blog: (aiSocial?.naverBlog as string) || scrapeSocial?.blog || null,
|
||||
};
|
||||
}
|
||||
}
|
||||
setSocialHandles(handles);
|
||||
setSocialHandles(handles as Record<string, string | null> | null);
|
||||
|
||||
// If channelEnrichment already exists in DB, merge it immediately
|
||||
const enrichment = reportJson.channelEnrichment as EnrichmentData | undefined;
|
||||
|
||||
Reference in new issue
Block a user