Skip to content

Commit 1118040

Browse files
authored
Merge pull request #370 from harmony-one/grok-bot
Grok bot
2 parents e00cffa + 36955f5 commit 1118040

File tree

20 files changed

+737
-222
lines changed

20 files changed

+737
-222
lines changed

src/bot.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ import { createInitialSessionData, addQuotePrefix, markdownToTelegramHtml } from
5959
import { LlamaAgent } from './modules/subagents'
6060
import { llmModelManager } from './modules/llms/utils/llmModelsManager'
6161
import { HmnyBot } from './modules/hmny'
62+
import { XaiBot } from './modules/llms/xaiBot'
6263

6364
Events.EventEmitter.defaultMaxListeners = 30
6465

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

186187
bot.use(
187188
session({
188-
initial: () => {
189-
logger.info('Creating new session')
190-
return createInitialSessionData()
191-
},
189+
initial: createInitialSessionData,
192190
storage: enhanceStorage<BotSessionData>({
193191
storage: new MemorySessionStorage<Enhance<BotSessionData>>(),
194192
millisecondsToLive: config.sessionTimeout * 60 * 60 * 1000 // 48 hours
@@ -211,6 +209,7 @@ const openAiBot = new OpenAIBot(payments, [llamaAgent])
211209
const dalleBot = new DalleBot(payments)
212210
const claudeBot = new ClaudeBot(payments)
213211
const vertexBot = new VertexBot(payments, [llamaAgent])
212+
const xaiBot = new XaiBot(payments)
214213
const oneCountryBot = new OneCountryBot(payments)
215214
const translateBot = new TranslateBot()
216215
const telegramPayments = new TelegramPayments(payments)
@@ -340,6 +339,7 @@ const PayableBots: Record<string, PayableBotConfig> = {
340339
dalleBot: { bot: dalleBot },
341340
claudeBot: { bot: claudeBot },
342341
vertexBot: { bot: vertexBot },
342+
aixBot: { bot: xaiBot },
343343
openAiBot: {
344344
enabled: (ctx: OnMessageContext) => ctx.session.dalle.isEnabled,
345345
bot: openAiBot

src/config.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export default {
3636
apiEndpoint: process.env.LLMS_ENDPOINT, // // process.env.LLMS_ENDPOINT, // 'http://127.0.0.1:5000',
3737
apiKey: process.env.LLMS_API_KEY ?? '',
3838
wordLimit: 50,
39-
model: 'chat-bison',
39+
model: 'gpt-4o',
4040
minimumBalance: 0,
4141
isEnabled: Boolean(parseInt(process.env.LLMS_ENABLED ?? '1')),
4242
pdfUrl: process.env.PDF_URL ?? '',
@@ -49,7 +49,7 @@ export default {
4949
telegramFileUrl: 'https://api.telegram.org/file/bot',
5050
completions: {
5151
temperature:
52-
(parseInt(process.env.OPENAI_TEMPERATURE ?? '')) ??
52+
(parseFloat(process.env.OPENAI_TEMPERATURE ?? '')) ??
5353
0.8
5454
},
5555
defaultPrompt:
@@ -154,7 +154,7 @@ export default {
154154
maxChatsWhitelist: (process.env.CREDITS_CHATS_WHITELIST ?? '')
155155
.split(',')
156156
.map((item) => item.toString().toLowerCase()),
157-
creditsAmount: '100'
157+
creditsAmount: '100' // todo: handle multiple credits numbers (+ dateSince), considering future number change.
158158
},
159159
betteruptime: { botHeartBitId: process.env.BOT_HEARTBIT_ID ?? '' },
160160
telegramPayments: { token: process.env.TELEGRAM_PAYMENTS_TOKEN ?? '' },

src/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ export const PROMPTS = {
287287
}
288288

289289
export const VOICE_MEMO_FORWARDING = {
290-
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.',
290+
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.',
291291
restricted: 'Sorry, voice note forwarding can only be enabled by admin users. If you need this feature, please contact an admin for assistance.'
292292
}
293293

0 commit comments

Comments
 (0)