Skip to content

Commit 266f9b1

Browse files
matte1782claude
andcommitted
fix(demo): WASM loading broken on entity-RAG and SIMD benchmark pages
- Add missing storage.js snippet (edgevec-59b9f14da3349a9d) that was blocked by docs/demo/pkg/.gitignore — caused 404 on GitHub Pages, breaking entity-RAG demo on all platforms including iOS - Fix SIMD benchmark import path from ../../pkg/ to ./pkg/ Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 09ae35d commit 266f9b1

2 files changed

Lines changed: 47 additions & 1 deletion

File tree

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
export class IndexedDbBackend {
2+
static async write(name, data) {
3+
return new Promise((resolve, reject) => {
4+
const req = indexedDB.open("EdgeVecDB", 1);
5+
req.onupgradeneeded = (e) => {
6+
const db = e.target.result;
7+
if (!db.objectStoreNames.contains('files')) {
8+
db.createObjectStore('files');
9+
}
10+
};
11+
req.onsuccess = (e) => {
12+
const db = e.target.result;
13+
const tx = db.transaction(['files'], 'readwrite');
14+
const store = tx.objectStore('files');
15+
store.put(data, name);
16+
tx.oncomplete = () => {
17+
resolve();
18+
};
19+
tx.onerror = () => reject(tx.error);
20+
};
21+
req.onerror = () => reject(req.error);
22+
});
23+
}
24+
25+
static async read(name) {
26+
return new Promise((resolve, reject) => {
27+
const req = indexedDB.open("EdgeVecDB", 1);
28+
req.onsuccess = (e) => {
29+
const db = e.target.result;
30+
const tx = db.transaction(['files'], 'readonly');
31+
const store = tx.objectStore('files');
32+
const getReq = store.get(name);
33+
getReq.onsuccess = () => {
34+
if (getReq.result) {
35+
resolve(getReq.result);
36+
} else {
37+
reject(new Error(`File ${name} not found`));
38+
}
39+
};
40+
getReq.onerror = () => reject(getReq.error);
41+
};
42+
req.onerror = () => reject(req.error);
43+
});
44+
}
45+
}
46+

docs/demo/simd_benchmark.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1106,7 +1106,7 @@ <h2 class="section__title">BROWSER_COMPATIBILITY</h2>
11061106
try {
11071107
log('Initializing EdgeVec WASM module...', 'info');
11081108

1109-
const { default: init, EdgeVec, EdgeVecConfig } = await import('../../pkg/edgevec.js');
1109+
const { default: init, EdgeVec, EdgeVecConfig } = await import('./pkg/edgevec.js');
11101110
await init();
11111111

11121112
state.edgevec = { EdgeVec, EdgeVecConfig };

0 commit comments

Comments
 (0)