feat: Implement PDF document import functionality with Markdown conversion
- Added DocumentImportModule, DocumentImportController, and DocumentImportService for handling PDF uploads. - Integrated pdf-parse for extracting text from PDF files. - Created PdfParser for parsing PDF documents and converting them to Markdown format. - Updated frontend to support file uploads via drag-and-drop and file input for PDF documents. - Modified API routes to handle document import requests. - Enhanced error handling for unsupported file types and file size limits. - Updated README to reflect new features and usage instructions.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
import { NextRequest, NextResponse } from 'next/server';
|
||||
|
||||
const API_BASE = process.env.NEXT_PUBLIC_API_URL_INTERNAL || 'http://localhost:3001';
|
||||
|
||||
/**
|
||||
* Proxy för POST /api/document-import
|
||||
* Vidarebefordrar multipart/form-data till backend direkt (ingen JSON-omvandling)
|
||||
*/
|
||||
export async function POST(request: NextRequest) {
|
||||
const formData = await request.formData();
|
||||
|
||||
const res = await fetch(`${API_BASE}/api/document-import`, {
|
||||
method: 'POST',
|
||||
body: formData,
|
||||
// Sätt INTE Content-Type manuellt — browser sätter boundary automatiskt
|
||||
});
|
||||
|
||||
const data = await res.json();
|
||||
return NextResponse.json(data, { status: res.status });
|
||||
}
|
||||
Reference in New Issue
Block a user