diff --git a/src/modules/llms/index.ts b/src/modules/llms/index.ts index 91d2862a..5e1dbc62 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) {