25 if (!Loader::includeModule(
'ai')
26 || !$this->isAITurningManagerAvailable()
32 $manager =
new AI\Tuning\Manager();
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()
48 $manager =
new AI\Tuning\Manager();
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()