This commit is contained in:
2026-09-08 07:24:00 +01:00
parent d4097a5e5d
commit 2ddf450b9f
7 changed files with 32 additions and 10 deletions
+10 -4
View File
@@ -23,14 +23,18 @@ export default function sqlInsertGenerator({ tableName, data, dbFullName, }) {
queryBatches.push(`(${insertKeys
.map((ky) => {
const value = item[ky];
const is_embedding = Array.isArray(value) &&
typeof value[0] == "number";
const finalValue = typeof value == "string" ||
typeof value == "number"
? value
: typeof value == "function"
? value().value
: value
? value
: null;
: is_embedding
? JSON.stringify(value)
: value
? value
: null;
if (!finalValue && typeof value !== "number") {
queryValues.push(null);
return "?";
@@ -38,7 +42,9 @@ export default function sqlInsertGenerator({ tableName, data, dbFullName, }) {
queryValues.push(finalValue);
const placeholder = typeof value == "function"
? value().placeholder
: "?";
: is_embedding
? "VEC_FromText(?)"
: "?";
return placeholder;
})
.filter((k) => Boolean(k))