Files changed (3) hide show
  1. index.html +0 -0
  2. merge.js +77 -0
  3. unified-data.json +0 -0
index.html CHANGED
The diff for this file is too large to render. See raw diff
 
merge.js ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import fs from "fs";
2
+ import path from "path";
3
+
4
+ console.log("Loading source files...");
5
+
6
+ // 1. Load the sources
7
+ const imagesDb = JSON.parse(
8
+ fs.readFileSync(path.resolve("./data-hf-images.json"), "utf-8")
9
+ );
10
+
11
+ const uploadedDb = JSON.parse(
12
+ fs.readFileSync(path.resolve("./data-hf-uploaded.json"), "utf-8")
13
+ );
14
+
15
+ // 2. Setup mappings
16
+ const imgTypeMap = {
17
+ flux: "Flux",
18
+ wan: "WAN",
19
+ zimage: "ZImage",
20
+ sdxl: "SDXL",
21
+ qwen: "Qwen",
22
+ };
23
+
24
+ const complexKeys = ["flux", "wan", "zimage", "sdxl", "qwen"];
25
+ const simpleKeys = ["locon", "lora", "embedding"];
26
+
27
+ const finalDb = {};
28
+
29
+ // Source of truth
30
+ const sourceData = uploadedDb.data || {};
31
+ const allNames = Object.keys(sourceData).sort();
32
+
33
+ console.log(`Processing ${allNames.length} models...`);
34
+
35
+ for (const name of allNames) {
36
+ const rawModelData = sourceData[name];
37
+ const rawFiles = rawModelData.models || {};
38
+
39
+ const entry = {
40
+ lastUpdated: rawModelData.lastUpdated,
41
+ models: {},
42
+ };
43
+
44
+ // A. Simple types
45
+ for (const key of simpleKeys) {
46
+ entry.models[key] = rawFiles[key] || [];
47
+ }
48
+
49
+ // B. Complex types
50
+ for (const key of complexKeys) {
51
+ const filesList = rawFiles[key] || [];
52
+ let imgList = [];
53
+
54
+ const capitalizedKey = imgTypeMap[key];
55
+
56
+ if (imagesDb[name] && imagesDb[name][capitalizedKey]) {
57
+ imgList = imagesDb[name][capitalizedKey].map(item => item.url);
58
+ }
59
+
60
+ if (filesList.length === 0 && imgList.length === 0) {
61
+ entry.models[key] = [];
62
+ } else {
63
+ entry.models[key] = {
64
+ loras: filesList,
65
+ images: imgList,
66
+ };
67
+ }
68
+ }
69
+
70
+ finalDb[name] = entry;
71
+ }
72
+
73
+ // 3. Save
74
+ const outputPath = path.resolve("./unified-data.json");
75
+ fs.writeFileSync(outputPath, JSON.stringify(finalDb, null, 2), "utf-8");
76
+
77
+ console.log(`Success! Database built at ${outputPath}`);
unified-data.json ADDED
The diff for this file is too large to render. See raw diff