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
3 changes: 1 addition & 2 deletions client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions client/src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ import {
ArrowLeft, Trash2, Plus, Volume2, Download, X
} from 'lucide-react';
import './styles.css';

const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:5001';
const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:5000';
const QUICK_PROMPTS = [
'Who can sign the NOC?',
'Is there a stipend?',
Expand Down
4 changes: 2 additions & 2 deletions server/src/config/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export const env = {
minConfidence: Number(process.env.MIN_CONFIDENCE || 0.53),
topK: Number(process.env.TOP_K || 4),
ollamaBaseUrl: process.env.OLLAMA_BASE_URL || 'http://127.0.0.1:11434',
ollamaModel: process.env.OLLAMA_MODEL || 'gemma3:4b',
ollamaModel: process.env.OLLAMA_MODEL || 'llama3',
flagEmbeddingModel: process.env.FLAG_EMBEDDING_MODEL || 'BAAI/bge-small-en-v1.5',
pythonBin: process.env.PYTHON_BIN || 'python3',
pythonBin: 'C:/Users/jsuma/AppData/Local/Programs/Python/Python314/python.exe',
embeddingTimeoutMs: Number(process.env.EMBEDDING_TIMEOUT_MS || 30000)
};
2 changes: 2 additions & 0 deletions server/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { faqRouter } from './routes/faqRoutes.js';
import {questionReviewRouter} from './routes/questionReviewRoutes.js';
import { mostAskedRouter } from './routes/mostAskedRoutes.js';
import analyticsRoutes from './routes/analytics.js';
import historyRoutes from './routes/history.js';

const app = express();

Expand All @@ -25,6 +26,7 @@ app.use('/api/chat', chatRouter);
app.use('/api/orgs', orgRouter);
app.use('/api/faqs', faqRouter);
app.use('/api/most-asked', mostAskedRouter);
app.use('/api/history', historyRoutes);
app.use('/api/analytics', analyticsRoutes);


Expand Down
10 changes: 8 additions & 2 deletions server/src/routes/chatRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export const chatRouter = express.Router();
chatRouter.post('/', async (req, res, next) => {
try {
const message = req.body?.message;


// Save search
await SearchLog.create({
Expand All @@ -15,6 +16,11 @@ await SearchLog.create({
const result = await answerQuestion(message);
res.json(result);
} catch (error) {
next(error);
}
console.error("CHAT ERROR:", error);

res.status(500).json({
error: error.message,
stack: error.stack
});
}
});
18 changes: 18 additions & 0 deletions server/src/routes/history.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import express from 'express';
import SearchLog from '../models/SearchLog.js';

const router = express.Router();

router.get('/', async (req, res) => {
try {
const history = await SearchLog.find()
.sort({ createdAt: -1 })
.limit(20);

res.json(history);
} catch (error) {
res.status(500).json({ error: error.message });
}
});

export default router;
1 change: 1 addition & 0 deletions server/src/services/ragService.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ async function getKnowledgeBase() {
isActive: true,
embedding: { $exists: true, $ne: [] },
}).lean();
console.log("FAQs loaded:", faqs.length);
cachedKnowledgeBase = faqs.map((faq) => ({
...faq,
id: String(faq._id),
Expand Down