Loading...
Loading...
> Upload PDF documents and ask questions about their content using AI.
The PDF Chat component provides a complete RAG (Retrieval Augmented Generation) interface. Users upload a PDF, the system processes it, then they can ask questions about the content. Includes demo mode for testing without API setup.
DESC: Import the PDF chat into your page.
1import { AiPdfChat } from '@/components/library/ai-pdf-chat';
Use without API for testing and demos.
1export default function Page() {2 return <AiPdfChat />;3}
Connect to your document QA backend.
1export default function Page() {2 const handleQuestion = async (question: string, pdfContent: string) => {3 const response = await fetch('/api/ai/pdf-chat', {4 method: 'POST',5 body: JSON.stringify({ question, pdfContent }),6 });7 const data = await response.json();8 return data.answer;9 };1011 return <AiPdfChat onAskQuestion={handleQuestion} />;12}
| Option | Type | Default | Description |
|---|---|---|---|
| onAskQuestion | (question: string, pdfContent: string) => Promise<string> | undefined | Async callback for sending questions to your API. |
| className | string | undefined | Additional CSS classes for the container. |
For production use, you will need a RAG (Retrieval Augmented Generation) backend: