Context
Pupils and students need an assistant that generates lectures, homework, essays, and helps with exam prep right inside Telegram. The bot has no graphical UI — all interaction happens in chat, so editing a button label or a prompt without an admin panel would mean a release. The brief called for a complete product: the bot, an AI content-generation pipeline, PDF delivery, and a control plane for admins.
Solution
We built the entire project. The bot runs in Telegram and walks the user through registration, profile, subscription, and AI-operation flows. The AI pipeline on Spring AI generates lectures, homework, essays, and exam prep via OpenAI, tracks token consumption, and accounts for each operation. The PDF renderer on Apache pdfbox + jlatexmath delivers the result as a file with handwriting fonts and formula support. The admin panel provides a control plane: all of the bot's user-facing strings live in a BotMessage collection with categories (General / Registration / Profile / Subscription / Lectures / Exam Prep / …) — texts, emojis, placeholders, and attached photos are edited by the admin without a release. The same applies to plans, AI-operation prompts, and models with their temperature and points cost.
Stack and architecture
- Backend: Spring Boot, Spring AI (OpenAI: gpt-4o / gpt-4-turbo / gpt-3.5-turbo, embeddings), MongoDB, pengrad Telegram Bot API.
- PDF: Apache pdfbox + jlatexmath for formulas and handwritten fonts.
- Admin frontend: Next.js 16 (App Router), a separate SPA with
messages/plans/prompts/models/users/fonts/tokens/broadcast/generation-actionssections. - Analytics: token-consumption tracking per operation, USD pricing per MTok.
Role and outcome
We built the whole project — from the Telegram bot and AI pipeline to PDF generation and the live-editing admin panel. Tests cover the domain logic and BotMessageService; the change history of keys is recorded in the collection and visible in the admin panel. The client received a turnkey educational product in which content and pricing can be changed without releases.