fix: add typing indicator debug logging
This commit is contained in:
@@ -1091,9 +1091,15 @@ export async function initBot(config, api, tools, skills, agents) {
|
||||
let firstTokenArrived = false;
|
||||
const typingInterval = setInterval(async () => {
|
||||
if (firstTokenArrived) return;
|
||||
try { await ctx.api.sendChatAction(ctx.chat.id, 'typing'); } catch {}
|
||||
try {
|
||||
await ctx.api.sendChatAction(ctx.chat.id, 'typing');
|
||||
logger.debug('⌨️ typing ping');
|
||||
} catch (e) { logger.warn(`⌨️ typing error: ${e.message}`); }
|
||||
}, 4000); // Telegram typing expires after 5s, refresh every 4s
|
||||
await ctx.api.sendChatAction(ctx.chat.id, 'typing'); // initial ping
|
||||
try {
|
||||
await ctx.api.sendChatAction(ctx.chat.id, 'typing');
|
||||
logger.info('⌨️ typing started');
|
||||
} catch (e) { logger.warn(`⌨️ initial typing error: ${e.message}`); }
|
||||
|
||||
try {
|
||||
// ── Load conversation history for this chat ──
|
||||
@@ -1129,6 +1135,7 @@ export async function initBot(config, api, tools, skills, agents) {
|
||||
// Stop typing indicator
|
||||
firstTokenArrived = true;
|
||||
clearInterval(typingInterval);
|
||||
logger.info('⌨️ typing stopped (response complete)');
|
||||
|
||||
// Signal completion and wait for final edit
|
||||
consumer.finish();
|
||||
|
||||
Reference in New Issue
Block a user