Skip to content

Commit 52158a6

Browse files
committed
feat: pdf is removed
1 parent e8137a4 commit 52158a6

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

components/landing/main/header.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,10 @@ const ModeList = [
118118
icon: FiCode,
119119
link: '/mode/code',
120120
},
121-
{
122-
title: 'File',
123-
value: 'file',
124-
icon: FiFile,
125-
link: '/mode/file',
126-
},
121+
// {
122+
// title: 'File',
123+
// value: 'file',
124+
// icon: FiFile,
125+
// link: '/mode/file',
126+
// },
127127
];

pages/api/message/file.ts

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -36,38 +36,38 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
3636
}
3737

3838
return res.status(400).json({ error: 'Missing URL' });
39-
} else if (req.method === 'POST') {
40-
try {
41-
const form = new formidable.IncomingForm();
42-
const data = await new Promise<Files>((resolve, reject) => {
43-
form.parse(req, (err, fields, files) => {
44-
if (err) {
45-
reject(err);
46-
return;
47-
} else {
48-
resolve({
49-
file: files.file,
50-
});
51-
}
52-
});
53-
});
39+
// } else if (req.method === 'POST') {
40+
// try {
41+
// const form = new formidable.IncomingForm();
42+
// const data = await new Promise<Files>((resolve, reject) => {
43+
// form.parse(req, (err, fields, files) => {
44+
// if (err) {
45+
// reject(err);
46+
// return;
47+
// } else {
48+
// resolve({
49+
// file: files.file,
50+
// });
51+
// }
52+
// });
53+
// });
5454

55-
const uploadedFile = data['file'];
55+
// const uploadedFile = data['file'];
5656

57-
if (Array.isArray(uploadedFile)) {
58-
res.status(400).json({ error: 'Multiple files not supported' });
59-
} else if (uploadedFile.mimetype?.includes('pdf')) {
60-
const fileContentBuffer = await readFileAsync(uploadedFile.filepath);
61-
const pdfData = await pdf(fileContentBuffer);
62-
return res.status(200).json({ text: pdfData.text });
63-
} else {
64-
const fileContent = await readFileAsync(uploadedFile.filepath, 'binary');
65-
const fileContentStr = Buffer.from(fileContent, 'binary').toString('utf-8');
66-
return res.status(200).json({ text: fileContentStr });
67-
}
68-
} catch (error) {
69-
return res.status(500).json({ error: 'Error processing the file' });
70-
}
57+
// if (Array.isArray(uploadedFile)) {
58+
// return res.status(400).json({ error: 'Multiple files not supported' });
59+
// } else if (uploadedFile.mimetype?.includes('pdf')) {
60+
// const fileContentBuffer = await readFileAsync(uploadedFile.filepath);
61+
// const pdfData = await pdf(fileContentBuffer);
62+
// return res.status(200).json({ text: pdfData.text });
63+
// } else {
64+
// const fileContent = await readFileAsync(uploadedFile.filepath, 'binary');
65+
// const fileContentStr = Buffer.from(fileContent, 'binary').toString('utf-8');
66+
// return res.status(200).json({ text: fileContentStr });
67+
// }
68+
// } catch (error) {
69+
// return res.status(500).json({ error: 'Error processing the file' });
70+
// }
7171
} else {
7272
return res.status(405).json({ error: 'Method not allowed' });
7373
}

0 commit comments

Comments
 (0)