Chat (RAG)

AI Feature

Have a conversation with your knowledge base using Retrieval-Augmented Generation.

Two Modes of Chat

The Relink chat interface operates in two distinct modes depending on how you launch it. Both use streaming Server-Sent Events to deliver answers instantly.

Global Mode

Launched from the sidebar navigation. Asks questions against your entire archive. We embed your query, retrieve the top 5 most semantically similar saved links, and feed their raw text and key insights into the LLM context.

Good for: "What do I know about React server components?"

Scoped Mode

Launched directly from a specific bookmark card. The LLM's primary context is restricted to that specific article. However, we also query the database for 3 mathematically related articles and silently attach them as "Archive Context" in the background.

Good for: "Explain the code snippet in section 2 of this article."

Source Citations

A major problem with standard LLMs is hallucination. Relink mitigates this by forcing the LLM to cite its sources. When the streaming response begins, the API sends a header packet containing metadata for all retrieved sources. The UI renders these as a clickable "Sources" dock above the chat response.

The system prompt instructs the AI to use inline bracket citations (e.g., [1]) which coordinate directly with the retrieved source array.

Suggested Prompts

When you start a fresh conversation, Relink uses a lightweight AI pass to generate starter prompts from your saved links and uploaded PDFs. Use the shuffle control in the empty state to request a new set of archive-aware suggestions without leaving the chat page.

Conversation History

The chat interface maintains an array of the current conversation history (up to the last 10 turns) and passes it back to the server on subsequent queries. This allows for natural follow-up questions like "Can you elaborate on your second point?" without needing to re-state context.

AI Request Limits

Chat, synthesis, and AI-generated prompt suggestions are protected by short per-user rate limits to prevent runaway usage. If you hit a limit, Relink returns a retry response and the chat UI will ask you to wait before sending another request.