pub enum ChatTask {
Send,
Stop,
CopyMessage(usize),
SetMessages(Vec<Message>),
InsertMessage(usize, Message),
DeleteMessage(usize),
UpdateMessage(usize, Message),
ClearPrompt,
ScrollToBottom(bool),
ApproveToolCalls(usize),
DenyToolCalls(usize),
}Expand description
A task of interest that was or will be performed by the Chat widget.
You can get notified when a group of tasks were already executed by using Chat::set_hook_after.
You can also “hook” into the group of tasks before it’s executed with Chat::set_hook_before. This allows you to modify their payloads (which are used by the task when executed), add and remove tasks from the group, abort the group (by clearing the tasks vector), etc.
Variants§
Send
When received back, it will send the whole chat context to the bot.
Stop
When received back, it will cancel the response stream from the bot.
CopyMessage(usize)
When received back, it will copy the message at the given index to the clipboard.
SetMessages(Vec<Message>)
When received back, it will re-write the message history with the given messages.
InsertMessage(usize, Message)
When received back, it will insert a message at the given index.
DeleteMessage(usize)
When received back, it will delete the message at the given index.
UpdateMessage(usize, Message)
When received back, it will update the message at the given index.
ClearPrompt
When received back, it will clear the prompt input.
ScrollToBottom(bool)
When received back, the chat will scroll to the bottom.
The boolean indicates if the scroll was triggered by a stream or not.
ApproveToolCalls(usize)
When received back, it will approve and execute the tool calls in the message at the given index.
DenyToolCalls(usize)
When received back, it will deny the tool calls in the message at the given index.