createVoiceEndJudgePlugin (voice/voice-end-judge-plugin.ts)

airi · packages/stage-ui/src/libs/voice/voice-end-judge-plugin.ts · typescript · MIT
voice

Voice plugin that ends paused speech early when the transcript is judged complete.

// 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 type { EndJudgement } from '@proj-airi/agents/voice-end-judge'
import type { ConversationContext, VoicePlugin } from '@proj-airi/core-agent'

import {
  createEndJudgementRule,
  createPauseRule,
  endJudgedSignal,
  inputActivitySignal,
  inputFinalizingEvent,
  inputSettledEvent,
  pausedSignal,
} from '@proj-airi/core-agent'

export interface VoiceEndJudgeOptions {
  /** Read at each pause. When it is false, the input ends only by the voice activity silence limit. */
  enabled: () => boolean
  /**
   * Reads the transcript of a paused input. A rejection counts as `incomplete`, so the silence limit ends the input.
   * `sig

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

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

Get a free API key