From 6e0b0ea932f316336fe60ab2af2b4f000387eade Mon Sep 17 00:00:00 2001 From: Nathan Sarrazin Date: Mon, 22 Jan 2024 14:20:46 +0100 Subject: [PATCH] Use JSON5 for embeddings (#719) --- src/lib/server/embeddingModels.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/server/embeddingModels.ts b/src/lib/server/embeddingModels.ts index 70e570ada2b..75d65606bc6 100644 --- a/src/lib/server/embeddingModels.ts +++ b/src/lib/server/embeddingModels.ts @@ -9,6 +9,8 @@ import { } from "$lib/server/embeddingEndpoints/embeddingEndpoints"; import { embeddingEndpointTransformersJS } from "$lib/server/embeddingEndpoints/transformersjs/embeddingEndpoints"; +import JSON5 from "json5"; + const modelConfig = z.object({ /** Used as an identifier in DB */ id: z.string().optional(), @@ -37,7 +39,7 @@ const rawEmbeddingModelJSON = } ]`; -const embeddingModelsRaw = z.array(modelConfig).parse(JSON.parse(rawEmbeddingModelJSON)); +const embeddingModelsRaw = z.array(modelConfig).parse(JSON5.parse(rawEmbeddingModelJSON)); const processEmbeddingModel = async (m: z.infer) => ({ ...m,