mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 08:40:38 +00:00
support elevenlabs stt
This commit is contained in:
@@ -1139,6 +1139,7 @@ class CallSession extends Emitter {
|
|||||||
return {
|
return {
|
||||||
api_key: credential.api_key,
|
api_key: credential.api_key,
|
||||||
model_id: credential.model_id,
|
model_id: credential.model_id,
|
||||||
|
stt_model_id: credential.stt_model_id,
|
||||||
api_uri: credential.api_uri,
|
api_uri: credential.api_uri,
|
||||||
options: credential.options
|
options: credential.options
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -106,6 +106,7 @@ const speechMapper = (cred) => {
|
|||||||
const o = JSON.parse(decrypt(credential));
|
const o = JSON.parse(decrypt(credential));
|
||||||
obj.api_key = o.api_key;
|
obj.api_key = o.api_key;
|
||||||
obj.model_id = o.model_id;
|
obj.model_id = o.model_id;
|
||||||
|
obj.stt_model_id = o.stt_model_id;
|
||||||
obj.api_uri = o.api_uri;
|
obj.api_uri = o.api_uri;
|
||||||
obj.options = o.options;
|
obj.options = o.options;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -545,6 +545,21 @@ const normalizeVerbio = (evt, channel, language) => {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const normalizeElevenlabs = (evt, channel, language) => {
|
||||||
|
const copy = JSON.parse(JSON.stringify(evt));
|
||||||
|
console.log(copy);
|
||||||
|
return {
|
||||||
|
language_code: language,
|
||||||
|
channel_tag: channel,
|
||||||
|
is_final: evt.is_final,
|
||||||
|
alternatives: evt.alternatives,
|
||||||
|
vendor: {
|
||||||
|
name: 'elevenlabs',
|
||||||
|
evt: copy
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
const normalizeMicrosoft = (evt, channel, language, punctuation = true) => {
|
const normalizeMicrosoft = (evt, channel, language, punctuation = true) => {
|
||||||
const copy = JSON.parse(JSON.stringify(evt));
|
const copy = JSON.parse(JSON.stringify(evt));
|
||||||
const nbest = evt.NBest;
|
const nbest = evt.NBest;
|
||||||
@@ -770,6 +785,8 @@ module.exports = (logger) => {
|
|||||||
return normalizeGladia(evt, channel, language, shortUtterance);
|
return normalizeGladia(evt, channel, language, shortUtterance);
|
||||||
case 'deepgramflux':
|
case 'deepgramflux':
|
||||||
return normalizeDeepgramFlux(evt, channel, language, shortUtterance);
|
return normalizeDeepgramFlux(evt, channel, language, shortUtterance);
|
||||||
|
case 'elevenlabs':
|
||||||
|
return normalizeElevenlabs(evt, channel, language);
|
||||||
case 'microsoft':
|
case 'microsoft':
|
||||||
return normalizeMicrosoft(evt, channel, language, punctuation);
|
return normalizeMicrosoft(evt, channel, language, punctuation);
|
||||||
case 'google':
|
case 'google':
|
||||||
@@ -1085,6 +1102,24 @@ module.exports = (logger) => {
|
|||||||
...(keyterms && keyterms.length > 0 && {DEEPGRAMFLUX_SPEECH_KEYTERMS: keyterms.join(',')}),
|
...(keyterms && keyterms.length > 0 && {DEEPGRAMFLUX_SPEECH_KEYTERMS: keyterms.join(',')}),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
else if ('elevenlabs' === vendor) {
|
||||||
|
const {api_key, stt_model_id} = sttCredentials;
|
||||||
|
const {includeTimestamps, commitStrategy, vadSilenceThresholdSecs, vadThreshold,
|
||||||
|
minSpeechDurationMs, minSilenceDurationMs, enableLogging} = rOpts.elevenlabsOptions || {};
|
||||||
|
|
||||||
|
opts = {
|
||||||
|
...opts,
|
||||||
|
ELEVENLABS_API_KEY: api_key,
|
||||||
|
ELEVENLABS_MODEL_ID: stt_model_id,
|
||||||
|
ELEVENLABS_INCLUDE_TIMESTAMPS: includeTimestamps === true ? true : false,
|
||||||
|
...(commitStrategy && {ELEVENLABS_COMMIT_STRATEGY: commitStrategy}),
|
||||||
|
...(vadSilenceThresholdSecs && {ELEVENLABS_VAD_SILENCE_THRESHOLD_SECS: vadSilenceThresholdSecs}),
|
||||||
|
...(vadThreshold && {ELEVENLABS_VAD_THRESHOLD: vadThreshold}),
|
||||||
|
...(minSpeechDurationMs && {ELEVENLABS_MIN_SPEECH_DURATION_MS: minSpeechDurationMs}),
|
||||||
|
...(minSilenceDurationMs && {ELEVENLABS_MIN_SILENCE_DURATION_MS: minSilenceDurationMs}),
|
||||||
|
...(enableLogging && {ELEVENLABS_ENABLE_LOGGING: enableLogging ? 1 : 0}),
|
||||||
|
};
|
||||||
|
}
|
||||||
else if ('gladia' === vendor) {
|
else if ('gladia' === vendor) {
|
||||||
const {host, path} = sttCredentials;
|
const {host, path} = sttCredentials;
|
||||||
opts = {
|
opts = {
|
||||||
|
|||||||
Reference in New Issue
Block a user