403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/mail/lib/integration/ai/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/mail/lib/integration/ai/eventhandler.php
<?php

namespace Bitrix\Mail\Integration\AI;

use Bitrix\Main\Loader;
use Bitrix\Main\Localization\Loc;
use Bitrix\AI;
use Bitrix\Main;

final class EventHandler
{
	public const SETTINGS_ITEM_MAIL_CODE = 'mail_copilot_item_enabled';
	public const SETTINGS_ITEM_MAIL_CRM_CODE = 'mail_crm_copilot_item_enabled';

	public static function onTuningLoad(): Main\Entity\EventResult
	{
		$result = new Main\Entity\EventResult();
		$items = [];

		if (!self::checkTextCategory())
		{
			$result->modifyFields([
				'items' => $items,
			]);

			return $result;
		}

		$items[self::SETTINGS_ITEM_MAIL_CODE] = [
			'group' => AI\Tuning\Defaults::GROUP_TEXT,
			'title' => Loc::getMessage('MAIL_INTEGRATION_AI_EVENTHANDLER_MAIL_SETTINGS_TITLE'),
			'header' => Loc::getMessage('MAIL_INTEGRATION_AI_EVENTHANDLER_MAIL_SETTINGS_SUBTITLE'),
			'type' => AI\Tuning\Type::BOOLEAN,
			'default' => true,
			'sort' => 400,
		];

		if (Loader::includeModule('crm') && class_exists('\Bitrix\Crm\Integration\AI\AIManager'))
		{
			$items[self::SETTINGS_ITEM_MAIL_CRM_CODE] = [
				'group' => AI\Tuning\Defaults::GROUP_TEXT,
				'title' => Loc::getMessage('MAIL_INTEGRATION_AI_EVENTHANDLER_MAIL_CRM_SETTINGS_TITLE_MSGVER_1'),
				'header' => Loc::getMessage('MAIL_INTEGRATION_AI_EVENTHANDLER_MAIL_CRM_SETTINGS_SUBTITLE'),
				'type' => AI\Tuning\Type::BOOLEAN,
				'default' => true,
				'sort' => 410,
			];
		}

		$result->modifyFields([
			'items' => $items,
		]);

		return $result;
	}

	private static function checkTextCategory():bool
	{
		return !empty(AI\Engine::getByCategory('text', AI\Context::getFake()));
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit