Show local AI activity feedback
Build and publish static assets / publish (push) Successful in 8m21s

This commit is contained in:
Ein Anderssono
2026-10-19 12:36:43 +02:00
parent 2794b8904c
commit 214f3b5cbd
9 changed files with 67 additions and 45 deletions
+3 -3
View File
@@ -21,7 +21,7 @@ test('browser local AI prompt declares non-authoritative, bounded assistance tas
test('local AI runtime and model are published only under the owned static origin', async () => {
const source = fs.readFileSync(path.join(__dirname, '..', 'scripts', 'build-assets.mjs'), 'utf8');
assert.ok(source.includes('wllama-gemma3-v1'));
assert.ok(source.includes('wllama-gemma3-v2'));
assert.ok(source.includes('wllama-3.8.1.tgz'));
assert.ok(source.includes('gemma-3-1b-it-Q4_K_M.gguf'));
assert.ok(source.includes('manifest.json'));
@@ -45,6 +45,6 @@ test('Gemma terms, prohibited-use policy, notice, provenance, and runtime licens
assert.match(terms, /must include the use restrictions/);
assert.doesNotMatch(terms, /<script|google-signin|google-analytics/);
const nginx = fs.readFileSync(path.join(__dirname, '..', 'nginx', 'default.conf'), 'utf8');
assert.match(nginx, /location = \/static\/wllama-gemma3-v1\/manifest\.json[\s\S]*?Cache-Control "no-cache"/);
assert.match(nginx, /location = \/static\/wllama-gemma3-v1\/local-ai\.js[\s\S]*?Cache-Control "no-cache"/);
assert.match(nginx, /location = \/static\/wllama-gemma3-v2\/manifest\.json[\s\S]*?Cache-Control "no-cache"/);
assert.match(nginx, /location = \/static\/wllama-gemma3-v2\/local-ai\.js[\s\S]*?Cache-Control "no-cache"/);
});
+8 -1
View File
@@ -8,7 +8,7 @@ const source = fs.readFileSync(path.join(__dirname, '..', 'client', 'local-ai.js
test('local AI runtime rejects assets outside the same-origin static service', () => {
assert.match(source, /parsed\.origin !== location\.origin/);
assert.match(source, /parsed\.pathname\.startsWith\('\/static\/'\)/);
assert.match(source, /\/static\/wllama-gemma3-v1\//);
assert.match(source, /\/static\/wllama-gemma3-v2\//);
assert.doesNotMatch(source, /huggingface\.co|registry\.npmjs\.org/);
});
@@ -19,6 +19,13 @@ test('local assistance includes preflight, bounded continuity, and unsaved offli
assert.match(source, /Jag kan inte skapa ett lokalt förslag/);
});
test('local AI reports when on-device inference starts, finishes, or fails', () => {
assert.match(source, /type: 'activity', text: 'Lokal Gemma 3 körs på den här enheten/);
assert.match(source, /Lokal Gemma 3 är klar\. Originalhandlingen skickas nu vidare/);
assert.match(source, /Lokal Gemma 3 kunde inte förbereda handlingen/);
assert.match(source, /Lokal Gemma 3 arbetar offline med ett osparat hjälpförslag/);
});
test('local diagnostics are opt-in, stored in IndexedDB, exportable, and deletable', () => {
assert.match(source, /ai-spel-local-ai-logs/);
assert.match(source, /indexedDB\.open/);