Bitrix API

CopilotChatBot extends Base

Table of Contents

Constants

AI_ENGINE_ERROR_PROVIDER  = 'AI_ENGINE_ERROR_PROVIDER'
ALL_COPILOT_MESSAGE_COMPONENTS  = [self::MESSAGE_COMPONENT_ID, self::MESSAGE_COMPONENT_START, self::MESSAGE_COMPONENT_COLLECTIVE]
ASSISTANT_ROLE_ID  = 'copilot_assistant_chat'
BOT_CODE  = 'copilot'
CONTEXT_AMOUNT_DEFAULT  = 25
CONTEXT_ID  = 'copilot_chat'
CONTEXT_MODULE  = 'im'
CONTEXT_SUMMARY  = 'copilot_chat_summary'
ERROR_AGREEMENT  = 'AGREEMENT_ERROR'
ERROR_NETWORK  = 'NETWORK'
ERROR_SYSTEM  = 'SYSTEM_ERROR'
ERROR_TARIFF  = 'TARIFF_ERROR'
LIMIT_IS_EXCEEDED_BAAS  = 'LIMIT_IS_EXCEEDED_BAAS'
LIMIT_IS_EXCEEDED_DAILY  = 'LIMIT_IS_EXCEEDED_DAILY'
LIMIT_IS_EXCEEDED_MONTHLY  = 'LIMIT_IS_EXCEEDED_MONTHLY'
MESSAGE_COMPONENT_COLLECTIVE  = 'ChatCopilotAddedUsersMessage'
MESSAGE_COMPONENT_ID  = 'CopilotMessage'
MESSAGE_COMPONENT_START  = 'ChatCopilotCreationMessage'
MESSAGE_PARAMS_ERROR  = 'COPILOT_ERROR'
MESSAGE_PARAMS_MORE  = 'COPILOT_HAS_MORE'
MODE_ASYNC_QUEUE  = 'async_queue'
MODE_LONG_PULLING  = 'long_pulling'
OPTION_CONTEXT_AMOUNT  = 'copilot_context_amount'
OPTION_MODE  = 'copilot_mode'
SUMMARY_PROMPT_ID  = 'set_ai_session_name'

Methods

getContextAmount()  : int
Returns amount messages for context.
getDialogMeaning()  : void
Rename copilot chat.
getEventHandlerList()  : array<string|int, array{module: string, event: string, class: string, handler: string}>
Returns event handler list.
getMode()  : string
Returns current mode interaction with AI service: asynchronous requests or long pulling request.
isEnabled()  : bool
Is bot enabled.
isMemoryContextEnabled()  : bool
onChatStart()  : mixed
onGetContextMessages()  : array<string|int, mixed>
Event handler for `ai:onContextGetMessages` event.
onMessageAdd()  : bool
Event handler on message add.
onMessageDelete()  : bool
onMessageUpdate()  : bool
onQueueJobFail()  : void
Callback handler Copilot job has been failed.
onQueueJobMessage()  : void
Success callback handler.
refreshAgent()  : string
Refresh settings agent.
register()  : int
Register CopilotChatBot at portal.
unRegister()  : bool
Unregister CopilotChatBot at portal.
updateBotProperties()  : bool

Constants

AI_ENGINE_ERROR_PROVIDER

public mixed AI_ENGINE_ERROR_PROVIDER = 'AI_ENGINE_ERROR_PROVIDER'

ALL_COPILOT_MESSAGE_COMPONENTS

public mixed ALL_COPILOT_MESSAGE_COMPONENTS = [self::MESSAGE_COMPONENT_ID, self::MESSAGE_COMPONENT_START, self::MESSAGE_COMPONENT_COLLECTIVE]

ASSISTANT_ROLE_ID

public mixed ASSISTANT_ROLE_ID = 'copilot_assistant_chat'

CONTEXT_SUMMARY

public mixed CONTEXT_SUMMARY = 'copilot_chat_summary'

ERROR_AGREEMENT

public mixed ERROR_AGREEMENT = 'AGREEMENT_ERROR'

LIMIT_IS_EXCEEDED_DAILY

public mixed LIMIT_IS_EXCEEDED_DAILY = 'LIMIT_IS_EXCEEDED_DAILY'

LIMIT_IS_EXCEEDED_MONTHLY

public mixed LIMIT_IS_EXCEEDED_MONTHLY = 'LIMIT_IS_EXCEEDED_MONTHLY'

MESSAGE_COMPONENT_COLLECTIVE

