Skip to main content

record

Function record 

Source
pub fn record(chat: &mut Chat, store: &Chats, text: &str) -> Result<String>
Expand description

Append the operator’s turn and flush it, without invoking anything.

Split out of say so a caller that answers the operator before the agent has replied can still promise the message is on disk. POST /api/chats/{id}/say does exactly that: holding an HTTP connection for the 23-to-90 seconds a real turn takes is a coin flip on a phone, and the browser reporting “Failed to fetch” while the server quietly finished the turn is the worst of both answers.

Returns the trimmed text, so the caller and the agent see the same string.