@@ -305,27 +305,17 @@ class FernScribe {
305305
306306 async queryTurbopuffer ( query , opts = { } ) {
307307 if ( ! query || query . trimStart ( ) . length === 0 ) {
308- < << << << HEAD
309308 console . log ( 'π§ Empty query provided to Turbopuffer' ) ;
310- = === ===
311- >>> >>> > origin / main
312309 return [ ] ;
313310 }
314311
315312 try {
316- < << << << HEAD
317313 console . log ( 'π§ Querying Turbopuffer with options:' , JSON . stringify ( opts , null , 2 ) ) ;
318314
319315 // Create embedding for the query
320316 const embeddingResponse = await this . createEmbedding ( query ) ;
321317 if ( ! embeddingResponse ) {
322318 console . error ( 'π§ Failed to create embedding for query' ) ;
323- = === ===
324- // Create embedding for the query
325- const embeddingResponse = await this . createEmbedding ( query ) ;
326- if ( ! embeddingResponse ) {
327- console . error ( 'Failed to create embedding for query' ) ;
328- > >>> >>> origin / main
329319 return [ ] ;
330320 }
331321
@@ -337,22 +327,18 @@ class FernScribe {
337327 ...( opts . urlsToIgnore && { urls_to_ignore : opts . urlsToIgnore } )
338328 } ;
339329
340- < << << << HEAD
341330 console . log ( 'π§ Turbopuffer request body (without embedding):' , {
342331 ...requestBody ,
343332 query_embedding : `[${ embeddingResponse . length } dimensions]`
344333 } ) ;
345334
346- = === ===
347- >>> >>> > origin / main
348335 const response = await fetch ( this . turbopufferEndpoint , {
349336 method : 'POST' ,
350337 headers : {
351338 'Authorization' : `Bearer ${ this . turbopufferApiKey } ` ,
352339 'Content-Type' : 'application/json'
353340 } ,
354341 body : JSON . stringify ( requestBody )
355- << < << << HEAD
356342 } ) ;
357343
358344 if ( ! response . ok ) {
@@ -393,25 +379,14 @@ class FernScribe {
393379 const errorText = await response . text ( ) ;
394380 console . error ( 'π§ Embedding API error details:' , errorText ) ;
395381 throw new Error ( `Embedding API error: ${ response . status } ` ) ;
396- = === ===
397- } ) ;
398-
399- if ( ! response . ok ) {
400- throw new Error ( `Turbopuffer API error: ${ response . status } ` ) ;
401- > >>> >>> origin / main
402382 }
403383
404384 const data = await response . json ( ) ;
405385 console . log ( 'π§ Embedding created successfully, dimensions:' , data . data [ 0 ] ?. embedding ?. length ) ;
406386 return data . data [ 0 ] ?. embedding ;
407387 } catch ( error ) {
408- < << << << HEAD
409388 console . error ( 'π§ Embedding creation failed:' , error ) ;
410389 return null ;
411- = === ===
412- console . error ( 'Turbopuffer query failed:' , error ) ;
413- return [ ] ;
414- > >>> >>> origin / main
415390 }
416391 }
417392
@@ -673,14 +648,11 @@ ${context.additionalContext ? `**Additional Context:** ${context.additionalConte
673648 context . additionalContext ? `\n\nAdditional Context:\n${ context . additionalContext } ` : ''
674649 ] . filter ( Boolean ) . join ( '\n' ) ;
675650
676- < << << << HEAD
677651 // Debug logging
678652 console . log ( 'π Enhanced query length:' , enhancedQuery . length ) ;
679653 console . log ( 'π Enhanced query preview:' , enhancedQuery . substring ( 0 , 500 ) + '...' ) ;
680654 console . log ( 'π Namespace:' , process . env . TURBOPUFFER_NAMESPACE || 'default' ) ;
681655
682- = === ===
683- >>> >>> > origin / main
684656 // Query TurboBuffer for relevant files
685657 console . log ( 'π Querying TurboBuffer for relevant files...' ) ;
686658 const searchResultURLs = new Set ( ) ;
@@ -691,14 +663,11 @@ ${context.additionalContext ? `**Additional Context:** ${context.additionalConte
691663 topK : 3
692664 } ) ;
693665
694- < << << << HEAD
695666 console . log ( 'π Turbopuffer results count:' , turbopufferResults . length ) ;
696667 if ( turbopufferResults . length > 0 ) {
697668 console . log ( 'π First result preview:' , JSON . stringify ( turbopufferResults [ 0 ] , null , 2 ) ) ;
698669 }
699670
700- = === ===
701- >>> >>> > origin / main
702671 // Deduplicate results by URL (following the original logic)
703672 for ( const result of turbopufferResults ) {
704673 const url = result . attributes ?. url ||
0 commit comments