mirror of
https://github.com/jambonz/freeswitch-modules.git
synced 2025-12-19 08:47:44 +00:00
support elevenlabs previous_text, next_text (#75)
This commit is contained in:
@@ -809,6 +809,12 @@ extern "C" {
|
||||
cJSON * jResult = cJSON_CreateObject();
|
||||
cJSON_AddStringToObject(jResult, "model_id", el->model_id);
|
||||
cJSON_AddStringToObject(jResult, "text", text);
|
||||
if (el->previous_text) {
|
||||
cJSON_AddStringToObject(jResult, "previous_text", el->previous_text);
|
||||
}
|
||||
if (el->next_text) {
|
||||
cJSON_AddStringToObject(jResult, "next_text", el->next_text);
|
||||
}
|
||||
if (el->similarity_boost || el->style || el->use_speaker_boost || el->stability) {
|
||||
cJSON * jVoiceSettings = cJSON_CreateObject();
|
||||
cJSON_AddItemToObject(jResult, "voice_settings", jVoiceSettings);
|
||||
|
||||
@@ -19,6 +19,8 @@ static void clearElevenlabs(elevenlabs_t* el, int freeAll) {
|
||||
if (el->style) free(el->style);
|
||||
if (el->use_speaker_boost) free(el->use_speaker_boost);
|
||||
if (el->optimize_streaming_latency) free(el->optimize_streaming_latency);
|
||||
if (el->previous_text) free(el->previous_text);
|
||||
if (el->next_text) free(el->next_text);
|
||||
if (el->ct) free(el->ct);
|
||||
if (el->reported_latency) free(el->reported_latency);
|
||||
if (el->request_id) free(el->request_id);
|
||||
@@ -36,6 +38,8 @@ static void clearElevenlabs(elevenlabs_t* el, int freeAll) {
|
||||
el->style = NULL;
|
||||
el->use_speaker_boost = NULL;
|
||||
el->optimize_streaming_latency = NULL;
|
||||
el->previous_text = NULL;
|
||||
el->next_text = NULL;
|
||||
el->ct = NULL;
|
||||
el->reported_latency = NULL;
|
||||
el->request_id = NULL;
|
||||
@@ -174,6 +178,14 @@ static void ell_text_param_tts(switch_speech_handle_t *sh, char *param, const ch
|
||||
if (el->optimize_streaming_latency) free(el->optimize_streaming_latency);
|
||||
el->optimize_streaming_latency = strdup(val);
|
||||
}
|
||||
else if (0 == strcmp(param, "next_text")) {
|
||||
if (el->next_text) free(el->next_text);
|
||||
el->next_text = strdup(val);
|
||||
}
|
||||
else if (0 == strcmp(param, "previous_text")) {
|
||||
if (el->previous_text) free(el->previous_text);
|
||||
el->previous_text = strdup(val);
|
||||
}
|
||||
else if (0 == strcmp(param, "write_cache_file") && switch_true(val)) {
|
||||
el->cache_audio = 1;
|
||||
}
|
||||
|
||||
@@ -17,6 +17,8 @@ struct elevenlabs_data {
|
||||
char* style;
|
||||
char* use_speaker_boost;
|
||||
char* optimize_streaming_latency;
|
||||
char* previous_text;
|
||||
char* next_text;
|
||||
|
||||
/* result data */
|
||||
long response_code;
|
||||
|
||||
Reference in New Issue
Block a user