Use JSON5 for embeddings (#719)
Browse files
src/lib/server/embeddingModels.ts
CHANGED
@@ -9,6 +9,8 @@ import {
|
|
9 |
} from "$lib/server/embeddingEndpoints/embeddingEndpoints";
|
10 |
import { embeddingEndpointTransformersJS } from "$lib/server/embeddingEndpoints/transformersjs/embeddingEndpoints";
|
11 |
|
|
|
|
|
12 |
const modelConfig = z.object({
|
13 |
/** Used as an identifier in DB */
|
14 |
id: z.string().optional(),
|
@@ -37,7 +39,7 @@ const rawEmbeddingModelJSON =
|
|
37 |
}
|
38 |
]`;
|
39 |
|
40 |
-
const embeddingModelsRaw = z.array(modelConfig).parse(
|
41 |
|
42 |
const processEmbeddingModel = async (m: z.infer<typeof modelConfig>) => ({
|
43 |
...m,
|
|
|
9 |
} from "$lib/server/embeddingEndpoints/embeddingEndpoints";
|
10 |
import { embeddingEndpointTransformersJS } from "$lib/server/embeddingEndpoints/transformersjs/embeddingEndpoints";
|
11 |
|
12 |
+
import JSON5 from "json5";
|
13 |
+
|
14 |
const modelConfig = z.object({
|
15 |
/** Used as an identifier in DB */
|
16 |
id: z.string().optional(),
|
|
|
39 |
}
|
40 |
]`;
|
41 |
|
42 |
+
const embeddingModelsRaw = z.array(modelConfig).parse(JSON5.parse(rawEmbeddingModelJSON));
|
43 |
|
44 |
const processEmbeddingModel = async (m: z.infer<typeof modelConfig>) => ({
|
45 |
...m,
|