Skip to content

Make RAG citations clickable for students (sources panel + linked sources) #445

Description

@NoveliaYuki

Problem

PR #430 added inline [N] citation markers to assistant answers, but they are plain text — a student cannot click them to reach the source. The underlying permalinks are relative and the /docs proxy requires a Bearer header, which a top-level browser navigation from the Open WebUI chat never carries. There is also no sources list rendered to the student.

Goal

A student chatting through Open WebUI should be able to click a citation and open the cited library item — shown under its real filename, with a download-original option — without logging in, and without OWI ever contacting the Library Manager directly (OWI → LAMB → Library).

Design (decided with the lead)

  • Rendering: emit OWI's native top-level sources field in the stream so OWI renders a clickable, persisted citations panel and auto-links the inline [N] markers to it (no OWI changes; OWI strips markdown reference links so the panel/source.name="N" mechanism is used).
  • Auth on click: because the click carries no LAMB identity, each link authorizes itself with an org-scoped HMAC signatureper-organization isolated (no cross-org access; revoke by rotating the secret) and no expiry (citations in old chats keep working).
  • Target: the link opens a LAMB-served view page titled with the real filename, showing the item's markdown content, plus a "Download original" button for the actual uploaded file.

Scope

Backend only (LAMB completions + a new signed public route). The legacy authenticated /docs permalink is unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions