diff --git a/src/bot/telegram-bot.ts b/src/bot/telegram-bot.ts index 1780261..ab748fb 100644 --- a/src/bot/telegram-bot.ts +++ b/src/bot/telegram-bot.ts @@ -7,14 +7,6 @@ export class TelegramBot { private pipelineExecutor: PipelineExecutor; private activePipelines: Map = new Map(); - private stepCallbacks: Map< - string, - ( - stepName: string, - status: 'started' | 'completed', - result?: string, - ) => Promise - > = new Map(); constructor(token: string, mcpServerUrl: string) { this.bot = new Telegraf(token); @@ -110,9 +102,6 @@ export class TelegramBot { }, ], }; - const pipelineId = `pipeline_${Date.now()}_${chatId}`; - const stepCallback = this.setupStepCallback(pipelineId, chatId); - this.stepCallbacks.set(pipelineId, stepCallback); this.activePipelines.set(chatId, { pipeline: userPipeline, chatId }); await ctx.sendChatAction('typing'); @@ -123,20 +112,16 @@ export class TelegramBot { variables: {}, systemPrompts: [], openAIApiKey: process.env.OPENAI_API_KEY || '', - onStepStart: async (stepName) => { - await stepCallback(stepName, 'started'); + onStepStart: async (_stepName) => { await ctx.sendChatAction('typing'); }, - onStepComplete: async (stepName, result, isLastStep) => { - // Skip the completion notification for the last step as it will be sent as the final response + onStepComplete: async (_stepName, _result, isLastStep) => { if (!isLastStep) { - await stepCallback(stepName, 'completed', result); + await ctx.sendChatAction('typing'); } }, }); - this.stepCallbacks.delete(pipelineId); - const lastResult = results[results.length - 1]; if (lastResult) { // remove ``` in start and ``` in end