29require
'../../main.inc.php';
30require_once DOL_DOCUMENT_ROOT.
"/core/lib/admin.lib.php";
31require_once
'../lib/ai.lib.php';
41$langs->loadLangs(array(
"admin"));
44$action =
GETPOST(
'action',
'aZ09');
45$backtopage =
GETPOST(
'backtopage',
'alpha');
46$modulepart =
GETPOST(
'modulepart',
'aZ09');
52$value =
GETPOST(
'value',
'alpha');
53$label =
GETPOST(
'label',
'alpha');
54$scandir =
GETPOST(
'scan_dir',
'alpha');
64if (!class_exists(
'FormSetup')) {
65 require_once DOL_DOCUMENT_ROOT.
'/core/class/html.formsetup.class.php';
72 'chatgpt' =>
'ChatGPT',
78$item = $formSetup->newItem(
'AI_API_SERVICE');
79$item->setAsSelect($arrayofia);
80$item->cssClass =
'minwidth150';
82foreach ($arrayofia as $ia => $ialabel) {
88 $item = $formSetup->newItem(
'AI_API_'.strtoupper($ia).
'_KEY')->setAsSecureKey();
89 $item->nameText = $langs->trans(
"AI_API_KEY").
' ('.$ialabel.
')';
90 $item->defaultFieldValue =
'';
91 $item->fieldParams[
'hideGenerateButton'] = 1;
92 $item->fieldParams[
'trClass'] = $ia;
93 $item->cssClass =
'minwidth500 text-security';
95 $item = $formSetup->newItem(
'AI_API_'.strtoupper($ia).
'_URL');
96 $item->nameText = $langs->trans(
"AI_API_URL").
' ('.$ialabel.
')';
97 $item->defaultFieldValue =
'';
98 $item->fieldParams[
'trClass'] = $ia;
99 $item->cssClass =
'minwidth500';
102$setupnotempty = + count($formSetup->items);
105$dirmodels = array_merge(array(
'/'), (array)
$conf->modules_parts[
'models']);
111if (!isModEnabled(
'ai')) {
120include DOL_DOCUMENT_ROOT.
'/core/actions_setmoduleoptions.inc.php';
129$form =
new Form($db);
134llxHeader(
'', $langs->trans($title), $help_url,
'', 0, 0,
'',
'',
'',
'mod-ai page-admin');
137$linkback =
'<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1').
'">'.$langs->trans(
"BackToModuleList").
'</a>';
143print
dol_get_fiche_head($head,
'settings', $langs->trans($title), -1,
"fa-microchip");
146if ($action ==
'edit') {
147 print $formSetup->generateOutput(
true);
149} elseif (!empty($formSetup->items)) {
150 print $formSetup->generateOutput();
151 print
'<div class="tabsAction">';
152 print
'<a class="butAction" href="'.$_SERVER[
"PHP_SELF"].
'?action=edit&token='.
newToken().
'">'.$langs->trans(
"Modify").
'</a>';
155 print
'<br>'.$langs->trans(
"NothingToSetup");
159if (empty($setupnotempty)) {
160 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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.