Token Authentication
| Property | Value |
|---|---|
| Endpoint | generate_ai_token (Supabase edge function) |
| Method | POST with user JWT |
| Token Lifetime | 10 minutes (600 seconds) |
| Refresh Threshold | 3 minutes remaining |
| Storage | In memory only (not persisted) |
Credit System
Weekly CreditsReset periodically via weekly_reset_date
Bank CreditsPurchased credits, never expire
Deduction OrderWeekly first, then bank
Usage Trackingai_usage_in_seconds rounded up
Source: user_profile.json → ai_usage object
8 Data Payloads
Each voice chat request sends 8 multipart form data fields to worker1.ipnoelp.com:
1
audio_file
WAV 44.1kHz, max 2 min
2
course_progress
Audio usage per track
3
journal_responses
Workbook entries
4
user_context
Course + user name
5
conversation
Prior conversation JSON
6
voice
Preferred AI voice
7
session_id
UUID v4 per request
8
timestamp
ISO8601 timestamp
| Property | Value |
|---|---|
| Authorization | Bearer [AI Token] (not user JWT) |
| Content-Type | multipart/form-data |
| Timeout | 240 seconds (4 minutes) |
Process Flow (15 Steps)
Pre-Recording
1Check internet connectivity
2Check available credits
3Validate AI token
4Check microphone permission
Recording
5Start recording WAV 44.1kHz
6User stops or 2 min max
Processing
7Save audio file
8Collect all 8 payloads
9POST to voice-chat endpoint
10Rotate status text every 7s
Response
11Receive audio_url + credits + conversation
12Update credits, save conversation
13Download AI response audio
14Play response via just_audio
15Mark as replayable, return to idle
UI States
idle
"Press record button" • Mic glows • Replay link if available
recording
"Listening..." • Timer MM:SS • Stop icon
processing
"Sending..." then rotating words • Loading dots
playback
"Replying..." • Waveform animation
Recording Modes
| Mode | Activation | Behavior |
|---|---|---|
| Tap (Default) | Tap mic button | Tap again to stop and send. Max 2 min. |
| Hold | Press and hold 500ms+ | Release to stop and send immediately. |
File Storage
| Purpose | Path |
|---|---|
| Recording (temp) | [temp]/voice_recording_[timestamp].wav |
| AI Response | AppData/AI_Voice_Responses/response_[timestamp].wav |
| Conversation | AppData/JSONs/Conversations/[CourseCode]_conversation.json |
| Audio Usage | AppData/JSONs/User_Audio_Usage/[CourseCode]_Usage.json |
| Journal | AppData/JSONs/User_Workbook_Responses/[CourseCode]1_response.json |
| User Profile | AppData/JSONs/user_profile.json |