Clean menu for AI generation modes

This commit is contained in:
Laurent Destailleur 2024-07-15 13:40:55 +02:00
parent fe4a3956da
commit ac1704ec49
5 changed files with 25 additions and 13 deletions

View File

@ -73,9 +73,9 @@ $arrayofaifeatures = array(
'textgeneration' => array('label' => $langs->trans('TextGeneration').' ('.$langs->trans("Other").')', 'picto'=>'', 'status'=>'notused'),
'imagegeneration' => array('label' => 'ImageGeneration', 'picto'=>'', 'status'=>'notused'),
'videogeneration' => array('label' => 'VideoGeneration', 'picto'=>'', 'status'=>'notused'),
'audiogeneration' => array('label' => 'AudioGeneration', 'picto'=>'', 'status'=>'notused'),
'transcription' => array('label' => 'Transcription', 'picto'=>'', 'status'=>'notused'),
'translation' => array('label' => 'Translation', 'picto'=>'', 'status'=>'notused'),
'audiotext' => array('label' => 'AudioText', 'picto'=>'', 'status'=>'notused')
'translation' => array('label' => 'Translation', 'picto'=>'', 'status'=>'notused')
);

View File

@ -73,7 +73,7 @@ class Ai
*
* @param string $instructions Instruction to generate content
* @param string $model Model name ('gpt-3.5-turbo', 'gpt-4-turbo', 'dall-e-3', ...)
* @param string $function Code of the feature we want to use ('textgeneration', 'transcription', 'audiotext', 'imagegeneration', 'translation')
* @param string $function Code of the feature we want to use ('textgeneration', 'transcription', 'audiogeneration', 'imagegeneration', 'translation')
* @param string $format Format for output ('', 'html', ...)
* @return mixed $response
*/
@ -91,7 +91,7 @@ class Ai
$model = getDolGlobalString('AI_API_CHATGPT_MODEL_IMAGE', 'dall-e-3');
}
}
} elseif ($function == 'audiotext') {
} elseif ($function == 'audiogeneration') {
if ($this->apiService == 'chatgpt') {
$this->apiEndpoint = 'https://api.openai.com/v1/audio/speech';
if ($model == 'auto') {

View File

@ -3736,8 +3736,8 @@ function dol_print_url($url, $target = '_blank', $max = 32, $withpicto = 0, $mor
* @param string $email EMail to show (only email, without 'Name of recipient' before)
* @param int $cid Id of contact if known
* @param int $socid Id of third party if known
* @param int $addlink 0=no link, 1=email has a html email link (+ link to create action if constant AGENDA_ADDACTIONFOREMAIL is on)
* @param int $max Max number of characters to show
* @param int|string $addlink 0=no link, 1=email has a html email link (+ link to create action if constant AGENDA_ADDACTIONFOREMAIL is on), 'thirdparty'=link to the thirdparty
* @param int $max Max number of characters to show. Use -1 to hide the mail text and show only the picto.
* @param int $showinvalid 1=Show warning if syntax email is wrong
* @param int|string $withpicto Show picto
* @return string HTML Link
@ -3759,7 +3759,7 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
return ' ';
}
if (!empty($addlink)) {
if ($addlink == 1) {
$newemail = '<a class="paddingrightonly" style="text-overflow: ellipsis;" href="';
if (!preg_match('/^mailto:/i', $email)) {
$newemail .= 'mailto:';
@ -3769,7 +3769,9 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
$newemail .= ($withpicto ? img_picto($langs->trans("EMail").' : '.$email, (is_numeric($withpicto) ? 'email' : $withpicto), 'class="paddingrightonly"') : '');
$newemail .= dol_trunc($email, $max);
if ($max > 0) {
$newemail .= dol_trunc($email, $max);
}
$newemail .= '</a>';
if ($showinvalid && !isValidEmail($email)) {
$langs->load("errors");
@ -3786,6 +3788,10 @@ function dol_print_email($email, $cid = 0, $socid = 0, $addlink = 0, $max = 64,
$newemail = '<div>'.$newemail.' '.$linktoaddaction.'</div>';
}
}
} elseif ($addlink == 'thirdparty') {
$newemail = '<a class="paddingrightonly" style="text-overflow: ellipsis;" href="'.DOL_URL_ROOT.'/societe/card.php?socid='.$socid.'&action=presend&mode=init#formmailbeforetitle">';
$newemail .= ($withpicto ? img_picto($langs->trans("EMail").' : '.$email, (is_numeric($withpicto) ? 'email' : $withpicto), 'class="paddingrightonly"') : '').$newemail;
$newemail .= '</a>';
} else {
$newemail = ($withpicto ? img_picto($langs->trans("EMail").' : '.$email, (is_numeric($withpicto) ? 'email' : $withpicto), 'class="paddingrightonly"') : '').$newemail;

View File

@ -2267,7 +2267,7 @@ ConfirmDeleteEmailCollector=Are you sure you want to delete this email collector
RecipientEmailsWillBeReplacedWithThisValue=Recipient emails will be always replaced with this value
AtLeastOneDefaultBankAccountMandatory=At least 1 default bank account must be defined
RESTRICT_ON_IP=Allow API access to only certain client IPs (wildcard not allowed, use space between values). Empty means every clients can access.
StaticIPsOfUsers=If applicable, list of all static IPs of users
StaticIPsOfUsers=If applicable, list of all static IPs of users
IPListExample=127.0.0.1 192.168.0.2 [::1]
BaseOnSabeDavVersion=Based on the library SabreDAV version
NotAPublicIp=Not a public IP
@ -2487,7 +2487,7 @@ AI_CONFIGURATIONS_PROMPT=Custom prompt
TextGeneration=Text generation
ImageGeneration=Image generation
VideoGeneration=Video generation
AudioText=Audio - Text
AudioGeneration=Audio generation
AIPromptForFeatures=AI custom prompts for features
EnterAnIP=Enter an IP address
ConvertInto=Convert into

View File

@ -2466,7 +2466,8 @@ class Project extends CommonObject
}
/**
* Function sending an email to the current member with the text supplied in parameter.
* Function sending an email to the current project with the text supplied in parameter.
* TODO When this is used ?
*
* @param string $text Content of message (not html entities encoded)
* @param string $subject Subject of message
@ -2484,11 +2485,11 @@ class Project extends CommonObject
*/
public function sendEmail($text, $subject, $filename_list = array(), $mimetype_list = array(), $mimefilename_list = array(), $addr_cc = "", $addr_bcc = "", $deliveryreceipt = 0, $msgishtml = -1, $errors_to = '', $moreinheader = '')
{
global $conf, $langs;
// TODO EMAIL
return 1;
}
/**
* Return clicable link of object (with eventually picto)
*
@ -2540,13 +2541,18 @@ class Project extends CommonObject
$return .= '<span class="info-box-label">'.dol_print_date($this->date_end, 'day').'</span>';
}*/
if (property_exists($this, 'thirdparty') && !is_null($this->thirdparty) && is_object($this->thirdparty) && $this->thirdparty instanceof Societe) {
$return .= '<br><div class="info-box-ref tdoverflowmax150 inline-block valignmiddle">'.$this->thirdparty->getNomUrl(1);
$return .= '<br><div class="info-box-ref tdoverflowmax125 inline-block valignmiddle">'.$this->thirdparty->getNomUrl(1);
$return .= '</div>';
if (!empty($this->thirdparty->phone)) {
$return .= '<div class="inline-block valignmiddle">';
$return .= dol_print_phone($this->thirdparty->phone, $this->thirdparty->country_code, 0, $this->thirdparty->id, 'tel', 'hidenum', 'phone', $this->thirdparty->phone, 0, 'marginleftonly');
$return .= '</div>';
}
if (!empty($this->thirdparty->email)) {
$return .= '<div class="inline-block valignmiddle">';
$return .= dol_print_email($this->thirdparty->email, 0, $this->thirdparty->id, 'thirdparty', -1, 1, 1);
$return .= '</div>';
}
}
if (!empty($arraydata['assignedusers'])) {
$return .= '<br>';