BlocksAI & Machine Learning
Chat Manager
Manage and manipulate chat history objects used in AI blocks.
Chat Manager Block
The Chat Manager Block is a utility designed to read, edit, trim, or clear chat histories that are stored in Object variables by the other AI blocks (ChatGPT, Claude, Gemini, etc.).
Configuration
| Field | Required | Description |
|---|---|---|
| Action | ✅ | The operation to perform on the chat history (e.g., Clear Chat, Trim History, Get Chat). |
| Storage Object Variable | ✅ | The variable that holds the chat history dictionary. |
| Chat ID | ✅ | The unique identifier of the specific chat to manage. |
Additional Settings
Depending on the Action selected, additional configuration fields may appear, such as specifying the number of messages to trim.
Output Variable
Specify a Variable Name to store the output if you use the Get or Trim operation.
get Output
Returns the raw array of chat messages for the specified ID:
[
{ "role": "system", "content": "You are a helpful assistant." },
{ "role": "user", "content": "Hello!" },
{ "role": "assistant", "content": "Hi there!" }
]trim Output
Returns an object detailing the operation results:
{
"messages_kept": 6,
"messages_deleted": 2
}Error Payload
If an error occurs during execution, the variable is populated with:
{
"error_key": "CHAT_ID_MISSING",
}Error Handling
HISTORY_VAR_MISSING— Triggered when the Storage Object Variable is required but missing.CHAT_ID_MISSING— Triggered when the Chat ID is required for the operation but missing.RUNTIME_ERROR— Triggered when an error occurs during history management.
