- Add continuous guided light-body-scan meditation (16 segments, 97% coverage) - Edge TTS API endpoint with Xiaoxiao neural voice at -40% rate - Pre-generated chime WAVs and guidance MP3s in public/audio/ - Mute toggle in practice page, sequenced non-overlapping audio - Fix middleware to serve /audio and /api/audio/tts without auth - All LLM output localized to Chinese; fix blank home/settings pages - DeepSeek API compat: json_object, increased max_tokens - Analytics, cron reminders, onboarding flow fixes Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
22 lines
499 B
TypeScript
22 lines
499 B
TypeScript
import { prisma } from "@/lib/prisma";
|
|
|
|
type EventName = "session_completed" | "task_generated" | "onboarding_completed";
|
|
|
|
export async function logEvent(
|
|
userId: string,
|
|
event: EventName,
|
|
metadata: Record<string, unknown> = {}
|
|
): Promise<void> {
|
|
try {
|
|
await prisma.analyticsEvent.create({
|
|
data: {
|
|
userId,
|
|
event,
|
|
metadata: JSON.stringify(metadata),
|
|
},
|
|
});
|
|
} catch (err) {
|
|
console.error("[analytics] Failed to log event:", event, err);
|
|
}
|
|
}
|