3namespace Bitrix\Mail\Integration\AI;
5use Bitrix\Mail\Integration\AI\EventHandler;
25 if (!Loader::includeModule(
'ai')
26 || !$this->isAITurningManagerAvailable()
33 $item =
$manager->getItem(self::SETTINGS_ITEM_MAIL_CODE);
35 return (
bool)$item?->getValue();
40 if (!Loader::includeModule(
'ai')
41 || !Loader::includeModule(
'crm')
42 || !$this->isAITurningManagerAvailable()
49 $item =
$manager->getItem(self::SETTINGS_ITEM_MAIL_CRM_CODE);
51 return (
bool)$item?->getValue();
58 return [
'isCopilotEnabled' =>
false];
61 return $this->prepareMailCopilotParams(
73 return [
'isCopilotEnabled' =>
false];
76 return $this->prepareMailCopilotParams(
84 private function prepareMailCopilotParams(
bool $isCopilotEnabled,
string $contextId,
string $category, ?
array $contextParams =
null):
array
87 'isCopilotEnabled' => $isCopilotEnabled,
88 'isCopilotTextEnabled' => $isCopilotEnabled,
90 'contextId' => $contextId,
91 'category' => $category,
92 'invitationLineMode' =>
'eachLine',
93 'contextParameters' => $contextParams ?? [],
97 private function isAITurningManagerAvailable(): bool
99 return Loader::includeModule(
'ai') && class_exists(
'\Bitrix\AI\Tuning\Manager');
const SETTINGS_ITEM_MAIL_CRM_CODE
const SETTINGS_ITEM_MAIL_CODE
const MAIL_CRM_REPLY_MESSAGE_CONTEXT_ID
const MAIL_CRM_NEW_MESSAGE_CONTEXT_ID
getMailCopilotParams(string $contextId, ?array $contextParams=null)
const MAIL_REPLY_MESSAGE_CONTEXT_ID
const MAIL_NEW_MESSAGE_CONTEXT_ID
getMailCrmCopilotParams(string $contextId, ?array $contextParams=null)
isMailCrmCopilotEnabledInGlobalSettings()
isMailCopilotEnabledInGlobalSettings()
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)