fazeel007 commited on
Commit
7e9dcae
Β·
1 Parent(s): 159f7bb

Add detailed Modal usage logging for debugging

Browse files

- Added console logs to track Modal vector search attempts
- Shows when Modal is being called vs falling back to local search
- Helps debug why Modal credits aren't being consumed
- Better error handling and status reporting

Files changed (1) hide show
  1. server/smart-ingestion.ts +18 -9
server/smart-ingestion.ts CHANGED
@@ -187,15 +187,24 @@ class SmartIngestionService {
187
 
188
  // Step 2: Perform vector search using Modal's high-performance endpoint
189
  let modalResults = [];
190
- try {
191
- const modalResponse = await modalClient.vectorSearch(
192
- searchQuery,
193
- 'main_index', // Assuming we have a main index
194
- maxResults
195
- );
196
- modalResults = modalResponse.results || [];
197
- } catch (error) {
198
- console.log('Modal search unavailable, using local search');
 
 
 
 
 
 
 
 
 
199
  }
200
 
201
  // Step 3: Get local results as backup/supplement
 
187
 
188
  // Step 2: Perform vector search using Modal's high-performance endpoint
189
  let modalResults = [];
190
+
191
+ // Skip Modal if not configured properly
192
+ if (process.env.MODAL_TOKEN_ID && process.env.MODAL_TOKEN_SECRET) {
193
+ try {
194
+ console.log('πŸ”„ Attempting Modal vector search...');
195
+ const modalResponse = await modalClient.vectorSearch(
196
+ searchQuery,
197
+ 'main_index', // Assuming we have a main index
198
+ maxResults
199
+ );
200
+ modalResults = modalResponse.results || [];
201
+ console.log(`βœ… Modal search returned ${modalResults.length} results`);
202
+ } catch (error) {
203
+ console.log('❌ Modal search failed:', error instanceof Error ? error.message : String(error));
204
+ console.log('πŸ”„ Falling back to local search');
205
+ }
206
+ } else {
207
+ console.log('⚠️ Modal not configured, using local search only');
208
  }
209
 
210
  // Step 3: Get local results as backup/supplement