public mixed MESSAGE_COMPONENT_COLLECTIVE = 'ChatCopilotAddedUsersMessage'

MESSAGE_COMPONENT_ID

public mixed MESSAGE_COMPONENT_ID = 'CopilotMessage'

MESSAGE_COMPONENT_START

public mixed MESSAGE_COMPONENT_START = 'ChatCopilotCreationMessage'

MESSAGE_PARAMS_ERROR

public mixed MESSAGE_PARAMS_ERROR = 'COPILOT_ERROR'

MESSAGE_PARAMS_MORE

public mixed MESSAGE_PARAMS_MORE = 'COPILOT_HAS_MORE'

MODE_LONG_PULLING

public mixed MODE_LONG_PULLING = 'long_pulling'

OPTION_CONTEXT_AMOUNT

public mixed OPTION_CONTEXT_AMOUNT = 'copilot_context_amount'

SUMMARY_PROMPT_ID

public mixed SUMMARY_PROMPT_ID = 'set_ai_session_name'

Methods

getContextAmount()

Returns amount messages for context.

public static getContextAmount() : int
Return values
int

getDialogMeaning()

Rename copilot chat.

public static getDialogMeaning(array<string|int, mixed> $messageFields, Chat $chat) : void
Parameters
$messageFields : array<string|int, mixed>
$chat : Chat

getEventHandlerList()

Returns event handler list.

public static getEventHandlerList() : array<string|int, array{module: string, event: string, class: string, handler: string}>
Return values
array<string|int, array{module: string, event: string, class: string, handler: string}>

getMode()

Returns current mode interaction with AI service: asynchronous requests or long pulling request.

public static getMode() : string
Return values
string

isEnabled()

Is bot enabled.

public static isEnabled() : bool
Return values
bool

isMemoryContextEnabled()

public static isMemoryContextEnabled() : bool
Return values
bool

onChatStart()

public static onChatStart(mixed $dialogId, mixed $joinFields) : mixed
Parameters
$dialogId : mixed
$joinFields : mixed

onGetContextMessages()

Event handler for `ai:onContextGetMessages` event.

public static onGetContextMessages(string $moduleId, string $contextId[, array<string|int, mixed> $parameters = [] ][, mixed|null $nextStep = null ]) : array<string|int, mixed>
Parameters
$moduleId : string
$contextId : string
$parameters : array<string|int, mixed> = []
$nextStep : mixed|null = null
Tags
see
Context::getMessages
event

ai:onContextGetMessages

Return values
array<string|int, mixed>

onMessageAdd()

Event handler on message add.

public static onMessageAdd(int $messageId, array<string|int, mixed> $messageFields) : bool
Parameters
$messageId : int

Message Id.

$messageFields : array<string|int, mixed>

Event arguments.

Tags
see
Bot::onMessageAdd
Return values
bool

onMessageDelete()

public static onMessageDelete(int $messageId, array<string|int, mixed> $messageFields) : bool
Parameters
$messageId : int

Message Id.

$messageFields : array<string|int, mixed>

Event arguments.

Return values
bool

onMessageUpdate()

public static onMessageUpdate(int $messageId, array<string|int, mixed> $messageFields) : bool
Parameters
$messageId : int

Message Id.

$messageFields : array<string|int, mixed>

Event arguments.

Return values
bool

onQueueJobFail()

Callback handler Copilot job has been failed.

public static onQueueJobFail(string $hash, IEngine $engine, Result $result, Error|null $error) : void
Parameters
$hash : string
$engine : IEngine
$result : Result
$error : Error|null
Tags
see
QueueJob::clearOldAgent
see
QueueJob::fail
event

ai:onQueueJobFail

onQueueJobMessage()

Success callback handler.

public static onQueueJobMessage(string $hash, IEngine $engine, Result $result, Error|null $error) : void
Parameters
$hash : string
$engine : IEngine
$result : Result
$error : Error|null
Tags
see
QueueJob::execute
event

ai:onQueueJobExecute

refreshAgent()

Refresh settings agent.

public static refreshAgent([bool $regular = false ]) : string
Parameters
$regular : bool = false
Return values
string

register()

Register CopilotChatBot at portal.

public static register([array<string|int, mixed> $params = [] ]) : int
Parameters
$params : array<string|int, mixed> = []
Return values
int

unRegister()

Unregister CopilotChatBot at portal.

public static unRegister() : bool
Return values
bool

updateBotProperties()

public static updateBotProperties() : bool
Return values
bool

        
On this page

Search results