diff --git a/app/recordings/recording_edit.php b/app/recordings/recording_edit.php index 3216b5d982..ab76116937 100644 --- a/app/recordings/recording_edit.php +++ b/app/recordings/recording_edit.php @@ -42,13 +42,21 @@ $language = new text; $text = $language->get(); +//set defaults + $recording_name = ''; + $recording_message = ''; + $recording_description = ''; + $recording_uuid = ''; + //add the settings object - $settings = new settings(["domain_uuid" => $SESSION['domain_uuid']]); - $speech_enabled = $settings->get('ai', 'speech_enabled'); + $settings = new settings(["domain_uuid" => $_SESSION['domain_uuid'], "user_uuid" => $_SESSION['user_uuid']]); + $speech_enabled = $settings->get('ai', 'speech_enabled', 'false'); + $speech_engine = $settings->get('ai', 'speech_engine', ''); $transcribe_enabled = $settings->get('ai', 'transcribe_enabled'); + $transcribe_engine = $settings->get('ai', 'transcribe_engine'); //add the audio object and get the voices and languages arrays - if ($speech_enabled == 'true' || $transcribe_enabled == 'true') { + if (($speech_enabled == 'true' && !empty($speech_engine)) || ($transcribe_enabled == 'true' && !empty($transcribe_engine))) { $ai = new ai($settings); $voices = $ai->get_voices(); $translate_enabled = false; diff --git a/app/recordings/recordings.php b/app/recordings/recordings.php index 954a004334..daf22c6c2a 100644 --- a/app/recordings/recordings.php +++ b/app/recordings/recordings.php @@ -380,6 +380,9 @@ } } +//set the default value for speech + $speech_enabled = !empty($_SESSION['ai']['speech_enabled']['boolean']) && !empty($_SESSION['ai']['speech_engine']['text']); + //create token $object = new token; $token = $object->create($_SERVER['PHP_SELF']); diff --git a/core/ai/resources/interfaces/ai_speech.php b/core/ai/resources/interfaces/ai_speech.php index d3c65257cb..cda17125ad 100644 --- a/core/ai/resources/interfaces/ai_speech.php +++ b/core/ai/resources/interfaces/ai_speech.php @@ -8,6 +8,10 @@ if (!interface_exists('ai_speech')) { public function set_format(string $audio_format); public function set_voice(string $audio_voice); public function set_message(string $audio_message); + public function get_voices() : array; + public function get_language_enabled() : bool; + public function set_language(string $audio_language); + public function get_languages() : array; public function speech() : bool; } } diff --git a/core/ai/resources/interfaces/ai_transcribe.php b/core/ai/resources/interfaces/ai_transcribe.php index ef16c4c99e..717ba0a0d4 100644 --- a/core/ai/resources/interfaces/ai_transcribe.php +++ b/core/ai/resources/interfaces/ai_transcribe.php @@ -6,6 +6,8 @@ if (!interface_exists('ai_transcribe')) { public function set_path(string $audio_path); public function set_filename(string $audio_filename); public function transcribe() : string; + public function set_language(string $audio_language); + public function get_languages() : array; } }