From eb5a1d34cb7054371ed8a95a393785821a81b92b Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Sun, 5 Mar 2023 11:27:09 -0500 Subject: [PATCH] Plugin: Text2Speech: Don't integrate directly with AIHelper plugin - refs #4622 --- plugin/ai_helper/tool/learnpath.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/plugin/ai_helper/tool/learnpath.php b/plugin/ai_helper/tool/learnpath.php index 8efb1aaf881..db15032e7d6 100644 --- a/plugin/ai_helper/tool/learnpath.php +++ b/plugin/ai_helper/tool/learnpath.php @@ -9,13 +9,9 @@ require_once __DIR__.'/../../../main/inc/global.inc.php'; require_once __DIR__.'/../AiHelperPlugin.php'; -require_once __DIR__.'/../../text2speech/Text2SpeechPlugin.php'; require_once api_get_path(SYS_CODE_PATH).'exercise/export/aiken/aiken_classes.php'; require_once api_get_path(SYS_CODE_PATH).'exercise/export/aiken/aiken_import.inc.php'; -$text2speechPlugin = Text2SpeechPlugin::create(); -$isTextToSpeechEnabled = $text2speechPlugin->get('tool_enable') && $text2speechPlugin->get('tool_lp_enable'); - $plugin = AiHelperPlugin::create(); $apiList = $plugin->getApiList(); @@ -70,19 +66,11 @@ $promptItem = sprintf($messageGetItemContent, $topic, $courseLanguage, $wordsCount, $title); $resultContentText = $plugin->openAiGetCompletionText($promptItem, 'learnpath'); $lpItemContent = (!empty($resultContentText) ? trim($resultContentText) : ''); - $audioControl = ''; - if ($isTextToSpeechEnabled && !empty($lpItemContent)) { - $filePath = $text2speechPlugin->convert(strip_tags($lpItemContent)); - $audioControl = ''; - } if (false !== stripos($lpItemContent, '')) { - $lpItemContent = preg_replace("||i", "\r\n$style\r\n\\0", $audioControl.$lpItemContent); + $lpItemContent = preg_replace("||i", "\r\n$style\r\n\\0", $lpItemContent); } else { - $lpItemContent = ''.trim($title).''.$style.''.$audioControl.$lpItemContent.''; + $lpItemContent = ''.trim($title).''.$style.''.$lpItemContent.''; } $lpItems[$position]['content'] = $lpItemContent; $position++;