Context
All three edge functions (reflection, french-feedback, french-chat) currently receive lang to build a dynamic USER CONTEXT block. The next step is to also pass per-user stats so the model can calibrate its responses more precisely.
What to pass from the frontend
userContext: {
totalEntries: totalDays, // from useJournal()
totalWords, // from useJournal()
streak, // from useJournal()
lang, // already wired
}
What to do in the edge functions
const level = totalEntries < 5 ? 'complete beginner'
: totalEntries < 20 ? 'early learner'
: 'developing learner';
// Inject into USER CONTEXT block:
// - French level: ${level} (${totalEntries} journal entries)
// - Total words written: ${totalWords}
// - Current streak: ${streak} days
Files to change
src/components/journal/ReflectionScreen.tsx
src/components/journal/FeedbackScreen.tsx
src/components/journal/ChatScreen.tsx
supabase/functions/reflection/index.ts
supabase/functions/french-feedback/index.ts
supabase/functions/french-chat/index.ts
Context
All three edge functions (reflection, french-feedback, french-chat) currently receive
langto build a dynamic USER CONTEXT block. The next step is to also pass per-user stats so the model can calibrate its responses more precisely.What to pass from the frontend
What to do in the edge functions
Files to change
src/components/journal/ReflectionScreen.tsxsrc/components/journal/FeedbackScreen.tsxsrc/components/journal/ChatScreen.tsxsupabase/functions/reflection/index.tssupabase/functions/french-feedback/index.tssupabase/functions/french-chat/index.ts