1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
AiAssistantBaseChat.php
См. документацию.
1
<?php
2
3
declare(strict_types=1);
4
5
namespace
Bitrix\Im\V2\Chat\Ai
;
6
7
use
Bitrix\Im\V2\Application\Features
;
8
use
Bitrix\Im\V2\Chat\ChatError
;
9
use
Bitrix\Im\V2\Chat\GroupChat
;
10
use
Bitrix\Im\V2\Integration\AiAssistant\AiAssistantService
;
11
use
Bitrix\Im\V2\Relation\AddUsersConfig
;
12
use
Bitrix\Im\V2\Result
;
13
use
Bitrix\Im\V2\Service\Context
;
14
use
Bitrix\Main\DI\ServiceLocator
;
15
16
abstract
class
AiAssistantBaseChat
extends
GroupChat
17
{
18
protected
AiAssistantService
$aiAssistantService
;
19
20
public
function
__construct
($source =
null
)
21
{
22
$this->aiAssistantService = ServiceLocator::getInstance()->get(AiAssistantService::class);
23
parent::__construct($source);
24
}
25
26
public
function
add
(
array
$params
, ?
Context
$context
=
null
):
Result
27
{
28
if
(!Features::isAiAssistantChatCreationAvailable())
29
{
30
return
(
new
Result
())->addError(
new
ChatError
(
ChatError::AI_ASSISTANT_NOT_AVAILABLE
));
31
}
32
33
$params
[
'USERS'
][] = $this->aiAssistantService->getBotId();
34
35
return
parent::add(
$params
,
$context
);
36
}
37
38
protected
function
sendMessageUsersAdd
(
array
$usersToAdd,
AddUsersConfig
$config
): void
39
{
40
$aiAssistantBotId = $this->aiAssistantService->getBotId();
41
unset($usersToAdd[$aiAssistantBotId]);
42
parent::sendMessageUsersAdd($usersToAdd,
$config
);
43
}
44
}
Bitrix\Im\V2\Application\Features
Определения
Features.php:21
Bitrix\Im\V2\Chat\Ai\AiAssistantBaseChat
Определения
AiAssistantBaseChat.php:17
Bitrix\Im\V2\Chat\Ai\AiAssistantBaseChat\sendMessageUsersAdd
sendMessageUsersAdd(array $usersToAdd, AddUsersConfig $config)
Определения
AiAssistantBaseChat.php:38
Bitrix\Im\V2\Chat\Ai\AiAssistantBaseChat\add
add(array $params, ?Context $context=null)
Определения
AiAssistantBaseChat.php:26
Bitrix\Im\V2\Chat\Ai\AiAssistantBaseChat\__construct
__construct($source=null)
Определения
AiAssistantBaseChat.php:20
Bitrix\Im\V2\Chat\Ai\AiAssistantBaseChat\$aiAssistantService
AiAssistantService $aiAssistantService
Определения
AiAssistantBaseChat.php:18
Bitrix\Im\V2\Chat\ChatError
Определения
ChatError.php:9
Bitrix\Im\V2\Chat\ChatError\AI_ASSISTANT_NOT_AVAILABLE
const AI_ASSISTANT_NOT_AVAILABLE
Определения
ChatError.php:29
Bitrix\Im\V2\Chat\GroupChat
Определения
GroupChat.php:40
Bitrix\Im\V2\Integration\AiAssistant\AiAssistantService
Определения
AiAssistantService.php:15
Bitrix\Im\V2\Relation\AddUsersConfig
Определения
AddUsersConfig.php:6
Bitrix\Main\DB\Result
Определения
result.php:20
Bitrix\Main\DI\ServiceLocator
Определения
servicelocator.php:19
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$context
$context
Определения
csv_new_setup.php:223
Bitrix\Im\V2\Chat\Ai
Определения
AiAssistantBaseChat.php:5
Bitrix\Main\Context
Определения
culture.php:9
$config
$config
Определения
quickway.php:69
$params
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']
Определения
template.php:799
bitrix
modules
im
lib
V2
Chat
Ai
AiAssistantBaseChat.php
Создано системой
1.14.0