diff --git a/htdocs/ai/admin/setup.php b/htdocs/ai/admin/setup.php index a670bc5492c..a37a2efa723 100644 --- a/htdocs/ai/admin/setup.php +++ b/htdocs/ai/admin/setup.php @@ -66,7 +66,7 @@ $formSetup = new FormSetup($db); // List all available IA $arrayofia = array( 'chatgpt' => 'ChatGPT', - 'grok' => 'Grok', + 'groq' => 'Groq', //'gemini' => 'Gemini' ); @@ -80,10 +80,11 @@ foreach ($arrayofia as $ia => $ialabel) { $item->defaultFieldValue = ''; $item->cssClass = 'minwidth500';*/ - $item = $formSetup->newItem('AI_API_'.strtoupper($ia).'_KEY'); // Name of constant must end with _KEY so it is encrypted when saved into database. + $item = $formSetup->newItem('AI_API_'.strtoupper($ia).'_KEY')->setAsSecureKey(); // Name of constant must end with _KEY so it is encrypted when saved into database. $item->nameText = $langs->trans("AI_API_KEY").' ('.$ialabel.')'; $item->defaultFieldValue = ''; - $item->cssClass = 'minwidth500'; + $item->fieldParams['hideGenerateButton'] = 1; + $item->cssClass = 'minwidth500 text-security'; } $setupnotempty = + count($formSetup->items); diff --git a/htdocs/ai/class/ai.class.php b/htdocs/ai/class/ai.class.php index 658ede7740f..9db968ea8f5 100644 --- a/htdocs/ai/class/ai.class.php +++ b/htdocs/ai/class/ai.class.php @@ -113,7 +113,7 @@ class Ai } } } else { // else textgeneration... - if ($this->apiService == 'grok') { + if ($this->apiService == 'groq') { $this->apiEndpoint = 'https://api.groq.com/openai/v1/chat/completions'; if ($model == 'auto') { $model = getDolGlobalString('AI_API_GROK_MODEL_TEXT', 'mixtral-8x7b-32768'); // 'llama3-8b-8192', 'gemma-7b-it' diff --git a/htdocs/core/class/html.formsetup.class.php b/htdocs/core/class/html.formsetup.class.php index 54e2203b0b4..b7d81050b45 100644 --- a/htdocs/core/class/html.formsetup.class.php +++ b/htdocs/core/class/html.formsetup.class.php @@ -640,6 +640,9 @@ class FormSetupItem /** @var array set this var for options on select and multiselect items */ public $fieldOptions = array(); + /** @var array set this var to add more parameters */ + public $fieldParams = array(); + /** @var callable $saveCallBack */ public $saveCallBack; @@ -1035,14 +1038,15 @@ class FormSetupItem public function generateInputFieldSecureKey() { global $conf; - $out = ''; - if (!empty($conf->use_javascript_ajax)) { - $out .= ' '.img_picto($this->langs->trans('Generate'), 'refresh', 'id="generate_token'.$this->confKey.'" class="linkobject"'); - } + $out = ''; - // Add button to autosuggest a key - include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; - $out .= dolJSToSetRandomPassword($this->confKey, 'generate_token'.$this->confKey); + if (!empty($conf->use_javascript_ajax) && empty($this->fieldParams['hideGenerateButton'])) { + $out .= ' '.img_picto($this->langs->trans('Generate'), 'refresh', 'id="generate_token'.$this->confKey.'" class="linkobject"'); + + // Add button to autosuggest a key + include_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php'; + $out .= dolJSToSetRandomPassword($this->confKey, 'generate_token'.$this->confKey); + } return $out; } @@ -1059,7 +1063,7 @@ class FormSetupItem { global $conf, $langs, $user; - $min = 8; + $min = 6; $max = 50; if ($type == 'dolibarr') { $gen = getDolGlobalString('USER_PASSWORD_GENERATED', 'standard'); @@ -1073,7 +1077,14 @@ class FormSetupItem $min = $genhandler->length; $max = $genhandler->length2; } - $out = ''; + $out = 'type (will be protected) so this method exist * to be sure we can manage evolution easily * - * @param string $type possible values based on old module builder setup : 'string', 'textarea', 'category:'.Categorie::TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type' - * @deprecated yes this setTypeFromTypeString came deprecated because it exists only for manage setup conversion - * @return bool + * @param string $type Possible values based on old module builder setup : 'string', 'textarea', 'category:'.Categorie::TYPE_CUSTOMER', 'emailtemplate', 'thirdparty_type' + * @deprecated this setTypeFromTypeString came deprecated because it exists only for manage setup conversion + * @return bool */ public function setTypeFromTypeString($type) { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 07b1c76668a..1de8982f194 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -1631,6 +1631,7 @@ table.paymenttable td.amountpaymentcomplete, table.paymenttable td.amountremaint white-space: nowrap; } + .onlinepaymentbody .amountpaymentcomplete { background-color: var(--amountpaymentcomplete); color: #fff; @@ -1664,6 +1665,9 @@ table.paymenttable td.amountpaymentcomplete, table.paymenttable td.amountremaint .fa-15 { font-size: 1.5em; } +.text-security { + -webkit-text-security: disc; +} /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ /*.table-responsive { diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 5f7714ea120..b08b67d9f89 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -1830,6 +1830,9 @@ select.flat.selectlimit { .fa-15 { font-size: 1.5em; } +.text-security { + -webkit-text-security: disc; +} /* DOL_XXX for future usage (when left menu has been removed). If we do not use datatable */ /*.table-responsive {