Skip to content

Commit 441ee99

Browse files
committed
create job by ai chatbot added
1 parent b50e518 commit 441ee99

20 files changed

+649
-5
lines changed

backend/controllers/jobController.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -431,3 +431,35 @@ exports.shortlist = catchAsyncErrors(async (req, res) => {
431431
res.status(500).json({ error: error.message });
432432
}
433433
});
434+
435+
exports.handlePdfUpload = (req, res) => {
436+
if (!req.files || req.files.length === 0) {
437+
return res.status(400).json({ message: "No PDF files uploaded." });
438+
}
439+
440+
const uploadedFileNames = req.files.map((file) => file.filename);
441+
// You can add further processing here (e.g. parsing PDFs)
442+
443+
return res.status(200).json({
444+
message: `Uploaded ${uploadedFileNames.length} PDF file(s) successfully.`,
445+
files: uploadedFileNames,
446+
});
447+
};
448+
449+
exports.chatWithAi = catchAsyncErrors(async (req, res) => {
450+
const question = req.body.query;
451+
452+
if (!question) {
453+
return res.status(400).json({ error: "Query is required" });
454+
}
455+
456+
// Dummy response for now
457+
const response = {
458+
text: "This is a dummy response",
459+
};
460+
461+
res.status(200).json({
462+
question,
463+
response,
464+
});
465+
});

backend/routes/jobsRouter.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ const {
99
fetchAllJobForms,
1010
shortlist,
1111
viewSimilarJobs,
12+
handlePdfUpload,
13+
chatWithAi,
1214
} = require("../controllers/jobController");
15+
const { upload } = require("../utils/filehelper");
1316

1417
router.route("/createJobForm").post(isAuthenticatedUser, createJobForms);
1518
router.route("/fetchMyJobForms").get(isAuthenticatedUser, fetchMyJobForms);
@@ -18,4 +21,8 @@ router.route("/fetchJobById/:id").get(isAuthenticatedUser, fetchJobById);
1821
router.route("/applyForJob").put(isAuthenticatedUser, applyForJob);
1922
router.route("/shortlist").get(isAuthenticatedUser, shortlist);
2023
router.route("/viewSimilarJobs").post(isAuthenticatedUser, viewSimilarJobs);
24+
router
25+
.route("/CreateByAi/upload")
26+
.post(isAuthenticatedUser, upload.array("pdf", 10), handlePdfUpload);
27+
router.route("/CreateByAi/chat").post(isAuthenticatedUser, chatWithAi);
2128
module.exports = router;
92.1 KB
Binary file not shown.
92.1 KB
Binary file not shown.
11.8 MB
Binary file not shown.

backend/utils/filehelper.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const filefilter = (req, file, cb) => {
1616
if (
1717
file.mimetype === "image/png" ||
1818
file.mimetype === "image/jpg" ||
19-
file.mimetype === "image/jpeg"||
19+
file.mimetype === "image/jpeg" ||
2020
file.mimetype === "application/pdf"
2121
) {
2222
cb(null, true);

frontend/public/ChatIcon.svg

Lines changed: 4 additions & 0 deletions
Loading

frontend/public/Exit.svg

Lines changed: 3 additions & 0 deletions
Loading

frontend/public/You.svg

Lines changed: 4 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)