Elffuss BraidHub

utopia-ia/elffuss-code public

notif-run, settings-ux, messages-ux: WebGPU simulada para el modelo ligero

Los tres usan la tarjeta del ONNX ligero, que desde d526a74 solo se ofrece con
WebGPU. El navegador de pruebas tiene navigator.gpu sin adaptador, así que se
quedaban esperando una tarjeta que ya no existe. Estos tests no van de la GPU:
se les da una WebGPU simulada y pequeña (no entra Gemma), como onnx-autoload.
Changeset17d8624c4d4f7404f60b845f68f078d8234f3d78519c51e45735d2fe33db48fa
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-13 12:40 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-13 12:40 +02:00
Parents405a38187cae

Browse the files at this changeset

3 files changed

modified tests/messages-ux.mjs +8 −1
@@ -28,7 +28,14 @@
2828 const errs = [];
2929 const abre = async (locale, query = '') => {
3030 const ctx = await b.newContext({ locale });
31- await ctx.addInitScript(() => { try { localStorage.setItem('elffusscode.model', 'rules'); } catch {} window.__alerts = 0; window.alert = () => { window.__alerts++; }; });
31+ // WebGPU simulada y pequeña: desde d526a74 la tarjeta del ONNX ligero solo sale
32+ // con WebGPU, y el navegador de pruebas tiene navigator.gpu sin adaptador.
33+ await ctx.addInitScript(() => {
34+ try { localStorage.setItem('elffusscode.model', 'rules'); } catch {}
35+ window.__alerts = 0; window.alert = () => { window.__alerts++; };
36+ const falsa = { requestAdapter: async () => ({ limits: { maxBufferSize: 2 ** 28 }, features: new Set(), info: {}, requestDevice: async () => { throw new Error('no hace falta'); } }) };
37+ try { Object.defineProperty(Navigator.prototype, 'gpu', { get() { return falsa; }, configurable: true }); } catch { /* */ }
38+ });
3239 await ctx.route('**/js/providers/onnx.js*', r => r.fulfill({ status: 200, contentType: 'text/javascript', body: FALLA }));
3340 await ctx.route(/api\.github\.com|raw\.githubusercontent\.com/, r => r.abort());
3441 await ctx.route(/soundcloud/, r => r.abort());
modified tests/notif-run.mjs +5 −1
@@ -31,7 +31,11 @@
3131 async function abre({ modelo, sembrar = true, id = 'abc123def' }) {
3232 const ctx = await b.newContext({ locale: 'es-ES' });
3333 await ctx.addInitScript(m => {
34- try { Object.defineProperty(Navigator.prototype, 'gpu', { get() { return undefined; }, configurable: true }); } catch { /* */ }
34+ // WebGPU simulada y pequeña (no entra Gemma): desde d526a74 el ONNX ligero
35+ // solo se ofrece con WebGPU, y este test va del flujo de la notificación,
36+ // no de la GPU. transformers.js es de mentira: no se baja nada.
37+ const falsa = { requestAdapter: async () => ({ limits: { maxBufferSize: 2 ** 28 }, features: new Set(), info: {}, requestDevice: async () => { throw new Error('no hace falta'); } }) };
38+ try { Object.defineProperty(Navigator.prototype, 'gpu', { get() { return falsa; }, configurable: true }); } catch { /* */ }
3539 try { localStorage.setItem('elffusscode.model', m); } catch { /* */ }
3640 }, modelo);
3741 const p = await ctx.newPage({ viewport: { width: 1400, height: 900 } });
modified tests/settings-ux.mjs +4 −0
@@ -33,6 +33,10 @@
3333 try { localStorage.setItem('elffusscode.model', 'rules'); localStorage.setItem('elffusscode.bridgeToken', 'tok-de-prueba'); } catch {}
3434 const datos = arch === null ? undefined : { getHighEntropyValues: async () => ({ architecture: arch }) };
3535 Object.defineProperty(Navigator.prototype, 'userAgentData', { get: () => datos, configurable: true });
36+ // WebGPU simulada y pequeña: desde d526a74 la tarjeta del ONNX ligero solo
37+ // sale con WebGPU, y el navegador de pruebas tiene navigator.gpu sin adaptador.
38+ const falsa = { requestAdapter: async () => ({ limits: { maxBufferSize: 2 ** 28 }, features: new Set(), info: {}, requestDevice: async () => { throw new Error('no hace falta'); } }) };
39+ try { Object.defineProperty(Navigator.prototype, 'gpu', { get() { return falsa; }, configurable: true }); } catch { /* */ }
3640 }, arch);
3741 const p = await ctx.newPage({ viewport: { width: 1400, height: 900 } });
3842 p.on('pageerror', e => errs.push(e.message.slice(0, 160)));