AI bug fixes and update interfaces (#6925)
* allow settings to load domain and user settings * ensure engine is also enabled before attempting to create a new object * add default values to stop undefined variable warnings * enforce all models to set and return voices and languages * enforce all models to set and return languages * ensure speech_enabled is set by the current session
This commit is contained in:
parent
93a180878e
commit
2064c33fb7
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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']);
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue