How ymffuture/sonatg works
SonaTG is a chat application with an “Ask Sona” message-intelligence feature. The main user flow is entering the authenticated chat, viewing and acting on messages, and optionally asking Sona about a message; other product areas include calls, classroom polls, moderation, administration, and billing. The tree and excerpts support several links, but most feature files were not sampled, so the graph omits unverified wiring rather than implying a complete runtime sequence.
Main entry points: SonaChat.tsx Chat interface · client.ts Supabase client · useMessageModeration.ts Moderation check · CallManager.tsx Voice and video calls
Components 22
Chat experience
- Chat interface
src/components/SonaChat.tsx - Message actions
src/components/MessageBubble.tsx - Voice and video calls
src/components/CallManager.tsx - Call overlay
src/components/CallOverlay.tsx - Message threads
src/components/chat/ThreadPanel.tsx
AI and moderation
- Ask Sona panel
src/components/AskSonaPanel.tsx - Message intelligence
src/lib/messageIntelligence.functions.ts - AI gateway
src/lib/ai.functions.ts - Moderation check
src/features/moderation/useMessageModeration.ts - Local detection
src/features/moderation/detectionEngine.ts - Blocked-word rules
src/features/moderation/blockedWords.ts - AI moderation
src/features/moderation/aiModeration.functions.ts - Verdict merging
src/features/moderation/mergeVerdicts.ts
Identity and data
- Sign-in
src/routes/auth.tsx - Authenticated routes
src/routes/_authenticated/route.tsx - Supabase client
src/integrations/supabase/client.ts - Preview auth storage
src/integrations/supabase/previewAuthStorage.ts - Application database access
src/lib/db.ts
Product features
- Classroom polls
src/features/classroom - Administration
src/features/adimn/admin.tsx - Billing and plans
src/routes/billing.tsx
Other components
- Chat user
Connections 18
- Chat user → Sign-in: signs in
src/routes/auth.tsx - Sign-in → Supabase client: checks session
src/routes/auth.tsx - Chat user → Authenticated routes: opens protected area
- Authenticated routes → Supabase client: validates user
src/routes/_authenticated/route.tsx - Supabase client → Preview auth storage: configures storage
src/integrations/supabase/client.ts - Chat user → Chat interface: uses chat
- Chat interface → Message actions: renders messages
README.md - Message actions → Chat interface: raises Ask Sona action
README.md - Chat interface → Ask Sona panel: renders panel
README.md - Ask Sona panel → Message intelligence: requests answer
- Message intelligence → AI gateway: reuses gateway
README.md - Moderation check → Local detection: evaluates message
src/features/moderation/useMessageModeration.ts - Local detection → Blocked-word rules: loads word rules
src/features/moderation/detectionEngine.ts - Moderation check → AI moderation: requests classification
src/features/moderation/useMessageModeration.ts - Moderation check → Verdict merging: merges verdicts
src/features/moderation/useMessageModeration.ts - Verdict merging → AI moderation: uses classifier result
src/features/moderation/mergeVerdicts.ts - Voice and video calls → Supabase client: uses realtime client
src/components/CallManager.tsx - Voice and video calls → Call overlay: renders overlay
src/components/CallManager.tsx