|
9 | 9 |
|
10 | 10 | require_once __DIR__.'/../../../main/inc/global.inc.php';
|
11 | 11 | require_once __DIR__.'/../AiHelperPlugin.php';
|
12 |
| -require_once __DIR__.'/../../text2speech/Text2SpeechPlugin.php'; |
13 | 12 | require_once api_get_path(SYS_CODE_PATH).'exercise/export/aiken/aiken_classes.php';
|
14 | 13 | require_once api_get_path(SYS_CODE_PATH).'exercise/export/aiken/aiken_import.inc.php';
|
15 | 14 |
|
16 |
| -$text2speechPlugin = Text2SpeechPlugin::create(); |
17 |
| -$isTextToSpeechEnabled = $text2speechPlugin->get('tool_enable') && $text2speechPlugin->get('tool_lp_enable'); |
18 |
| - |
19 | 15 | $plugin = AiHelperPlugin::create();
|
20 | 16 |
|
21 | 17 | $apiList = $plugin->getApiList();
|
|
70 | 66 | $promptItem = sprintf($messageGetItemContent, $topic, $courseLanguage, $wordsCount, $title);
|
71 | 67 | $resultContentText = $plugin->openAiGetCompletionText($promptItem, 'learnpath');
|
72 | 68 | $lpItemContent = (!empty($resultContentText) ? trim($resultContentText) : '');
|
73 |
| - $audioControl = ''; |
74 |
| - if ($isTextToSpeechEnabled && !empty($lpItemContent)) { |
75 |
| - $filePath = $text2speechPlugin->convert(strip_tags($lpItemContent)); |
76 |
| - $audioControl = '<audio controls>'. |
77 |
| - '<source src="'.$filePath.'" type="audio/ogg">'. |
78 |
| - 'Your browser does not support the audio element.'. |
79 |
| - '</audio>'; |
80 |
| - } |
81 | 69 |
|
82 | 70 | if (false !== stripos($lpItemContent, '</head>')) {
|
83 |
| - $lpItemContent = preg_replace("|</head>|i", "\r\n$style\r\n\\0", $audioControl.$lpItemContent); |
| 71 | + $lpItemContent = preg_replace("|</head>|i", "\r\n$style\r\n\\0", $lpItemContent); |
84 | 72 | } else {
|
85 |
| - $lpItemContent = '<html><head><title>'.trim($title).'</title>'.$style.'</head><body>'.$audioControl.$lpItemContent.'</body></html>'; |
| 73 | + $lpItemContent = '<html><head><title>'.trim($title).'</title>'.$style.'</head><body>'.$lpItemContent.'</body></html>'; |
86 | 74 | }
|
87 | 75 | $lpItems[$position]['content'] = $lpItemContent;
|
88 | 76 | $position++;
|
|
0 commit comments