Removed callbacks
This commit is contained in:
1 parent
0591fb80a4
commit
52a78c7119
1 file changed
+3
-18
+3
-18
@@ -7,14 +7,6 @@ export class TelegramBot {
|
||||
private pipelineExecutor: PipelineExecutor;
|
||||
private activePipelines: Map<number, { pipeline: Pipeline; chatId: number }> =
|
||||
new Map();
|
||||
private stepCallbacks: Map<
|
||||
string,
|
||||
(
|
||||
stepName: string,
|
||||
status: 'started' | 'completed',
|
||||
result?: string,
|
||||
) => Promise<void>
|
||||
> = 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
|
||||
|
||||
Reference in new issue
Block a user