diff --git a/htdocs/ai/admin/custom_prompt.php b/htdocs/ai/admin/custom_prompt.php index 092612da89f..8149ec58b09 100644 --- a/htdocs/ai/admin/custom_prompt.php +++ b/htdocs/ai/admin/custom_prompt.php @@ -81,8 +81,16 @@ $aiservice = getDolGlobalString('AI_API_SERVICE', 'chatgpt'); // Setup conf for AI model $formSetup->formHiddenInputs['action'] = "updatefeaturemodel"; foreach ($arrayofaifeatures as $key => $val) { + $newkey = $key; + if (preg_match('/^text/', $key)) { + $newkey = 'textgeneration'; + } $item = $formSetup->newItem('AI_API_'.strtoupper($aiservice).'_MODEL_'.$val["function"]); // Name of constant must end with _KEY so it is encrypted when saved into database. - $item->nameText = $langs->trans("AI_API_MODEL_".$val["function"]); + if ($arrayofai[$aiservice][$newkey] != 'na') { + $item->nameText = $langs->trans("AI_API_MODEL_".$val["function"]).' ('.$langs->trans("Default").' = '.$arrayofai[$aiservice][$newkey].')'; + } else { + $item->nameText = $langs->trans("AI_API_MODEL_".$val["function"]).' ('.$langs->trans("None").')'; + } $item->cssClass = 'minwidth500 input'; } @@ -218,10 +226,15 @@ print load_fiche_titre($langs->trans($title), $linkback, 'title_setup'); $head = aiAdminPrepareHead(); print dol_get_fiche_head($head, 'custom', $langs->trans($title), -1, "ai"); -//$newbutton = ''.$langs->trans("New").''; -$newbutton = ''; +$newcardbutton = dolGetButtonTitle($langs->trans('NewCustomPrompt'), '', 'fa fa-plus-circle', $_SERVER["PHP_SELF"].'?action=create', '', 1); +/* +$newbutton = ''; +$newbutton .= img_picto('', 'add'); +$newbutton .= ''; +*/ + +print load_fiche_titre($langs->trans("AIPromptForFeatures", $arrayofai[$aiservice]['label']), $newcardbutton, ''); -print load_fiche_titre($langs->trans("AIPromptForFeatures"), $newbutton, ''); if ($action == 'deleteproperty') { $formconfirm = $form->formconfirm( @@ -236,7 +249,8 @@ if ($action == 'deleteproperty') { print $formconfirm; } -if ($action == 'edit' || $action == 'deleteproperty') { +if ($action == 'create') { + $out .= '