Provides a React hook and utilities for capturing, streaming, and transcribing speech input, handling live transcripts and errors.
// Source: https://github.com/iOfficeAI/AionUi | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
// Provided via justclaw.it.com; keep this notice with the code.
/**
* @license
* Copyright 2025 AionUi (aionui.com)
* SPDX-License-Identifier: Apache-2.0
*/
import { useCallback, useEffect, useMemo, useRef, useState } from 'react';
import type { SpeechToTextConfig } from '@/common/types/provider/speech';
import { useLatestRef } from '@/renderer/hooks/ui/useLatestRef';
import { transcribeAudioBlob } from '@/renderer/services/SpeechToTextService';
import { getClientBusinessSetting } from '@/renderer/services/clientBusinessSettings';
import {
AudioWorkletUnavailableError,
createPcmRecorder,
encodeWavPcm16,
STREAM_SAMPLE_RATE,
type PcmReco
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key