mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-19 12:40:09 +01:00
Milvus bug fix (#2183)
* patch no text results for milvus chunks * wrap addDocumentToNamespace in try catch for handling milvus errors * lint * revert milvus db changes * add try catch to handle grpc error from milvus
This commit is contained in:
parent
cf6928fd5d
commit
a58f271149
@ -156,8 +156,9 @@ const Milvus = {
|
|||||||
vectorDimension = chunks[0][0].values.length || null;
|
vectorDimension = chunks[0][0].values.length || null;
|
||||||
|
|
||||||
await this.getOrCreateCollection(client, namespace, vectorDimension);
|
await this.getOrCreateCollection(client, namespace, vectorDimension);
|
||||||
|
try {
|
||||||
for (const chunk of chunks) {
|
for (const chunk of chunks) {
|
||||||
// Before sending to Pinecone and saving the records to our db
|
// Before sending to Milvus and saving the records to our db
|
||||||
// we need to assign the id of each chunk that is stored in the cached file.
|
// we need to assign the id of each chunk that is stored in the cached file.
|
||||||
const newChunks = chunk.map((chunk) => {
|
const newChunks = chunk.map((chunk) => {
|
||||||
const id = uuidv4();
|
const id = uuidv4();
|
||||||
@ -180,6 +181,13 @@ const Milvus = {
|
|||||||
collection_names: [this.normalize(namespace)],
|
collection_names: [this.normalize(namespace)],
|
||||||
});
|
});
|
||||||
return { vectorized: true, error: null };
|
return { vectorized: true, error: null };
|
||||||
|
} catch (insertError) {
|
||||||
|
console.error(
|
||||||
|
"Error inserting cached chunks:",
|
||||||
|
insertError.message
|
||||||
|
);
|
||||||
|
return { vectorized: false, error: insertError.message };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user