mirror of
https://github.com/RVC-Boss/GPT-SoVITS.git
synced 2026-07-24 03:25:44 +08:00
Wispr Flow-style voice keyboard app: speak naturally, get polished ready-to-send text. Installable PWA (iPhone/Android/desktop) with: - Live dictation via Web Speech API, or Whisper via any OpenAI-compatible endpoint - AI polish with writing modes (message/email/notes/formal/raw) - 80+ recognition languages with auto-detect, personal dictionary - Local-only history, Arabic RTL + English UI, light/dark themes - Offline app shell via service worker, GitHub Pages deploy workflow Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XzXuVcjCFcBhTQT1wsEANC
44 lines
1.1 KiB
JavaScript
44 lines
1.1 KiB
JavaScript
/* Nutq service worker — offline-first app shell */
|
|
const CACHE = "nutq-v1";
|
|
const SHELL = [
|
|
"./",
|
|
"./index.html",
|
|
"./app.css",
|
|
"./app.js",
|
|
"./manifest.webmanifest",
|
|
"./icons/icon-192.png",
|
|
"./icons/icon-512.png",
|
|
"./icons/apple-touch-icon.png",
|
|
];
|
|
|
|
self.addEventListener("install", (e) => {
|
|
e.waitUntil(caches.open(CACHE).then((c) => c.addAll(SHELL)));
|
|
self.skipWaiting();
|
|
});
|
|
|
|
self.addEventListener("activate", (e) => {
|
|
e.waitUntil(
|
|
caches.keys().then((keys) =>
|
|
Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k)))
|
|
)
|
|
);
|
|
self.clients.claim();
|
|
});
|
|
|
|
self.addEventListener("fetch", (e) => {
|
|
const url = new URL(e.request.url);
|
|
// Never intercept API calls — only cache same-origin static assets.
|
|
if (url.origin !== location.origin || e.request.method !== "GET") return;
|
|
e.respondWith(
|
|
caches.match(e.request).then(
|
|
(hit) =>
|
|
hit ||
|
|
fetch(e.request).then((res) => {
|
|
const copy = res.clone();
|
|
caches.open(CACHE).then((c) => c.put(e.request, copy));
|
|
return res;
|
|
})
|
|
)
|
|
);
|
|
});
|