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'
BOT_CODE
public
mixed
BOT_CODE
= 'copilot'
CONTEXT_AMOUNT_DEFAULT
public
mixed
CONTEXT_AMOUNT_DEFAULT
= 25
CONTEXT_ID
public
mixed
CONTEXT_ID
= 'copilot_chat'
CONTEXT_MODULE
public
mixed
CONTEXT_MODULE
= 'im'
CONTEXT_SUMMARY
public
mixed
CONTEXT_SUMMARY
= 'copilot_chat_summary'
ERROR_AGREEMENT
public
mixed
ERROR_AGREEMENT
= 'AGREEMENT_ERROR'
ERROR_NETWORK
public
mixed
ERROR_NETWORK
= 'NETWORK'
ERROR_SYSTEM
public
mixed
ERROR_SYSTEM
= 'SYSTEM_ERROR'
ERROR_TARIFF
public
mixed
ERROR_TARIFF
= 'TARIFF_ERROR'
LIMIT_IS_EXCEEDED_BAAS
public
mixed
LIMIT_IS_EXCEEDED_BAAS
= 'LIMIT_IS_EXCEEDED_BAAS'
Tags
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_ASYNC_QUEUE
public
mixed
MODE_ASYNC_QUEUE
= 'async_queue'
MODE_LONG_PULLING
public
mixed
MODE_LONG_PULLING
= 'long_pulling'
OPTION_CONTEXT_AMOUNT
public
mixed
OPTION_CONTEXT_AMOUNT
= 'copilot_context_amount'
OPTION_MODE
public
mixed
OPTION_MODE
= 'copilot_mode'
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
intgetDialogMeaning()
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
stringisEnabled()
Is bot enabled.
public
static isEnabled() : bool
Return values
boolisMemoryContextEnabled()
public
static isMemoryContextEnabled() : bool
Return values
boolonChatStart()
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
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
Return values
boolonMessageDelete()
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
boolonMessageUpdate()
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
boolonQueueJobFail()
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
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
refreshAgent()
Refresh settings agent.
public
static refreshAgent([bool $regular = false ]) : string
Parameters
- $regular : bool = false
Return values
stringregister()
Register CopilotChatBot at portal.
public
static register([array<string|int, mixed> $params = [] ]) : int
Parameters
- $params : array<string|int, mixed> = []
Return values
intunRegister()
Unregister CopilotChatBot at portal.
public
static unRegister() : bool
Return values
boolupdateBotProperties()
public
static updateBotProperties() : bool