Skip to content

Commit

Permalink
remove translate prefixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fegloff committed May 3, 2024
1 parent 6d14ef0 commit 4b7194e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default {
? parseInt(process.env.SESSION_TIMEOUT)
: 48, // in hours
llms: {
apiEndpoint: 'http://127.0.0.1:5000', // // process.env.LLMS_ENDPOINT, // 'http://127.0.0.1:5000',
apiEndpoint: process.env.LLMS_ENDPOINT, // // process.env.LLMS_ENDPOINT, // 'http://127.0.0.1:5000',
apiKey: process.env.LLMS_API_KEY ?? '',
wordLimit: 50,
model: 'chat-bison',
Expand Down
24 changes: 12 additions & 12 deletions src/modules/translate/TranslateBot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ export class TranslateBot implements PayableBot {
return true
}

const hasShortcut = this.isCtxHasLangShortcut(ctx)
// const hasShortcut = this.isCtxHasLangShortcut(ctx)
const hasLangCommand = this.isCtxHasLangCommand(ctx)

// en. de. ru. || /en /de /ru
if (hasShortcut || hasLangCommand) {
if (hasLangCommand) {
return true
}

Expand Down Expand Up @@ -120,18 +120,18 @@ export class TranslateBot implements PayableBot {
return
}

if (this.isCtxHasLangShortcut(ctx)) {
const langCode = ctx.message.text.split('.')[0] || null
// if (this.isCtxHasLangShortcut(ctx)) {
// const langCode = ctx.message.text.split('.')[0] || null

if (!langCode) {
await ctx.reply('Unexpected error')
return
}
// if (!langCode) {
// await ctx.reply('Unexpected error')
// return
// }

const message = ctx.message.reply_to_message?.text ?? ctx.message.text.slice(langCode.length + 1, ctx.message.text.length).trim()
await this.translateMessage(ctx, message, langCode)
return
}
// const message = ctx.message.reply_to_message?.text ?? ctx.message.text.slice(langCode.length + 1, ctx.message.text.length).trim()
// await this.translateMessage(ctx, message, langCode)
// return
// }

const isPlainText = !this.isCtxHasAnyCommand(ctx)

Expand Down

0 comments on commit 4b7194e

Please sign in to comment.