mirror of
https://github.com/Mintplex-Labs/anything-llm.git
synced 2024-11-14 02:20:12 +01:00
parent
78b0a91073
commit
718062d033
@ -18,8 +18,12 @@ const Milvus = {
|
|||||||
// Milvus/Zilliz only allows letters, numbers, and underscores in collection names
|
// Milvus/Zilliz only allows letters, numbers, and underscores in collection names
|
||||||
// so we need to enforce that by re-normalizing the names when communicating with
|
// so we need to enforce that by re-normalizing the names when communicating with
|
||||||
// the DB.
|
// the DB.
|
||||||
|
// If the first char of the collection is not an underscore or letter the collection name will be invalid.
|
||||||
normalize: function (inputString) {
|
normalize: function (inputString) {
|
||||||
return inputString.replace(/[^a-zA-Z0-9_]/g, "_");
|
let normalized = inputString.replace(/[^a-zA-Z0-9_]/g, "_");
|
||||||
|
if (new RegExp(/^[a-zA-Z_]/).test(normalized.slice(0, 1)))
|
||||||
|
normalized = `anythingllm_${normalized}`;
|
||||||
|
return normalized;
|
||||||
},
|
},
|
||||||
connect: async function () {
|
connect: async function () {
|
||||||
if (process.env.VECTOR_DB !== "milvus")
|
if (process.env.VECTOR_DB !== "milvus")
|
||||||
|
@ -20,8 +20,12 @@ const Zilliz = {
|
|||||||
// Milvus/Zilliz only allows letters, numbers, and underscores in collection names
|
// Milvus/Zilliz only allows letters, numbers, and underscores in collection names
|
||||||
// so we need to enforce that by re-normalizing the names when communicating with
|
// so we need to enforce that by re-normalizing the names when communicating with
|
||||||
// the DB.
|
// the DB.
|
||||||
|
// If the first char of the collection is not an underscore or letter the collection name will be invalid.
|
||||||
normalize: function (inputString) {
|
normalize: function (inputString) {
|
||||||
return inputString.replace(/[^a-zA-Z0-9_]/g, "_");
|
let normalized = inputString.replace(/[^a-zA-Z0-9_]/g, "_");
|
||||||
|
if (new RegExp(/^[a-zA-Z_]/).test(normalized.slice(0, 1)))
|
||||||
|
normalized = `anythingllm_${normalized}`;
|
||||||
|
return normalized;
|
||||||
},
|
},
|
||||||
connect: async function () {
|
connect: async function () {
|
||||||
if (process.env.VECTOR_DB !== "zilliz")
|
if (process.env.VECTOR_DB !== "zilliz")
|
||||||
|
Loading…
Reference in New Issue
Block a user