feat: app-wide, page-context-aware chatbot#173
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
🚅 Deployed to the TalkUp.AI-pr-173 environment in talk-up-ai
|
Andriamanampisoa
approved these changes
Jul 15, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this? (check all applicable)
Description
Makes the chatbot app-wide and aware of the page it's on (#197). The floating assistant now appears on every authenticated page and grounds its answers in the current surface's real data — e.g. on a roadmap it can explain a topic or suggest talking points; on the agenda it can tell the user their next scheduled event.
Security (reuses the #154 pattern)
The client sends identifiers only (
{ surface, applicationId?, interviewId? }), never a data blob. The server resolves the actual data from those ids through owner-guarded loaders, so a caller can only ground on their own data — no prompt-injection surface. A resolution failure (foreign/missing id, no data) degrades to an ungrounded reply rather than failing the chat.Server
POST /ai/chatnow takes@UserId()and is rate-limited: added@UseGuards(ThrottlerGuard)+@Throttle(20/min per user) — the class-levelAccessTokenGuardruns first soreq.userIdis set (it was previously an unthrottled, user-less route).ChatDtogains an optionalcontext(aChatSurfaceenum + optional owned ids).resolveChatContext(context, userId)dispatches per surface to existing owner-guarded services —applicationsService.getRoadmap/ensureCvSnapshot,getInterviewById+ verbal analysis (latest interview for the application when no interview id),agendaService.listForRange(next 30 days),notesService.findAll(scoped by application when given) — and the resolved block is appended to the system prompt.chat-context.tscompactors turn owned rows into short, plain-text, char-capped blocks (never raw JSON).AiModulenow importsAgendaModule+NotesModule. Brunopost chat.brushows thecontextfield.Web
ChatWidgetmounts once app-wide from__root.tsx(authenticated shell only) and derives its context from the current route via a newuseChatContexthook (roadmap / simulation / agenda / notes+scope / cv). It forwards that context to/ai/chat./ai-chatbecomes the assistant's landing page; the widget itself is global, so the page no longer mounts its own copy.Verification
Browser-verified (Playwright, auth+data mocked): the FAB floats on the roadmap page, opening it and sending a message posts
context: { surface: 'roadmap', applicationId }to/ai/chat; the Assistant nav entry is visible. Server 900 tests (format/lint/buildclean); web 1224 tests (tsc -b/lint/vite buildclean). New unit coverage: per-surface context resolution + degrade-on-failure (service), thechat-contextformatters, theuseChatContextroute mapping, the widget forwarding context, and the throttle-guard metadata.Deliberately out of scope (follow-up)
A persistent chat "bank" (saved conversations + history/continue UI) is a separate, larger feature — the chat is stateless today. Filed as a follow-up issue so this PR stays focused on context-awareness, per the issue's own scope note.
Linked GitHub Ticket
Closes EpitechPromo2027/G-EIP-600-NAN-6-1-eip-tugdual.de-reviers#197
Workspace
Screenshots
Roadmap page with the assistant open (sidebar shows the new Assistant entry). Sending a message grounds on the roadmap: match score, summary, topics, talking points.