squidclaw 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/engine.js +16 -1
- package/package.json +1 -1
package/lib/engine.js
CHANGED
|
@@ -213,7 +213,22 @@ export class SquidclawEngine {
|
|
|
213
213
|
}
|
|
214
214
|
}
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
// Show typing indicator while processing
|
|
217
|
+
const chatId = metadata.chatId || contactId;
|
|
218
|
+
const botInfo = this.telegramManager?.bots?.values()?.next()?.value;
|
|
219
|
+
let typingInterval;
|
|
220
|
+
if (botInfo) {
|
|
221
|
+
const sendTyping = () => { try { botInfo.bot.api.sendChatAction(chatId, 'typing').catch(() => {}); } catch {} };
|
|
222
|
+
sendTyping();
|
|
223
|
+
typingInterval = setInterval(sendTyping, 4000);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
let result;
|
|
227
|
+
try {
|
|
228
|
+
result = await agent.processMessage(contactId, message, metadata);
|
|
229
|
+
} finally {
|
|
230
|
+
if (typingInterval) clearInterval(typingInterval);
|
|
231
|
+
}
|
|
217
232
|
|
|
218
233
|
if (result.reaction && metadata.messageId) {
|
|
219
234
|
try { await this.telegramManager.sendReaction(agentId, contactId, metadata.messageId, result.reaction, metadata); } catch {}
|