From ab83b219795806487f480329ed7973b6dbd024c0 Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Fri, 27 Jun 2025 21:05:18 +0700 Subject: [PATCH] support inworld tts (#1262) * support inworld tts * wip * wip --- lib/session/call-session.js | 7 +++++++ lib/tasks/say.js | 6 ++++++ lib/tasks/tts-task.js | 3 +++ lib/utils/db-utils.js | 6 ++++++ package-lock.json | 9 +++++---- package.json | 2 +- 6 files changed, 28 insertions(+), 5 deletions(-) diff --git a/lib/session/call-session.js b/lib/session/call-session.js index fccc9b7d..edbf09de 100644 --- a/lib/session/call-session.js +++ b/lib/session/call-session.js @@ -1109,6 +1109,13 @@ class CallSession extends Emitter { options: credential.options }; } + else if ('inworld' === vendor) { + return { + api_key: credential.api_key, + model_id: credential.model_id, + options: credential.options + }; + } else if ('assemblyai' === vendor) { return { speech_credential_sid: credential.speech_credential_sid, diff --git a/lib/tasks/say.js b/lib/tasks/say.js index 587c98a9..b05043c8 100644 --- a/lib/tasks/say.js +++ b/lib/tasks/say.js @@ -397,6 +397,7 @@ class TaskSay extends TtsTask { .replace('playht_', 'playht.') .replace('cartesia_', 'cartesia.') .replace('rimelabs_', 'rimelabs.') + .replace('inworld_', 'inworld.') .replace('verbio_', 'verbio.') .replace('elevenlabs_', 'elevenlabs.'); if (spanMapping[newKey]) newKey = spanMapping[newKey]; @@ -461,6 +462,11 @@ const spanMapping = { 'rimelabs.name_lookup_time_ms': 'name_lookup_ms', 'rimelabs.connect_time_ms': 'connect_ms', 'rimelabs.final_response_time_ms': 'final_response_ms', + // inworld + 'inworld.name_lookup_time_ms': 'name_lookup_ms', + 'inworld.connect_time_ms': 'connect_ms', + 'inworld.final_response_time_ms': 'final_response_ms', + 'inworld.x_envoy_upstream_service_time': 'upstream_service_time', // verbio 'verbio.name_lookup_time_ms': 'name_lookup_ms', 'verbio.connect_time_ms': 'connect_ms', diff --git a/lib/tasks/tts-task.js b/lib/tasks/tts-task.js index f6d081fa..97d5ab3b 100644 --- a/lib/tasks/tts-task.js +++ b/lib/tasks/tts-task.js @@ -185,6 +185,9 @@ class TtsTask extends Task { } else if (vendor === 'rimelabs') { credentials = credentials || {}; credentials.model_id = this.options.model_id || credentials.model_id; + } else if (vendor === 'inworld') { + credentials = credentials || {}; + credentials.model_id = this.options.model_id || credentials.model_id; } else if (vendor === 'whisper') { credentials = credentials || {}; credentials.model_id = this.options.model_id || credentials.model_id; diff --git a/lib/utils/db-utils.js b/lib/utils/db-utils.js index 73bc504b..a5b7889f 100644 --- a/lib/utils/db-utils.js +++ b/lib/utils/db-utils.js @@ -120,6 +120,12 @@ const speechMapper = (cred) => { obj.model_id = o.model_id; obj.options = o.options; } + else if ('inworld' === obj.vendor) { + const o = JSON.parse(decrypt(credential)); + obj.api_key = o.api_key; + obj.model_id = o.model_id; + obj.options = o.options; + } else if ('assemblyai' === obj.vendor) { const o = JSON.parse(decrypt(credential)); obj.api_key = o.api_key; diff --git a/package-lock.json b/package-lock.json index 868f2d8b..48345657 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@jambonz/http-health-check": "^0.0.1", "@jambonz/mw-registrar": "^0.2.7", "@jambonz/realtimedb-helpers": "^0.8.13", - "@jambonz/speech-utils": "^0.2.12", + "@jambonz/speech-utils": "^0.2.13", "@jambonz/stats-collector": "^0.1.10", "@jambonz/time-series": "^0.2.13", "@jambonz/verb-specifications": "^0.0.105", @@ -1466,9 +1466,10 @@ } }, "node_modules/@jambonz/speech-utils": { - "version": "0.2.12", - "resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.2.12.tgz", - "integrity": "sha512-1xik/ZRUtPE2SOztxweGI+RTXUbiUXRShJ8G/l7VJJBkSWbfKKerYIRfHicAPumHicaUrbqSzZ6hr0eghv80KA==", + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/@jambonz/speech-utils/-/speech-utils-0.2.13.tgz", + "integrity": "sha512-8ISTWTfz3fWtPmzPDsZG8zgnf6pTjLA1WasMAF/d/ktGswqVsbhoPcDh5ZyZ7BsEqOMLMIv2Hn0ESmrBuMn5kw==", + "license": "MIT", "dependencies": { "23": "^0.0.0", "@aws-sdk/client-polly": "^3.496.0", diff --git a/package.json b/package.json index 343559b5..2b535e5b 100644 --- a/package.json +++ b/package.json @@ -31,7 +31,7 @@ "@jambonz/http-health-check": "^0.0.1", "@jambonz/mw-registrar": "^0.2.7", "@jambonz/realtimedb-helpers": "^0.8.13", - "@jambonz/speech-utils": "^0.2.12", + "@jambonz/speech-utils": "^0.2.13", "@jambonz/stats-collector": "^0.1.10", "@jambonz/time-series": "^0.2.13", "@jambonz/verb-specifications": "^0.0.105",