Skip to content

Commit

Permalink
hotfix pdf command
Browse files Browse the repository at this point in the history
  • Loading branch information
fegloff committed Oct 18, 2023
1 parent 1911a42 commit 1a0c902
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/modules/llms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
) {
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit 1a0c902

Please sign in to comment.