The sources from RAG results are now included in the streaming response using Vercel AI SDK:
-
API Route (
/api/firestarter/query/route.ts):- Sources are prepared from the search results
- When streaming is enabled, sources are included via
toDataStreamResponse({ data: { sources } }) - Each source includes: url, title, and snippet
-
Dashboard (
/app/dashboard/page.tsx):- Parses the streaming response for sources data
- Updates messages with sources when found
- Displays sources below each assistant message
-
Source Display:
- Shows as "References:" section below the answer
- Each source shows:
- Citation number [1], [2], etc.
- Title (truncated to 60 chars)
- Snippet (truncated to 100 chars)
- URL
- Clickable link with external icon
- Start the dev server:
npm run dev - Create a new chatbot by entering a URL
- After crawling completes, ask a question
- Verify that sources appear below the answer
- Click on sources to verify they open in new tabs
When you ask a question, the response should:
- Stream the answer text
- Include relevant sources at the bottom
- Sources should be clickable and open in new tabs
- Each source should show a preview snippet