From f22e89a461135405d9e6b0f2f8105c662b10e787 Mon Sep 17 00:00:00 2001 From: Vufer Date: Mon, 30 Jun 2025 20:36:59 +0300 Subject: [PATCH] =?UTF-8?q?fix(bot):=20=D1=83=D0=B1=D1=80=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BE=D1=82=D0=BB=D0=B0=D0=B4=D0=BE=D1=87=D0=BD=D1=8B?= =?UTF-8?q?=D0=B5=20console.log=20=D0=B8=20=D0=B7=D0=B0=D0=BA=D0=BE=D0=BC?= =?UTF-8?q?=D0=BC=D0=B5=D0=BD=D1=82=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D1=82?= =?UTF-8?q?=D1=8C=20=D0=BA=D0=BE=D0=BC=D0=B0=D0=BD=D0=B4=D1=8B=20summary?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Удалены лишние console.log для чистоты вывода и закомментирован блок команд summary_day, summary_hours и summary_last для временного отключения их обработки. --- bot.js | 82 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 41 insertions(+), 41 deletions(-) diff --git a/bot.js b/bot.js index cada945..b990119 100644 --- a/bot.js +++ b/bot.js @@ -75,7 +75,7 @@ class TelegramHistoryBot { const trimmed = args.trim(); // удаляет лишние пробелы по краям, если нужно logger.info('📊 Получена команда /summy с запросом: ' + trimmed); let request = await callAI('', trimmed, 'request'); -console.log('получили отвкт: ', typeof request, request) + if (typeof request === 'string') { try { @@ -84,7 +84,7 @@ console.log('получили отвкт: ', typeof request, request) request = {persona: "Карл Маркс", messages: 22, hours: 0}; } } -console.log('ищем персону') + let prompt = await searchInPrompts(request["persona"]) if (!prompt) { logger.info('⚠️ Не найден подходящий prompt для запроса, генерируем...') @@ -93,54 +93,54 @@ console.log('ищем персону') } else { logger.info('✅ Найден подходящий prompt для запроса') } - //handleSummaryCommand + const options = {persona:request["persona"], promptToUse:prompt} if (request["messages"]>0) { await this.handleSummaryCommand(ctx, 'last', request["messages"], options); } else { await this.handleSummaryCommand(ctx, 'hours', request["hours"], options); } - //await ctx.reply(prompt) + }); // Команды суммаризации - должны быть ДО обработки обычных сообщений - this.bot.command('summary_day', async (ctx) => { - // if (!this.isAdmin(ctx)) { - // await ctx.deleteMessage - // return - // } - logger.info('📊 Получена команда summary_day'); - const args = ctx.message.text.split(' '); - if (args.length > 1) { - char.name=args[1] - } - await ctx.deleteMessage() - await this.handleSummaryCommand(ctx, 'day'); - }); - - this.bot.command('summary_hours', async (ctx) => { - logger.info('📊 Получена команда summary_hours'); - const args = ctx.message.text.split(' '); - if (args.length < 2 || isNaN(parseInt(args[1]))) { - await ctx.reply('❗ Укажите количество часов: /summary_hours 6'); - return; - } - const hours = parseInt(args[1]); - await ctx.deleteMessage() - await this.handleSummaryCommand(ctx, 'hours', hours); - }); - - this.bot.command('summary_last', async (ctx) => { - logger.info('📊 Получена команда summary_last'); - const args = ctx.message.text.split(' '); - if (args.length < 2 || isNaN(parseInt(args[1]))) { - await ctx.reply('❗ Укажите количество сообщений: /summary_last 50'); - return; - } - const count = parseInt(args[1]); - await ctx.deleteMessage() - await this.handleSummaryCommand(ctx, 'last', count); - }); + // this.bot.command('summary_day', async (ctx) => { + // // if (!this.isAdmin(ctx)) { + // // await ctx.deleteMessage + // // return + // // } + // logger.info('📊 Получена команда summary_day'); + // const args = ctx.message.text.split(' '); + // if (args.length > 1) { + // char.name=args[1] + // } + // await ctx.deleteMessage() + // await this.handleSummaryCommand(ctx, 'day'); + // }); + // + // this.bot.command('summary_hours', async (ctx) => { + // logger.info('📊 Получена команда summary_hours'); + // const args = ctx.message.text.split(' '); + // if (args.length < 2 || isNaN(parseInt(args[1]))) { + // await ctx.reply('❗ Укажите количество часов: /summary_hours 6'); + // return; + // } + // const hours = parseInt(args[1]); + // await ctx.deleteMessage() + // await this.handleSummaryCommand(ctx, 'hours', hours); + // }); + // + // this.bot.command('summary_last', async (ctx) => { + // logger.info('📊 Получена команда summary_last'); + // const args = ctx.message.text.split(' '); + // if (args.length < 2 || isNaN(parseInt(args[1]))) { + // await ctx.reply('❗ Укажите количество сообщений: /summary_last 50'); + // return; + // } + // const count = parseInt(args[1]); + // await ctx.deleteMessage() + // await this.handleSummaryCommand(ctx, 'last', count); + // }); // Команды помощи //this.bot.command('summary_help', async (ctx) => await this.sendHelp(ctx));