File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1935,7 +1935,12 @@ export class ContentProcessor {
19351935 if ( lang ) {
19361936 try {
19371937 const codeChunker = await this . getCodeChunker ( lang , sourceConfig . chunk_size ) ;
1938- chunks = await codeChunker . chunk ( code ) ;
1938+ chunks = await Promise . race ( [
1939+ codeChunker . chunk ( code ) ,
1940+ new Promise < never > ( ( _ , reject ) =>
1941+ setTimeout ( ( ) => reject ( new Error ( `CodeChunker timed out after 30s for ${ normalizedPath || url } ` ) ) , 30000 )
1942+ )
1943+ ] ) ;
19391944 } catch ( error ) {
19401945 logger . warn ( `CodeChunker failed for ${ normalizedPath || url } , falling back to token chunking:` , error ) ;
19411946 const chunker = await this . getTokenChunker ( sourceConfig . chunk_size ) ;
Original file line number Diff line number Diff line change @@ -1726,7 +1726,7 @@ export class Doc2Vec {
17261726 const response = await this . openai . embeddings . create ( {
17271727 model : this . embeddingModel ,
17281728 input : safeTexts ,
1729- } ) ;
1729+ } , { timeout : 60000 } ) ;
17301730 logger . debug ( `Successfully created ${ response . data . length } embeddings` ) ;
17311731 return response . data . map ( d => d . embedding ) ;
17321732 } catch ( error ) {
@@ -1743,5 +1743,7 @@ if (require.main === module) {
17431743 process . exit ( 1 ) ;
17441744 }
17451745 const doc2Vec = new Doc2Vec ( configPath ) ;
1746- doc2Vec . run ( ) . catch ( console . error ) ;
1746+ doc2Vec . run ( )
1747+ . then ( ( ) => process . exit ( 0 ) )
1748+ . catch ( ( err ) => { console . error ( err ) ; process . exit ( 1 ) ; } ) ;
17471749}
Original file line number Diff line number Diff line change 11{
22 "name" : " doc2vec" ,
3- "version" : " 2.9.0 " ,
3+ "version" : " 2.9.1 " ,
44 "type" : " commonjs" ,
55 "description" : " " ,
66 "main" : " dist/doc2vec.js" ,
You can’t perform that action at this time.
0 commit comments