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
17 changes: 17 additions & 0 deletions bharat pathshala/Backend/Packages.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "eduwebsite-backend",
"version": "1.0.0",
"dependencies": {
"axios": "^1.6.0",
"bcrypt": "^5.1.0",
"cors": "^2.8.5",
"express": "^4.18.2",
"jsonwebtoken": "^9.0.0",
"mongoose": "^7.4.0",
"openai": "^4.0.0",
"socket.io": "^4.7.0"
},
"scripts": {
"start": "node server.js"
}
}
9 changes: 9 additions & 0 deletions bharat pathshala/Backend/models/Quizs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const mongoose = require('mongoose');

const quizSchema = new mongoose.Schema({
userId: String,
score: Number,
date: { type: Date, default: Date.now },
});

module.exports = mongoose.model('Quiz', quizSchema);
Empty file.
Empty file.
Empty file.
Empty file.
2 changes: 2 additions & 0 deletions bharat pathshala/ai-services/chatbot/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Flask==2.3.2
chatterbot==1.0.5
17 changes: 17 additions & 0 deletions bharat pathshala/ai-services/doubt-solver/app.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
from flask import Flask, request, jsonify
from sympy import sympify, solve

app = Flask(__name__)

@app.route('/solve', methods=['POST'])
def solve_equation():
equation = request.json['equation']
try:
expr = sympify(equation)
solutions = solve(expr)
return jsonify({'solutions': [str(sol) for sol in solutions]})
except Exception as e:
return jsonify({'error': str(e)})

if __name__ == '__main__':
app.run(port=5002)
2 changes: 2 additions & 0 deletions bharat pathshala/ai-services/doubt-solver/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Flask==2.3.2
sympy==1.12
71 changes: 71 additions & 0 deletions bharat pathshala/frontend/Style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}

.container {
padding: 20px;
max-width: 1200px;
margin: 0 auto;
}

.navbar {
background-color: #333;
padding: 10px;
display: flex;
justify-content: space-between;
align-items: center;
}

.nav-brand {
color: white;
text-decoration: none;
font-size: 1.5em;
}

.nav-links {
list-style: none;
display: flex;
margin: 0;
}

.nav-links li {
margin-left: 20px;
}

.nav-links a, .nav-links button {
color: white;
text-decoration: none;
background: none;
border: none;
cursor: pointer;
}

.nav-links a:hover, .nav-links button:hover {
color: #ddd;
}

.chat-container {
border: 1px solid #ccc;
padding: 10px;
height: 300px;
overflow-y: auto;
margin-bottom: 10px;
}

input, button {
margin: 5px;
padding: 8px;
}

button {
background-color: #007bff;
color: white;
border: none;
cursor: pointer;
}

button:hover {
background-color: #0056b3;
}
34 changes: 34 additions & 0 deletions bharat pathshala/frontend/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import Navbar from './components/Navbar';
import Home from './pages/Home';
import Login from './pages/Login';
import Register from './pages/Register';
import Dashboard from './components/Dashboard';
import Chatbot from './components/Chatbot';
import DoubtSolver from './components/DoubtSolver';
import VideoPlayer from './components/VideoPlayer';
import Quiz from './components/Quiz';
import './styles.css';

function App() {
return (
<Router>
<Navbar />
<div className="container">
<Routes>
<Route path="/" element={<Home />} />
<Route path="/login" element={<Login />} />
<Route path="/register" element={<Register />} />
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/chatbot" element={<Chatbot />} />
<Route path="/doubt-solver" element={<DoubtSolver />} />
<Route path="/video" element={<VideoPlayer />} />
<Route path="/quiz" element={<Quiz />} />
</Routes>
</div>
</Router>
);
}

export default App;
20 changes: 20 additions & 0 deletions bharat pathshala/frontend/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "bharatphathshala-frontend",
"version": "0.1.0",
"dependencies": {
"axios": "^1.6.0",
"d3": "^7.8.0",
"p5": "^1.4.2",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.14.0",
"socket.io-client": "^4.7.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"proxy": "http://localhost:5000"
}
92 changes: 92 additions & 0 deletions bharat pathshala/frontend/public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Chat UI</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif, sans-serif;
}

body {
background-color: grey;
color: black;
display: flex;
flex-direction: column;
height: 100vh;
justify-content: space-between;
}

.top-bar {
display: flex;
justify-content: space-between;
padding: 15px;
}

.top-bar button {
background: #444;
color: white;
border: none;
padding: 10px 15px;
border-radius: 5px;
cursor: pointer;
}

.center-message {
text-align: center;
font-size: 24px;
flex-grow: 1;
display: flex;
align-items: center;
justify-content: center;
}

.bottom-bar {
display: flex;
align-items: center;
background: #222;
padding: 10px;
border-top: 1px solid #444;
}

.bottom-bar input {
flex-grow: 1;
background: #333;
border: none;
color: white;
padding: 10px;
border-radius: 20px;
margin: 0 10px;
}

.icon {
background: #444;
padding: 10px;
border-radius: 50%;
cursor: pointer;
}
</style>
</head>
<body>

<div class="top-bar">
<button>Get Plus</button>
<div class="icon">⚪</div>
</div>

<div class="center-message">
What can I help with?
</div>

<div class="bottom-bar">
<div class="icon">➕</div>
<input type="text" placeholder="Message ChatGPT">
<div class="icon">🎤</div>
</div>

</body>
</html>
8 changes: 8 additions & 0 deletions bharat pathshala/frontend/socket.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import io from 'socket.io-client';

const socket = io('http://localhost:5000');
socket.on('notification', (msg) => {
alert(msg);
});

export default socket;
37 changes: 37 additions & 0 deletions bharat pathshala/frontend/src/components/Chatbot.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import React, { useState } from 'react';
import axios from 'axios';

function Chatbot() {
const [message, setMessage] = useState('');
const [chat, setChat] = useState([]);

const sendMessage = async () => {
if (!message) return;
const response = await axios.post('/chat', { message });
setChat([...chat, { user: message, bot: response.data.response }]);
setMessage('');
};

return (
<div>
<h1>AI Chatbot Tutor</h1>
<div className="chat-container">
{chat.map((entry, idx) => (
<div key={idx}>
<p><strong>You:</strong> {entry.user}</p>
<p><strong>Bot:</strong> {entry.bot}</p>
</div>
))}
</div>
<input
type="text"
value={message}
onChange={e => setMessage(e.target.value)}
placeholder="Ask a question..."
/>
<button onClick={sendMessage}>Send</button>
</div>
);
}

export default Chatbot;
Empty file.
38 changes: 38 additions & 0 deletions bharat pathshala/frontend/src/components/DoubtSolver.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import React, { useState } from 'react';
import axios from 'axios';

function DoubtSolver() {
const [equation, setEquation] = useState('');
const [solutions, setSolutions] = useState([]);
const [error, setError] = useState('');

const solveEquation = async () => {
try {
const response = await axios.post('/solve', { equation });
setSolutions(response.data.solutions);
setError('');
} catch (err) {
setError(err.response?.data?.error || 'Invalid input');
setSolutions([]);
}
};

return (
<div>
<h1>Doubt Solver</h1>
<input
type="text"
value={equation}
onChange={e => setEquation(e.target.value)}
placeholder="e.g., x^2 - 4 = 0"
/>
<button onClick={solveEquation}>Solve</button>
{solutions.length > 0 && (
<p>Solutions: {solutions.join(', ')}</p>
)}
{error && <p style={{ color: 'red' }}>{error}</p>}
</div>
);
}

export default DoubtSolver;
Loading