feat(matrix-nutriphi-bot): add Matrix bot for nutrition tracking

- NestJS bot with matrix-bot-sdk integration
- Commands: !help, !login, !analyze, !today, !week, !goals, !favorites, !tips
- Integrates with NutriPhi backend API (port 3023)
- User session management with JWT authentication
- Image analysis via Gemini AI (NutriPhi backend)
- Port 3316

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Till-JS 2026-01-28 15:57:49 +01:00
parent 111fc473d9
commit 57b9d4cb37
34 changed files with 3241 additions and 463 deletions

View file

@ -0,0 +1,48 @@
export default () => ({
port: parseInt(process.env.PORT || '3316', 10),
matrix: {
homeserverUrl: process.env.MATRIX_HOMESERVER_URL || 'http://localhost:8008',
accessToken: process.env.MATRIX_ACCESS_TOKEN || '',
allowedRooms: process.env.MATRIX_ALLOWED_ROOMS?.split(',').filter(Boolean) || [],
storagePath: process.env.MATRIX_STORAGE_PATH || './data/bot-storage.json',
},
nutriphi: {
backendUrl: process.env.NUTRIPHI_BACKEND_URL || 'http://localhost:3023',
apiPrefix: process.env.NUTRIPHI_API_PREFIX || '/api/v1',
},
auth: {
url: process.env.MANA_CORE_AUTH_URL || 'http://localhost:3001',
devBypass: process.env.DEV_BYPASS_AUTH === 'true',
devUserId: process.env.DEV_USER_ID || '',
},
});
export const HELP_MESSAGE = `**NutriPhi Bot - KI-Ernahrungsassistent**
**Befehle:**
- \`!help\` - Diese Hilfe anzeigen
- \`!login email passwort\` - Bei NutriPhi anmelden
- \`!analyze [beschreibung]\` - Foto/Text analysieren
- \`!today\` / \`heute\` - Tages-Zusammenfassung
- \`!week\` / \`woche\` - Wochen-Statistik
- \`!goals\` / \`ziele\` - Aktuelle Ziele
- \`!setgoals kalorien protein carbs fett\` - Ziele setzen
- \`!favorites\` / \`favoriten\` - Favoriten anzeigen
- \`!tips\` / \`tipps\` - KI-Empfehlungen
- \`!status\` - Bot-Status
**Bild-Analyse:**
1. Sende ein Foto deiner Mahlzeit
2. Dann: \`!analyze\` oder \`!analyze Spaghetti mit Sauce\`
**Beispiele:**
- "heute" - Zeigt Tages-Ubersicht
- \`!analyze Apfel und Banane\` - Analysiert Textbeschreibung
- \`!setgoals 2000 80 250 65\` - Setzt Tagesziele`;
export const MEAL_TYPE_LABELS: Record<string, string> = {
breakfast: 'Fruhstuck',
lunch: 'Mittagessen',
dinner: 'Abendessen',
snack: 'Snack',
};