Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Plugin: Add new AI Helper plugin for questions generation - refs CT#4534
- Loading branch information
1 parent
ed4382a
commit 13c12a4
Showing
14 changed files
with
973 additions
and
223 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
<?php | ||
/* For license terms, see /license.txt */ | ||
|
||
/** | ||
* Description of AiHelperPlugin. | ||
* | ||
* @author Christian Beeznest <christian.fasanando@beeznest.com> | ||
*/ | ||
class AiHelperPlugin extends Plugin | ||
{ | ||
public const OPENAI_API = 'openai'; | ||
|
||
protected function __construct() | ||
{ | ||
$version = '1.0'; | ||
$author = 'Christian Beeznest'; | ||
|
||
$message = Display::return_message($this->get_lang('Description')); | ||
|
||
$settings = [ | ||
$message => 'html', | ||
'tool_enable' => 'boolean', | ||
'api_name' => [ | ||
'type' => 'select', | ||
'options' => $this->getApiList(), | ||
], | ||
'api_key' => 'text', | ||
'organization_id' => 'text', | ||
]; | ||
|
||
parent::__construct($version, $author, $settings); | ||
} | ||
|
||
/** | ||
* Get the list of apis availables. | ||
* | ||
* @return array | ||
*/ | ||
public function getApiList() | ||
{ | ||
$list = [ | ||
self::OPENAI_API => $this->get_lang('OpenAi'), | ||
]; | ||
|
||
return $list; | ||
} | ||
|
||
/** | ||
* Get the plugin directory name. | ||
*/ | ||
public function get_name(): string | ||
{ | ||
return 'ai_helper'; | ||
} | ||
|
||
/** | ||
* Get the class instance. | ||
* | ||
* @staticvar AiHelperPlugin $result | ||
*/ | ||
public static function create(): AiHelperPlugin | ||
{ | ||
static $result = null; | ||
|
||
return $result ?: $result = new self(); | ||
} | ||
|
||
/** | ||
* Install the plugin. Set the database up. | ||
*/ | ||
public function install() | ||
{ | ||
|
||
} | ||
|
||
/** | ||
* Unistall plugin. Clear the database. | ||
*/ | ||
public function uninstall() | ||
{ | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
AI Helper plugin | ||
====== | ||
|
||
Version 1.0 | ||
|
||
> This plugin is meant to be later integrated into Chamilo (in a major version | ||
release). | ||
|
||
The AI helper plugin integrates into parts of the platform that seem the most useful to teachers/trainers or learners. | ||
Because available Artificial Intelligence (to use the broad term) now allows us to ask for meaningful texts to be generated, we can use those systems to pre-generate content, then let the teacher/trainer review the content before publication. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?php | ||
/* For license terms, see /license.txt */ | ||
|
||
/** | ||
* Install the Ai Helper Plugin. | ||
* | ||
* @package chamilo.plugin.ai_helper | ||
*/ | ||
require_once __DIR__.'/../../main/inc/global.inc.php'; | ||
require_once __DIR__.'/AiHelperPlugin.php'; | ||
|
||
if (!api_is_platform_admin()) { | ||
exit('You must have admin permissions to install plugins'); | ||
} | ||
|
||
AiHelperPlugin::create()->install(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
/* For license terms, see /license.txt */ | ||
|
||
$strings['plugin_title'] = 'AI Helper plugin'; | ||
$strings['plugin_comment'] = 'Integrates into parts of the platform that seem the most useful to teachers/trainers or learners'; | ||
$strings['Description'] = 'Due available Artificial Intelligence (to use the broad term) now allows us to ask for meaningful texts to be generated, we can use those systems to pre-generate content, then let the teacher/trainer review the content before publication.'; | ||
$strings['tool_enable'] = 'Enable plugin'; | ||
$strings['api_name'] = 'Ai Api to connect'; | ||
$strings['api_key'] = 'Api key'; | ||
$strings['api_key_help'] = 'Secret key generated for your Ai api'; | ||
$strings['organization_id'] = 'Organization ID'; | ||
$strings['organization_id_help'] = 'In case your api account is from an organization.'; | ||
$strings['OpenAI'] = 'OpenAI'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
/* For license terms, see /license.txt */ | ||
|
||
$strings['plugin_title'] = 'AI Helper plugin.'; | ||
$strings['plugin_comment'] = 'S\'intègre dans les parties de la plateforme qui semblent les plus utiles aux enseignants.'; | ||
$strings['Description'] = 'L\'intelligence artificielle disponible (pour utiliser le terme large) nous permet désormais de demander la génération de textes significatifs, nous pouvons utiliser ces systèmes pour pré-générer du contenu, puis laisser l\'enseignant/formateur réviser le contenu avant publication.'; | ||
$strings['tool_enable'] = 'Activer le plug-in'; | ||
$strings['api_name'] = 'Ai Api pour se connecter'; | ||
$strings['api_key'] = 'Api key'; | ||
$strings['api_key_help'] = 'Clé secrète générée pour votre API Ai'; | ||
$strings['organization_id'] = 'Organization ID'; | ||
$strings['organization_id_help'] = 'Si votre compte api provient d\'une organisation.'; | ||
$strings['OpenAI'] = 'OpenAI'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
/* For license terms, see /license.txt */ | ||
|
||
$strings['plugin_title'] = 'AI Helper plugin.'; | ||
$strings['plugin_comment'] = 'Se integra en partes de la plataforma que parecen más útiles para profesores/formadores o alumnos.'; | ||
$strings['Description'] = 'Debido a que la Inteligencia Artificial disponible (para usar el término amplio) ahora nos permite solicitar que se generen textos significativos, podemos usar esos sistemas para generar contenido previamente y luego dejar que el maestro/entrenador revise el contenido antes de publicarlo..'; | ||
$strings['tool_enable'] = 'Habilitar complemento'; | ||
$strings['api_name'] = 'Ai API para conectar'; | ||
$strings['api_key'] = 'Api key'; | ||
$strings['api_key_help'] = 'Clave secreta generada para su Ai api'; | ||
$strings['organization_id'] = 'Identificación de la organización'; | ||
$strings['organization_id_help'] = 'En caso de que su cuenta api sea de una organización.'; | ||
$strings['OpenAI'] = 'OpenAI'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<?php | ||
/* For license terms, see /license.txt */ | ||
|
||
require_once __DIR__.'/AiHelperPlugin.php'; | ||
|
||
$plugin_info = AiHelperPlugin::create()->get_info(); |
Oops, something went wrong.