mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
Add realtime dictation providers (#1329)
* feat: add realtime dictation providers * fix: cancel realtime dictation startup * fix: refresh local dictation availability * fix: preserve dictation on disconnect * fix: normalize OpenAI language hints
This commit is contained in:
@@ -11,11 +11,13 @@ describe('listConfiguredTranscriptionProviders', () => {
|
||||
expect(listConfiguredTranscriptionProviders({
|
||||
OPENAI_API_KEY: 'openai',
|
||||
ELEVENLABS_API_KEY: 'elevenlabs',
|
||||
DEEPGRAM_API_KEY: 'deepgram',
|
||||
TRANSCRIPTION_BASE_URL: 'http://localhost:8000/v1',
|
||||
TRANSCRIPTION_MODEL: 'whisper-large-v3'
|
||||
})).toEqual([
|
||||
{ id: 'openai', label: 'OpenAI', modes: ['standard'] },
|
||||
{ id: 'elevenlabs', label: 'ElevenLabs', modes: ['standard'] },
|
||||
{ id: 'openai', label: 'OpenAI', modes: ['standard', 'realtime'] },
|
||||
{ id: 'elevenlabs', label: 'ElevenLabs', modes: ['standard', 'realtime'] },
|
||||
{ id: 'deepgram', label: 'Deepgram', modes: ['standard', 'realtime'] },
|
||||
{ id: 'openai-compatible', label: 'OpenAI-compatible / local', modes: ['standard'] }
|
||||
])
|
||||
})
|
||||
|
||||
+15
-5
@@ -237,7 +237,14 @@ export type VoiceBackendType = 'elevenlabs' | 'gemini-live' | 'qwen-realtime'
|
||||
|
||||
export type VoiceMode = 'assistant' | 'dictation'
|
||||
export type TranscriptionMode = 'standard' | 'realtime'
|
||||
export type TranscriptionProvider = 'openai' | 'elevenlabs' | 'deepgram' | 'groq' | 'openai-compatible'
|
||||
export type TranscriptionProvider = 'openai' | 'elevenlabs' | 'deepgram' | 'groq' | 'openai-compatible' | 'browser-local'
|
||||
|
||||
export const OPENAI_TRANSCRIPTION_MODEL = 'gpt-transcribe'
|
||||
export const OPENAI_REALTIME_TRANSCRIPTION_MODEL = 'gpt-live-transcribe'
|
||||
export const ELEVENLABS_TRANSCRIPTION_MODEL = 'scribe_v2'
|
||||
export const ELEVENLABS_REALTIME_TRANSCRIPTION_MODEL = 'scribe_v2_realtime'
|
||||
export const DEEPGRAM_TRANSCRIPTION_MODEL = 'nova-3'
|
||||
export const GROQ_TRANSCRIPTION_MODEL = 'whisper-large-v3'
|
||||
|
||||
export interface TranscriptionProviderInfo {
|
||||
id: TranscriptionProvider
|
||||
@@ -246,13 +253,16 @@ export interface TranscriptionProviderInfo {
|
||||
}
|
||||
|
||||
const TRANSCRIPTION_PROVIDERS: Record<TranscriptionProvider, TranscriptionProviderInfo> = {
|
||||
openai: { id: 'openai', label: 'OpenAI', modes: ['standard'] },
|
||||
elevenlabs: { id: 'elevenlabs', label: 'ElevenLabs', modes: ['standard'] },
|
||||
deepgram: { id: 'deepgram', label: 'Deepgram', modes: ['standard'] },
|
||||
openai: { id: 'openai', label: 'OpenAI', modes: ['standard', 'realtime'] },
|
||||
elevenlabs: { id: 'elevenlabs', label: 'ElevenLabs', modes: ['standard', 'realtime'] },
|
||||
deepgram: { id: 'deepgram', label: 'Deepgram', modes: ['standard', 'realtime'] },
|
||||
groq: { id: 'groq', label: 'Groq', modes: ['standard'] },
|
||||
'openai-compatible': { id: 'openai-compatible', label: 'OpenAI-compatible / local', modes: ['standard'] }
|
||||
'openai-compatible': { id: 'openai-compatible', label: 'OpenAI-compatible / local', modes: ['standard'] },
|
||||
'browser-local': { id: 'browser-local', label: 'Browser on-device', modes: ['realtime'] }
|
||||
}
|
||||
|
||||
export const BROWSER_LOCAL_TRANSCRIPTION_PROVIDER = TRANSCRIPTION_PROVIDERS['browser-local']
|
||||
|
||||
/** Transcription providers whose startup environment is complete. */
|
||||
export function listConfiguredTranscriptionProviders(env: VoiceBackendEnv): TranscriptionProviderInfo[] {
|
||||
const providers: TranscriptionProvider[] = []
|
||||
|
||||
Reference in New Issue
Block a user