AI assistant widget #1
Labels
No labels
Doing
P1: critical
P2: important
P3: useful
P4: nice to have
P5: reminder
To Do
bug
invalid
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
peacelink/ai-assistant#1
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Public website widget
Embed a chat widget in peacelink.it static pages. The widget is page-aware and can chat
about the article it is embedded in. The agent retains full access to RAG and MCP tools.
Page context strategy
The widget passes the current page URL to the API. The FastAPI layer checks if the article
is already indexed in pgvector (by matching
cmetadata->>'source'or a URL field):document.querySelector('article').innerText)and inject the raw text as a system section ("L'utente sta leggendo: ...")
This avoids duplicating content that is already embedded and chunked.
FastAPI layer (
api/)POST /auth/token— issue a short-lived JWT for public users (no OAuth2 Proxy)POST /chatSSE endpoint — accepts{ message, session_id, page_url, page_text? },streams agent tokens back as
text/event-streamsource=widgetandpage_urlJS widget (
widget/)<script>embed:<script src="https://.../widget.js" data-api="..."></script>/auth/token, renders floating chat button + panel{ message, session_id, page_url: location.href, page_text? }to
/chat;page_textincluded only if DOM extraction is needed (decided server-sideor via a flag returned at token time)
EventSourceAuth
/auth/token(public endpoint, rate-limited per session)role=public, enforced in the/chathandlerassigned to @iannuzzelli
changed the description
mentioned in commit
6288bc0a64PhPeace chat bridge:
gitlab.com/peacelink/phpeace/-@aa406fac6dAPI:
gitlab.com/peacelink/ai/assistant/-@6288bc0a64UI:
gitlab.com/peacelink/ui/-@afc65ad256andgitlab.com/peacelink/ui/-@b5f3e5471dInfra:
gitlab.com/peacelink/pck3s/-@35503d4a05