From 1a0c902b11cbbd54c3aa606c9d6cf11c6531a023 Mon Sep 17 00:00:00 2001 From: fegloff Date: Tue, 17 Oct 2023 23:56:40 -0500 Subject: [PATCH] hotfix pdf command --- src/modules/llms/index.ts | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/modules/llms/index.ts b/src/modules/llms/index.ts index 91d2862..5e1dbc6 100644 --- a/src/modules/llms/index.ts +++ b/src/modules/llms/index.ts @@ -110,6 +110,12 @@ export class LlmsBot implements PayableBot { await this.onPrefix(ctx, LlmsModelsEnum.BISON) return } + + if (ctx.hasCommand(SupportedCommands.pdf.name)) { + await this.onPdfCommand(ctx) + return + } + if (ctx.hasCommand(SupportedCommands.bard.name) || ctx.hasCommand(SupportedCommands.bardF.name)) { await this.onChat(ctx, LlmsModelsEnum.BISON) return @@ -140,11 +146,6 @@ export class LlmsBot implements PayableBot { return } - if (ctx.hasCommand(SupportedCommands.pdf.name)) { - await this.onPdfCommand(ctx) - return - } - if (ctx.hasCommand(SupportedCommands.sum.name) || (ctx.message?.text?.startsWith('sum ') && ctx.chat?.type === 'private') ) { @@ -197,7 +198,12 @@ export class LlmsBot implements PayableBot { return } const filename = ctx.message?.reply_to_message?.document?.file_name ?? '' - const prompt = ctx.message?.text ?? 'Summarize this context' + let prompt = '' + if (ctx.match) { + prompt = ctx.match as string + } else { + prompt = 'Summarize this context' + } if (filename !== '' && ctx.chat?.id) { const collection = ctx.session.collections.activeCollections.find(c => c.fileName === filename) if (collection) {