feat(telegram): add typing indicator when receiving messages
- Send 'typing' chat action immediately upon receiving a message - Improves user experience by showing the bot is processing - Telegram displays '...is typing' indicator while the AI generates response - Gracefully ignores errors to avoid breaking message handling Previously, there was no typing indicator implementation, causing users to wait without feedback during AI response generation.
This commit is contained in:
parent
a3c66e3383
commit
3b7a140aad
1 changed files with 11 additions and 0 deletions
|
|
@ -500,6 +500,17 @@ Allowlist Telegram @username or numeric user ID, then run `zeroclaw onboard --ch
|
|||
.map(|id| id.to_string())
|
||||
.unwrap_or_default();
|
||||
|
||||
// Send "typing" indicator immediately when we receive a message
|
||||
let typing_body = serde_json::json!({
|
||||
"chat_id": &chat_id,
|
||||
"action": "typing"
|
||||
});
|
||||
let _ = self.client
|
||||
.post(self.api_url("sendChatAction"))
|
||||
.json(&typing_body)
|
||||
.send()
|
||||
.await; // Ignore errors for typing indicator
|
||||
|
||||
let msg = ChannelMessage {
|
||||
id: Uuid::new_v4().to_string(),
|
||||
sender: chat_id,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue