29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
31require_once
'../lib/ai.lib.php';
33$langs->loadLangs(array(
"admin"));
36$action =
GETPOST(
'action',
'aZ09');
37$backtopage =
GETPOST(
'backtopage',
'alpha');
38$modulepart =
GETPOST(
'modulepart',
'aZ09');
44$value =
GETPOST(
'value',
'alpha');
45$label =
GETPOST(
'label',
'alpha');
46$scandir =
GETPOST(
'scan_dir',
'alpha');
56if (!class_exists(
'FormSetup')) {
57 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsetup.class.php';
64 'chatgpt' =>
'ChatGPT',
70$item = $formSetup->newItem(
'AI_API_SERVICE');
71$item->setAsSelect($arrayofia);
72$item->cssClass =
'minwidth150';
74foreach ($arrayofia as $ia => $ialabel) {
80 $item = $formSetup->newItem(
'AI_API_'.strtoupper($ia).
'_KEY')->setAsSecureKey();
81 $item->nameText = $langs->trans(
"AI_API_KEY").
' ('.$ialabel.
')';
82 $item->defaultFieldValue =
'';
83 $item->fieldParams[
'hideGenerateButton'] = 1;
84 $item->fieldParams[
'trClass'] = $ia;
85 $item->cssClass =
'minwidth500 text-security';
87 $item = $formSetup->newItem(
'AI_API_'.strtoupper($ia).
'_URL');
88 $item->nameText = $langs->trans(
"AI_API_URL").
' ('.$ialabel.
')';
89 $item->defaultFieldValue =
'';
90 $item->fieldParams[
'trClass'] = $ia;
91 $item->cssClass =
'minwidth500';
94$setupnotempty = + count($formSetup->items);
97$dirmodels = array_merge(array(
'/'), (array) $conf->modules_parts[
'models']);
103if (!isModEnabled(
'ai')) {
112include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
121$form =
new Form($db);
126llxHeader(
'', $langs->trans($title), $help_url,
'', 0, 0,
'',
'',
'',
'mod-ai page-admin');
129$linkback =
'<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1').
'">'.$langs->trans(
"BackToModuleList").
'</a>';
135print
dol_get_fiche_head($head,
'settings', $langs->trans($title), -1,
"fa-microchip");
138if ($action ==
'edit') {
139 print $formSetup->generateOutput(
true);
141} elseif (!empty($formSetup->items)) {
142 print $formSetup->generateOutput();
143 print
'<div class="tabsAction">';
144 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>';
147 print
'<br>'.$langs->trans(
"NothingToSetup");
151if (empty($setupnotempty)) {
152 print
'<br>'.$langs->trans(
"NothingToSetup");
aiAdminPrepareHead()
Prepare admin pages header.
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.