core: pre- and post-start chat hooks for CLI-based bots (#6217)

This commit is contained in:
Evgeny
2025-08-24 10:24:00 +01:00
committed by GitHub
parent 1df92b7ff4
commit 3454935b3b
2 changed files with 12 additions and 4 deletions
+8 -2
View File
@@ -168,7 +168,13 @@ data RandomAgentServers = RandomAgentServers
-- The hooks can be used to extend or customize chat core in mobile or CLI clients.
data ChatHooks = ChatHooks
{ -- preCmdHook can be used to process or modify the commands before they are processed.
{ -- preStartHook can be used to verify some data,
-- It is called before chat controller is started, unless the core is started in maintenance mode.
preStartHook :: Maybe (ChatController -> IO ()),
-- postStartHook can be used to update some data after start (e.g. commands in bot or group profiles),
-- It is called after chat controller is started.
postStartHook :: Maybe (ChatController -> IO ()),
-- preCmdHook can be used to process or modify the commands before they are processed.
-- This hook should be used to process CustomChatCommand.
-- if this hook returns ChatResponse, the command processing will be skipped.
preCmdHook :: Maybe (ChatController -> ChatCommand -> IO (Either (Either ChatError ChatResponse) ChatCommand)),
@@ -180,7 +186,7 @@ data ChatHooks = ChatHooks
}
defaultChatHooks :: ChatHooks
defaultChatHooks = ChatHooks Nothing Nothing Nothing
defaultChatHooks = ChatHooks Nothing Nothing Nothing Nothing Nothing
data PresetServers = PresetServers
{ operators :: NonEmpty PresetOperator,