Add improvements 2
This commit is contained in:
@@ -198,16 +198,27 @@ export const RegisterTenantStep: React.FC<RegisterTenantStepProps> = ({
|
||||
|
||||
// Trigger POI detection in the background (non-blocking)
|
||||
// This replaces the removed POI Detection step
|
||||
// POI detection will be cached for 90 days and reused during training
|
||||
const bakeryLocation = wizardContext.state.bakeryLocation;
|
||||
if (bakeryLocation?.latitude && bakeryLocation?.longitude && tenant.id) {
|
||||
console.log(`🔍 Triggering background POI detection for tenant ${tenant.id}...`);
|
||||
|
||||
// Run POI detection asynchronously without blocking the wizard flow
|
||||
// This ensures POI data is ready before the training step
|
||||
poiContextApi.detectPOIs(
|
||||
tenant.id,
|
||||
bakeryLocation.latitude,
|
||||
bakeryLocation.longitude,
|
||||
false // use_cache = false for initial detection
|
||||
false // force_refresh = false, will use cache if available
|
||||
).then((result) => {
|
||||
console.log(`✅ POI detection completed automatically for tenant ${tenant.id}:`, result.summary);
|
||||
const source = result.source || 'unknown';
|
||||
console.log(`✅ POI detection completed for tenant ${tenant.id} (source: ${source})`);
|
||||
|
||||
if (result.poi_context) {
|
||||
const totalPois = result.poi_context.total_pois_detected || 0;
|
||||
const relevantCategories = result.poi_context.relevant_categories?.length || 0;
|
||||
console.log(`📍 POI Summary: ${totalPois} POIs detected, ${relevantCategories} relevant categories`);
|
||||
}
|
||||
|
||||
// Phase 3: Handle calendar suggestion if available
|
||||
if (result.calendar_suggestion) {
|
||||
@@ -229,9 +240,12 @@ export const RegisterTenantStep: React.FC<RegisterTenantStepProps> = ({
|
||||
}
|
||||
}
|
||||
}).catch((error) => {
|
||||
console.warn('⚠️ Background POI detection failed (non-blocking):', error);
|
||||
// This is non-critical, so we don't block the user
|
||||
console.warn('⚠️ Background POI detection failed (non-blocking):', error);
|
||||
console.warn('Training will continue without POI features if detection is not complete.');
|
||||
// This is non-critical - training service will continue without POI features
|
||||
});
|
||||
} else {
|
||||
console.warn('⚠️ Cannot trigger POI detection: missing location data or tenant ID');
|
||||
}
|
||||
|
||||
// Update the wizard context with tenant info
|
||||
|
||||
Reference in New Issue
Block a user