@voice-ai-workforce/react
Version:
React components with 3-tier interface modes for voice-controlled workforce applications
70 lines (69 loc) • 2.58 kB
TypeScript
import { VoiceAIConfig, VoiceResponse, VoiceAIState, VoiceAIEvents, AIProvider, CommandDefinition, CommandRegistry, BusinessContext } from '../../types/src/types';
export declare class VoiceAI {
private config;
private state;
private speechRecognition;
private speechSynthesis;
private eventListeners;
private commandRegistry;
private businessContext;
constructor(config: VoiceAIConfig, events?: Partial<VoiceAIEvents>);
private initializeBusinessContext;
private validateConfig;
private validateAIProviderConfig;
private mergeWithDefaults;
private initializeCommandRegistry;
private initialize;
private initializeAIProviders;
private testAIProvider;
private initializeSpeechRecognition;
private initializeSpeechSynthesis;
/**
* Replace business variables in text with actual business context
*/
private replaceBusinessVariables;
/**
* Classify command complexity and determine if voice package can handle it
*/
private classifyCommand;
/**
* Determine if voice package can handle a command
*/
private canHandleCommand;
/**
* Enhanced entity extraction with business context
*/
private extractEntities;
startListening(): Promise<void>;
stopListening(): Promise<void>;
processTextInput(text: string): Promise<VoiceResponse>;
speak(text: string): Promise<void>;
speakText(text: string): Promise<void>;
canHandle(text: string): Promise<boolean>;
private handleSpeechResult;
private parseCommand;
private parseCommandWithProvider;
private parseCommandWithOpenAI;
private parseCommandWithAnthropic;
private parseCommandWithGoogle;
private parseCommandWithKeywords;
private generateResponse;
private getSuggestedCommands;
private replaceTemplateVariables;
private executeActions;
private makeApiCall;
private speakWithWebSpeech;
private updateState;
private handleError;
getState(): VoiceAIState;
updateConfig(newConfig: Partial<VoiceAIConfig>): void;
updateContext(context: Record<string, any>): void;
updateBusinessContext(context: Partial<BusinessContext>): void;
getCommandRegistry(): CommandRegistry;
getBusinessContext(): BusinessContext;
switchAIProvider(provider: AIProvider): Promise<void>;
openCommandCenter(): void;
closeCommandCenter(): void;
getAvailableCommands(category?: string): CommandDefinition[];
executeCommand(commandId: string, entities?: Record<string, any>): Promise<VoiceResponse>;
}