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
- 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 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|