Whispering:可信的本地开源语音识别
离线语音转文字工具,数据不出本地,社区讨论热烈(591 赞)。对开发者进行语音驱动开发有直接价值。
离线语音转文字工具,数据不出本地,社区讨论热烈(591 赞)。对开发者进行语音驱动开发有直接价值。
一个可托管在浏览器中的语音转文本应用,同时也能作为 Epicenter 桌面端的一个 surface 运行。
Whispering 负责录制语音,使用你选择的 provider 进行转录,还可以按需润色转录结果,最终交付文本。同一个 Svelte SPA 服务于两个宿主:
whispering.epicenter.so 运行浏览器构建版本。
Epicenter 在 /apps/whispering 路径下运行 Tauri 构建版本。
Whispering 本身不拥有原生 shell。唯一的 Tauri runtime 由 Epicenter 持有,位于 apps/epicenter/src-tauri。
apps/whispering/src
|-- browser condition --> apps/whispering/build --> Cloudflare static assets
`-- tauri condition ----> apps/epicenter/dist/whispering
|
`--> apps/epicenter/src-tauri
native commands and windows
浏览器是一个真正的产品目标,而不是桌面端的 fallback。它负责浏览器录音、IndexedDB blob、浏览器身份验证重定向以及 Web 安全的快捷键。Epicenter 构建版本则会为系统快捷键、操作系统权限、本地模型转录、原生窗口和应用数据文件选择原生实现。
具体实现是在构建时通过 package.json 中的 #platform/* imports 进行选择的:
默认 condition 会解析到 *.browser.ts 实现。
tauri condition 会解析到 *.tauri.ts 实现。
共享代码可以将可空的 tauri capability namespace 用作 guard,但不会在运行时选择具体实现。
Epicenter 的资源构建会设置 EPICENTER_SURFACE=1,从而启用 tauri module condition 和 /apps/whispering 资源 base。除此之外,没有其他构建信号会选择 Whispering 的原生实现。
请从仓库根目录启动应用。
# Hosted browser app plus its local API
bun dev:whispering
# Browser UI only
bun dev:whispering:ui
# Epicenter desktop with Whispering mounted as a native surface
bun dev:epicenter
浏览器应用运行在 http://localhost:1420。Epicenter 也会通过 epicenter://surface/whispering 提供 Whispering。
# Browser artifact: apps/whispering/build
bun run --cwd apps/whispering build
# Epicenter assets, including apps/epicenter/dist/whispering
bun run --cwd apps/epicenter build
# Browser and Tauri type resolution
bun run --cwd apps/whispering typecheck
# App tests
bun test apps/whispering/tests
请在同一个 checkout 中依次运行这两个资源构建。SvelteKit 使用一个共享的 .svelte-kit 目录,因此同时执行浏览器构建和 Epicenter 构建时,可能会因争用生成的配置而产生竞态问题。
如需生成完整的桌面端构建产物,请运行:
bun run --cwd apps/epicenter desktop:build
Whispering 会优先在本地存储设置和录音元数据。只有当所选的转录 provider 要求上传时,音频才会离开设备。浏览器构建版本和 Epicenter 构建版本都可以使用 provider 直连、托管的 Epicenter gateway 或自行托管的 endpoint。设备端转录仅能通过 Epicenter 使用,因为它依赖原生模型 runtime。
有关托管同步和账户边界的信息,请参阅仓库中的信任模型。
wrangler.jsonc 会发布静态 SPA,并将未知路径重新路由到 index.html。
bun run --cwd apps/whispering deploy
部署前,Cloudflare 会根据同一份配置执行浏览器构建。它绝不会打包或执行 Epicenter 的原生 runtime。