UNPKG

ttc-ai-client

Version:

TypeScript client sdk for TTC AI services with decorators and schema validation.

86 lines 2.27 kB
/** * TTC Speech Integration * Provides hybrid speech capabilities with Chrome Speech API as primary and TTC Speech Client as fallback */ export interface SpeechCapabilities { hasTTCSpeechClient: boolean; } export interface SpeechConfig { conversationId: string; serverUrl?: string; token?: string; modelId?: string; debug?: boolean; } export interface SpeechCallbacks { onTranscript?: (text: string, isFinal: boolean) => void; onSpeechStart?: () => void; onSpeechEnd?: () => void; onError?: (error: string) => void; onAudioChunk?: (audioBlob: Blob) => void; } export interface SpeechState { isListening: boolean; isSpeaking: boolean; isConnected: boolean; usingNative: boolean; } export declare class TTCSpeechIntegration { private config; private callbacks; private state; private ttcClient; private audioContext; constructor(config: SpeechConfig, callbacks?: SpeechCallbacks); /** * Detect available speech capabilities */ static getCapabilities(): SpeechCapabilities; /** * Initialize audio context for audio playback */ private initializeAudioContext; /** * Initialize speech services (TTC Speech Client only) */ initialize(): Promise<void>; /** * Initialize TTC Speech Client */ private initializeTTCSpeechClient; /** * Start speech recognition */ startListening(): Promise<void>; /** * Stop speech recognition */ stopListening(): Promise<void>; /** * Synthesize text to speech */ speak(text: string): Promise<void>; /** * Play audio blob */ private playAudioBlob; /** * Stop current speech synthesis */ stopSpeaking(): Promise<void>; /** * Get current state */ getState(): SpeechState; /** * Check if speech services are available */ isAvailable(): boolean; /** * Disconnect and cleanup */ disconnect(): void; } export declare function createSpeechIntegration(config: SpeechConfig, callbacks?: SpeechCallbacks): Promise<TTCSpeechIntegration>; export declare function getSpeechCapabilities(): SpeechCapabilities; //# sourceMappingURL=speechIntegration.d.ts.map