Two features in one push (both backend, deploy together):
LYRA FOUNDER-STORY (per strategist Option C — mixed/medium-detail):
- COACH_CASUAL_SYSTEM_PROMPT: GRÜNDER-STORY sub-block
- Sharing-rules: ALWAYS on direct ask, RARELY proactive (only on
explicit isolation expressions "niemand versteht das"), NEVER in
SOS-mode, NEVER first-3-msgs, NEVER if user appears minor
- Detail-level: "aus persönlicher Erfahrung mit Spielsucht in seiner
Familie" — KEINE Namen, Verwandtschaftsgrade, Verlust-Details
- Post-share-pivot: "...aber jetzt zu dir: was ist gerade los?"
- COACH_SYSTEM_PROMPT (SOS): SOS-MODE LOCK — hard-Verbot Gründer-Story
zu erwähnen, auch bei direct-ask. Re-trigger-Risk zu hoch.
- DSGVO: brother bleibt komplett anonymisiert. Hans-Müller-DSB-review für
verbal-consent-doc empfohlen.
VOICE TIER-MAPPING (per user-decision: voice für ALLE tiers):
- New plan-features.voice config: provider + model + voiceId + dailyQuotaSeconds
- Tier-mapping:
- Free → Google TTS Neural2-F (de-DE), 60s/day, ~$4/1M chars
- Pro → Cartesia Sonic-2, 300s/day, ~$4/1M chars + ~75ms TTFT
- Legend → ElevenLabs Turbo v2.5, unlimited, ~$30/1M chars
- New backend/server/db/voiceQuota.ts:
- getRemainingVoiceQuota(userId, plan)
- consumeVoiceQuota(userId, seconds)
- estimateAudioSeconds(text)
- speak.post.ts komplett umgeschrieben als plan-aware dispatcher
- 14 tests passing (partial-consume, exhausted, day-rollover, edge-cases)
- Schema-migration 20260509_voice_quota:
ADD voice_seconds_used_today, voice_quota_reset_at to profiles
(auto-deploy via pipeline)
Pending Frontend (separate task):
- Voice-quota-UI in Settings/Profile (remaining seconds + upgrade-prompt
bei 429 quota_exceeded)
⚠️ Schema-migration auto-deploy via b38bf17 detection.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
16 lines
744 B
SQL
16 lines
744 B
SQL
-- Voice Quota — additive migration (idempotent via IF NOT EXISTS)
|
|
--
|
|
-- Adds two columns to profiles for tracking daily TTS usage per user.
|
|
-- Plan limits (from plan-features.ts): Free=60s/day, Pro=300s/day, Legend=0 (unlimited).
|
|
--
|
|
-- Cost baseline (2026-05):
|
|
-- Free → Google TTS Neural2 ~$4/1M chars
|
|
-- Pro → Cartesia Sonic-2 ~$4/1M chars, ~75ms first-byte
|
|
-- Legend → ElevenLabs Turbo v2.5 ~$30/1M chars (unlimited — no quota tracking)
|
|
--
|
|
-- Deploy: pnpm prisma migrate deploy (auto via GH-Actions pipeline on push to main)
|
|
|
|
ALTER TABLE "rebreak"."profiles"
|
|
ADD COLUMN IF NOT EXISTS "voice_seconds_used_today" INTEGER NOT NULL DEFAULT 0,
|
|
ADD COLUMN IF NOT EXISTS "voice_quota_reset_at" TIMESTAMP(3);
|