@@ -87,25 +87,32 @@ export class MemoryManager {
8787
8888 try {
8989 this . db = await MemoryDatabase . create ( `${ this . store . getMemoryDir ( ) } /index.sqlite` ) ;
90- const fingerprint = client ? `${ client . provider } :${ client . model } ` : 'none:none' ;
91- if ( this . db . getProviderFingerprint ( ) !== fingerprint ) {
92- this . db . clearEmbeddings ( ) ;
93- this . db . setProviderFingerprint ( fingerprint ) ;
94- }
95-
96- this . indexer = new MemoryIndexer ( this . store , this . db , {
97- chunkTokens : this . config . chunkTokens ,
98- overlapTokens : this . config . chunkOverlapTokens ,
99- watchDebounceMs : this . config . watchDebounceMs ,
100- embeddingClient : client ,
101- indexSessions : this . config . indexSessions ,
102- } ) ;
103- this . indexer . startWatching ( ) ;
104- await this . indexer . sync ( { force : false } ) ;
10590 } catch ( error ) {
10691 this . initError = error instanceof Error ? error . message : String ( error ) ;
10792 this . db = null ;
10893 this . indexer = null ;
94+ return ;
95+ }
96+
97+ const fingerprint = client ? `${ client . provider } :${ client . model } ` : 'none:none' ;
98+ if ( this . db . getProviderFingerprint ( ) !== fingerprint ) {
99+ this . db . clearEmbeddings ( ) ;
100+ this . db . setProviderFingerprint ( fingerprint ) ;
101+ }
102+
103+ this . indexer = new MemoryIndexer ( this . store , this . db , {
104+ chunkTokens : this . config . chunkTokens ,
105+ overlapTokens : this . config . chunkOverlapTokens ,
106+ watchDebounceMs : this . config . watchDebounceMs ,
107+ embeddingClient : client ,
108+ indexSessions : this . config . indexSessions ,
109+ } ) ;
110+ this . indexer . startWatching ( ) ;
111+
112+ try {
113+ await this . indexer . sync ( { force : false } ) ;
114+ } catch ( error ) {
115+ this . initError = error instanceof Error ? error . message : String ( error ) ;
109116 }
110117 }
111118
0 commit comments