File tree Expand file tree Collapse file tree 1 file changed +22
-12
lines changed
server/utils/vectorDbProviders/qdrant Expand file tree Collapse file tree 1 file changed +22
-12
lines changed Original file line number Diff line number Diff line change @@ -276,18 +276,28 @@ const QDrant = {
276276 const chunks = [ ] ;
277277
278278 console . log ( "Inserting vectorized chunks into QDrant collection." ) ;
279- for ( const chunk of toChunks ( vectors , 500 ) ) chunks . push ( chunk ) ;
280-
281- const additionResult = await client . upsert ( namespace , {
282- wait : true ,
283- batch : {
284- ids : submission . ids ,
285- vectors : submission . vectors ,
286- payloads : submission . payloads ,
287- } ,
288- } ) ;
289- if ( additionResult ?. status !== "completed" )
290- throw new Error ( "Error embedding into QDrant" , additionResult ) ;
279+ for ( const chunk of toChunks ( vectors , 500 ) ) {
280+ const batchIds = [ ] ,
281+ batchVectors = [ ] ,
282+ batchPayloads = [ ] ;
283+ chunks . push ( chunk ) ;
284+ chunk . forEach ( ( v ) => {
285+ batchIds . push ( v . id ) ;
286+ batchVectors . push ( v . vector ) ;
287+ batchPayloads . push ( v . payload ) ;
288+ } ) ;
289+
290+ const additionResult = await client . upsert ( namespace , {
291+ wait : true ,
292+ batch : {
293+ ids : batchIds ,
294+ vectors : batchVectors ,
295+ payloads : batchPayloads ,
296+ } ,
297+ } ) ;
298+ if ( additionResult ?. status !== "completed" )
299+ throw new Error ( "Error embedding into QDrant" , additionResult ) ;
300+ }
291301
292302 await storeVectorResult ( chunks , fullFilePath ) ;
293303 }
You can’t perform that action at this time.
0 commit comments