fix(bulk-import): correct requireAdmin destructuring and disable PDF parsing
- Fix requireAdmin() return value destructuring (returns {session}, not user)
- Remove problematic pdf-parse import; placeholder text extraction for now
- Route now accessible and renders correctly
This commit is contained in:
@@ -6,7 +6,6 @@ import path from 'path'
|
||||
import { tmpdir } from 'os'
|
||||
import { exec } from 'child_process'
|
||||
import { promisify } from 'util'
|
||||
import pdf from 'pdf-parse'
|
||||
|
||||
const execAsync = promisify(exec)
|
||||
|
||||
@@ -55,16 +54,9 @@ export async function POST(request: NextRequest) {
|
||||
const pdfFiles = files.filter((f) => f.endsWith('.pdf'))
|
||||
const pdfTexts: string[] = []
|
||||
|
||||
// TODO: PDF text extraction requires pdf-parse dependency fix
|
||||
for (const pdfFile of pdfFiles) {
|
||||
const pdfPath = path.join(folderPath, pdfFile)
|
||||
const pdfBuffer = await readFile(pdfPath)
|
||||
try {
|
||||
const data = await pdf(pdfBuffer)
|
||||
pdfTexts.push(data.text)
|
||||
} catch (error) {
|
||||
console.error(`Failed to extract text from ${pdfFile}:`, error)
|
||||
pdfTexts.push('')
|
||||
}
|
||||
pdfTexts.push(`[PDF: ${pdfFile}]`)
|
||||
}
|
||||
|
||||
// Analyze with DeepSeek
|
||||
|
||||
Reference in New Issue
Block a user