L-GEVITY
L-GEVITY는 혈액수치·피트니스·바이오마커·스마트 알고리즘 기반 생활습관 조정으로 현재·미래 건강을 측정·향상하는 플랫폼
아직 감지된 업데이트가 없습니다. GitHub 릴리스가 나오면 여기에 보입니다.
Calorie tracking bot in Telegram.
저장소 README에서 가져옴
README 전체를 불러오는 중입니다.
README 전문 보기 ↗A Telegram bot for conversational calorie tracking with AI-powered food estimation.
Describe what you ate in natural language, and TeleCal estimates the calories and protein using AI (OpenAI, Anthropic, or Google Gemini).
/ with a Request access button that deep-links into the bot/app# Clone the repository
git clone https://github.com/yourusername/telecal.git
cd telecal
# Install dependencies
bun install
# Copy environment template
cp .env.example .env
# Edit .env with your configuration
Edit .env with your settings:
# Required
TELEGRAM_BOT_TOKEN=your_bot_token
# Admin users (comma-separated Telegram IDs)
ADMIN_USERS=123456789
# AI Providers (at least one required)
OPENAI_API_KEY=sk-...
ANTHROPIC_API_KEY=sk-ant-...
GOOGLE_API_KEY=AIza...
# Web server for Mini App
APP_URL=http://localhost:3000
PORT=3000
# Feature flags
FEATURE_CACHING=true
FEATURE_LOCAL_FOOD_DB=false
# Development (with hot reload)
bun run dev
# Production
bun run start
| Command | Description |
|---|---|
/start | Welcome message and command list |
/log | Start logging food |
/today | View today's calories and protein |
/week | View past 7 days |
/month | View past 30 days |
/edit | Edit a logged entry |
/delete | Delete a logged entry |
/settings | Change AI provider, calorie and protein goals, reminders |
/pending | View entries awaiting AI processing |
/usage | View your own AI token usage |
/admin | Manage allowed users and access requests, view AI usage and cost, backfill protein (admin only) |
Food descriptions are sent to whichever AI provider the user has selected in
/settings (OpenAI, Anthropic, or Google) to estimate calories and protein.
The one-off /admin backfill-protein command sends the descriptions of items logged before protein tracking existed to the admin's selected provider, not each user's.
TeleCal disables server-side retention where the provider offers the option —
OpenAI calls are made with store: false, so requests are not kept in the
OpenAI organization's logs. Providers may still retain request content
separately for abuse monitoring under their own policies.
Calorie data itself is stored in TeleCal's local SQLite database.
TeleCal uses PostHog Cloud (US region) for error tracking and analytics. Decisions and reasoning are in ADR 0001. PostHog receives:
Users are identified by an HMAC-SHA256 of their Telegram ID, keyed with a
server-side secret (POSTHOG_ID_SECRET). Raw Telegram IDs, usernames and names
are never sent, and no person properties are set. Every event carries an
environment tag (production or development).
Meal text opt-out. /settings → Meal Text Sharing (on by default,
users.analytics_content) keeps a user's text out of PostHog: their
$ai_generation events drop $ai_input, $ai_output_choices and
$ai_error, and their error reports keep the error type and stack frames but
not the message. Token counts, cost and latency are still sent. Errors not
tied to a user (process-level crashes) are sent as they are.
Existing users were told with a one-time message (/admin announce-privacy);
/start and the landing page FAQ link to the same summary.
Deleting a user's data. On request, run /admin posthog-id <telegram_id>
to get the user's PostHog ID, then in PostHog open People, search for that
ID, and delete the person. Deleting a person also deletes their events.
/log to start a sessionsrc/web/public/ holds the landing page's images. To regenerate them (macOS, needs Google Chrome):
scripts/screenshots/ as shot-log, shot-today and shot-charts (any image format).bash scripts/build-landing-assets.sh. It renders og.png from scripts/og.html and writes 720 px JPEGs.src/web/public/.# Run all tests
bun test
# Run tests in a specific directory
bun test src/ai
# Run a specific test file
bun test src/db/repositories/users.test.ts
src/
├── index.ts # Entry point
├── config.ts # Environment configuration
├── bot/ # Telegram bot
│ ├── commands/ # Command handlers
│ ├── conversations/# Log flow state machine
│ └── middleware/ # Allowlist access control
├── ai/ # AI service layer
│ ├── service.ts # Provider abstraction
│ └── providers/ # OpenAI, Anthropic, Gemini
├── db/ # SQLite database
│ ├── schema.sql # Database schema
│ └── repositories/ # Data access layer
├── web/ # Landing page and Mini App web server
│ ├── server.ts # Bun HTTP server
│ ├── auth.ts # Telegram auth validation
│ ├── public/ # Landing page images (served at /assets/*)
│ └── views/ # landing.html, app.html
└── jobs/ # Background jobs
├── reminders.ts # Daily notifications
└── retry-pending.ts # Retry failed AI calls
MIT