Skip to content

Commit

Permalink
Merge pull request #370 from harmony-one/grok-bot
Browse files Browse the repository at this point in the history
Grok bot
  • Loading branch information
fegloff authored Oct 27, 2024
2 parents e00cffa + 36955f5 commit 1118040
Show file tree
Hide file tree
Showing 20 changed files with 737 additions and 222 deletions.
8 changes: 4 additions & 4 deletions src/bot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ import { createInitialSessionData, addQuotePrefix, markdownToTelegramHtml } from
import { LlamaAgent } from './modules/subagents'
import { llmModelManager } from './modules/llms/utils/llmModelsManager'
import { HmnyBot } from './modules/hmny'
import { XaiBot } from './modules/llms/xaiBot'

Events.EventEmitter.defaultMaxListeners = 30

Expand Down Expand Up @@ -185,10 +186,7 @@ bot.use(async (ctx: BotContext, next: NextFunction): Promise<void> => {

bot.use(
session({
initial: () => {
logger.info('Creating new session')
return createInitialSessionData()
},
initial: createInitialSessionData,
storage: enhanceStorage<BotSessionData>({
storage: new MemorySessionStorage<Enhance<BotSessionData>>(),
millisecondsToLive: config.sessionTimeout * 60 * 60 * 1000 // 48 hours
Expand All @@ -211,6 +209,7 @@ const openAiBot = new OpenAIBot(payments, [llamaAgent])
const dalleBot = new DalleBot(payments)
const claudeBot = new ClaudeBot(payments)
const vertexBot = new VertexBot(payments, [llamaAgent])
const xaiBot = new XaiBot(payments)
const oneCountryBot = new OneCountryBot(payments)
const translateBot = new TranslateBot()
const telegramPayments = new TelegramPayments(payments)
Expand Down Expand Up @@ -340,6 +339,7 @@ const PayableBots: Record<string, PayableBotConfig> = {
dalleBot: { bot: dalleBot },
claudeBot: { bot: claudeBot },
vertexBot: { bot: vertexBot },
aixBot: { bot: xaiBot },
openAiBot: {
enabled: (ctx: OnMessageContext) => ctx.session.dalle.isEnabled,
bot: openAiBot
Expand Down
6 changes: 3 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default {
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',
model: 'gpt-4o',
minimumBalance: 0,
isEnabled: Boolean(parseInt(process.env.LLMS_ENABLED ?? '1')),
pdfUrl: process.env.PDF_URL ?? '',
Expand All @@ -49,7 +49,7 @@ export default {
telegramFileUrl: 'https://api.telegram.org/file/bot',
completions: {
temperature:
(parseInt(process.env.OPENAI_TEMPERATURE ?? '')) ??
(parseFloat(process.env.OPENAI_TEMPERATURE ?? '')) ??
0.8
},
defaultPrompt:
Expand Down Expand Up @@ -154,7 +154,7 @@ export default {
maxChatsWhitelist: (process.env.CREDITS_CHATS_WHITELIST ?? '')
.split(',')
.map((item) => item.toString().toLowerCase()),
creditsAmount: '100'
creditsAmount: '100' // todo: handle multiple credits numbers (+ dateSince), considering future number change.
},
betteruptime: { botHeartBitId: process.env.BOT_HEARTBIT_ID ?? '' },
telegramPayments: { token: process.env.TELEGRAM_PAYMENTS_TOKEN ?? '' },
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ export const PROMPTS = {
}

export const VOICE_MEMO_FORWARDING = {
enabled: 'Voice note forwarding is now active. The next voice note you send will be forwarded automatically. This setting will deactivate after forwarding one voice note.',
enabled: 'Voice note forwarding is now active. The next voice note you send will be processed automatically. This setting will deactivate after processing the voice note.',
restricted: 'Sorry, voice note forwarding can only be enabled by admin users. If you need this feature, please contact an admin for assistance.'
}

Expand Down
Loading

0 comments on commit 1118040

Please sign in to comment.