Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions backend/config/passport.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ const passport = require("passport");
const GoogleStrategy = require("passport-google-oauth20").Strategy;
const User = require("../models/User");



console.log("Client ID:", process.env.GOOGLE_CLIENT_ID);
console.log("Client Secret:", process.env.GOOGLE_CLIENT_SECRET);
console.log("Callback URL:", process.env.GOOGLE_CALLBACK_URL);



passport.use(
new GoogleStrategy(
{
Expand Down
22 changes: 22 additions & 0 deletions backend/controllers/chatbotController.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// backend/controllers/chatbotController.js
const { GoogleGenerativeAI } = require("@google/generative-ai");

const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);

exports.getChatResponse = async (req, res) => {
try {
const { message } = req.body;
if (!message) return res.status(400).json({ error: "Message is required" });

const model = genAI.getGenerativeModel({ model: "gemini-1.5-flash" });

const result = await model.generateContent(message);

const reply = result.response.text(); // Gemini ka reply

res.json({ reply });
} catch (err) {
console.error("Chatbot Error:", err);
res.status(500).json({ error: "Failed to get response from Gemini AI" });
}
};
3 changes: 3 additions & 0 deletions backend/controllers/contact.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ const submitContactForm = async (req, res) => {
};

module.exports = { submitContactForm };



Loading