UNPKG

metro-agent

Version:

Metro Agent

105 lines (104 loc) 3.19 kB
interface ProcessOptions { buffers: any; powerLevel: number; bufferDuration: number; bufferSampleRate: number; newBufferIdx: number; asyncEnd: any; } interface MetroAgentOptions { client: any; ttsClient?: any; ttsDelay?: number; wakeStatus?: boolean; asrWsUrl: string; asrConfig?: any; sampleRate?: number; clearBufferIdx?: number; wakeupWord?: string[]; dormancyWord?: string[]; welcomeWord?: string; goodbyeWord?: string; apiKey?: string; baseURL?: string; model?: string; stream?: boolean; chatLoading?: boolean; maxRetries?: number; timeout?: number; wakeTimeout?: number; wakeTimeoutTimer?: any; fetch?: any; recClient?: any; Recorder?: any; currentChatResponse?: any; currentChatController?: any; onWake?: (welcomeWord: string) => void; onDormancy?: (welcomeWord: string) => void; onMessage?: (data: any, wakeStatus: boolean, ttsStatus: boolean) => void; onChange?: (source?: string) => void; onStart?: () => void; onSend?: (client?: any, sample?: any) => void | null | undefined; onStream?: (message: string) => void; onCompleted?: (message?: any) => void; onError?: (error: any) => void; onRecProcess?: ({ buffers, powerLevel, bufferDuration, bufferSampleRate, newBufferIdx, asyncEnd }: ProcessOptions) => void; onAudioWaveform?: (powerLevel: number) => void; } export declare class MetroAgent { client: any; ttsQueue?: any; asrWsUrl: string; asrConfig: any; sampleRate: number; clearBufferIdx: number; private wakeupWord; dormancyWord: string[]; welcomeWord: string; goodbyeWord: string; apiKey: string; baseURL: string; model: string; stream: boolean; chatLoading: boolean; maxRetries: number; timeout: number; wakeTimeout: number; wakeTimeoutTimer: any; fetch: any; recClient: any; Recorder: any; currentChatResponse: any; currentChatController: any; private wakeStatus; onSend: any; onWake: (welcomeWord: string) => void; onDormancy: (goodbyeWord: string) => void; onMessage: (data: any, wakeStatus: boolean, ttsStatus: boolean) => void; onChange: (source?: string) => void; onStart: () => void; onStream: (message: any) => void; onCompleted: (message?: any) => void; onError: (error?: any) => void; onRecProcess: ({ buffers, powerLevel, bufferDuration, bufferSampleRate, newBufferIdx, asyncEnd }: ProcessOptions) => void; onAudioWaveform?: (powerLevel: number) => void; constructor(options: MetroAgentOptions); start(): void; private formatContent; private ArrayBufferToBase64; private defaultRecProcess; recClientSend(sample: string | ArrayBuffer): void; private chat; sendChatMessage(messages: any[], data?: {}): Promise<void>; tts(text: string): Promise<void>; ttsClear(): void; get ttsSpeaking(): boolean; setWakeStatus(status: boolean): void; setWakeupWord(word: string[]): void; close(): void; stop(): void; destroy(): void; private wakeTimeoutFn; private changeWakeSilence; } export {};