Wake Word Model Setup (setup/wake-word-model.ts)

airi · packages/testing-audio/src/setup/wake-word-model.ts · typescript · MIT
ai, testing, voice, tag:wake-word, tag:model, tag:checksum

Prepares and verifies the pinned wake-word model pack for audio tests, including checksum validation and cached file setup. Reuse for deterministic voice-assistant test fixtures.

// Source: https://github.com/moeru-ai/airi | License: MIT | Copyright 2024-PRESENT Neko Ayaka
// Provided via justclaw.it.com; keep this notice with the code.
import { createHash, randomUUID } from 'node:crypto'
import { mkdir, readFile, rename, rm, writeFile } from 'node:fs/promises'
import { join } from 'node:path'

import { findWorkspaceDir } from '@pnpm/find-workspace-dir'
import { sherpawModelArtifactUrl, sherpawModelPath } from '@proj-airi/provider-inference/sherpaw-transcription/models'
import { kwsModel } from '@proj-airi/stage-ui/libs/voice/kws-model-info'

/**
 * Checksums of the pinned `kwsModel` revision.
 * A revision change in `kws-model-info.ts` makes the check fail, so the runner never serves an unverified pack.
 */
const files = [
  { name: 'preload.data', sha256: '4ca3ae

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key