Girish Jeswani commited on
Commit
97548eb
·
1 Parent(s): 8180918
Files changed (1) hide show
  1. README.md +219 -2
README.md CHANGED
@@ -1,3 +1,220 @@
1
- # Neon-AI-Project
2
 
3
- Multi-model LLM chatbot.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PhD Advisory Panel
2
 
3
+ An AI-powered academic guidance system that provides personalized advice through specialized advisor personas. Get diverse perspectives on your PhD journey from multiple AI advisors, each bringing unique expertise in methodology, theory, and practical guidance.
4
+
5
+ ## Features
6
+
7
+ - **Multiple AI Advisor Personas**: Chat with specialized advisors including Methodist (methodology expert), Theorist (conceptual frameworks), and Pragmatist (action-focused guidance)
8
+ - **Document Upload Support**: Upload PDFs, Word documents, and text files to provide context for your questions
9
+ - **Multi-LLM Backend**: Supports both Gemini API and Ollama models with seamless provider switching
10
+ - **Real-time Chat Interface**: Modern, responsive chat interface with advisor-specific styling
11
+ - **Context-Aware Responses**: Maintains conversation history and document context across the session
12
+ - **Sequential Advisor Responses**: Get input from all advisors in a structured sequence
13
+ - **Individual Advisor Chat**: Have focused conversations with specific advisors
14
+
15
+ ## Architecture
16
+
17
+ ### Frontend (React)
18
+ - **Technology**: React 18 with modern hooks and functional components
19
+ - **Styling**: CSS custom properties with dark/light theme support
20
+ - **Components**: Modular component architecture with reusable UI elements
21
+ - **State Management**: React hooks for local state management
22
+ - **Icons**: Lucide React for consistent iconography
23
+
24
+ ### Backend (FastAPI)
25
+ - **Framework**: FastAPI with automatic API documentation
26
+ - **LLM Integration**: Support for multiple providers (Gemini, Ollama)
27
+ - **Document Processing**: PDF, DOCX, and text file extraction
28
+ - **Session Management**: Global session context with file upload tracking
29
+ - **CORS Support**: Configured for React development server
30
+
31
+ ## Quick Start
32
+
33
+ ### Prerequisites
34
+ - Node.js 16+ and npm
35
+ - Python 3.8+
36
+ - (Optional) Gemini API key for Google's models
37
+ - (Optional) Ollama installation for local models
38
+
39
+ ### Backend Setup
40
+
41
+ 1. **Clone and navigate to backend directory**
42
+ ```bash
43
+ cd multi_llm_chatbot_backend
44
+ ```
45
+
46
+ 2. **Install dependencies**
47
+ ```bash
48
+ pip install -r requirements.txt
49
+ ```
50
+
51
+ 3. **Set up environment variables**
52
+ Create a `.env` file:
53
+ ```env
54
+ GEMINI_API_KEY=your_gemini_api_key_here
55
+ GEMINI_MODEL=gemini-2.0-flash
56
+ ```
57
+
58
+ 4. **Start the backend server**
59
+ ```bash
60
+ uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
61
+ ```
62
+
63
+ The API will be available at `http://localhost:8000` with interactive docs at `http://localhost:8000/docs`
64
+
65
+ ### Frontend Setup
66
+
67
+ 1. **Navigate to frontend directory**
68
+ ```bash
69
+ cd phd-advisor-frontend
70
+ ```
71
+
72
+ 2. **Install dependencies**
73
+ ```bash
74
+ npm install
75
+ ```
76
+
77
+ 3. **Start the development server**
78
+ ```bash
79
+ npm start
80
+ ```
81
+
82
+ The application will open at `http://localhost:3000`
83
+
84
+ ## Advisor Personas
85
+
86
+ ### Methodist - Research Methodology Expert
87
+ - **Focus**: Research design, validity, sampling, methodological rigor
88
+ - **Style**: Precise, analytical, methodology-focused
89
+ - **Best for**: Research design questions, data collection methods, validity concerns
90
+
91
+ ### Theorist - Conceptual Frameworks Expert
92
+ - **Focus**: Theoretical positioning, epistemological assumptions, conceptual clarity
93
+ - **Style**: Thoughtful, intellectually rigorous, theory-oriented
94
+ - **Best for**: Literature review, theoretical frameworks, conceptual development
95
+
96
+ ### Pragmatist - Action-Focused Advisor
97
+ - **Focus**: Practical next steps, immediate actions, progress over perfection
98
+ - **Style**: Warm, motivational, results-oriented
99
+ - **Best for**: Getting unstuck, prioritizing tasks, actionable advice
100
+
101
+ ## API Endpoints
102
+
103
+ ### Core Chat Endpoints
104
+ - `POST /chat-sequential` - Get responses from all advisors in sequence
105
+ - `POST /chat/{persona_id}` - Chat with a specific advisor
106
+ - `POST /reply-to-advisor` - Reply to a specific advisor's message
107
+
108
+ ### Document Management
109
+ - `POST /upload-document` - Upload documents (PDF, DOCX, TXT)
110
+ - `GET /uploaded-files` - List uploaded filenames
111
+ - `GET /context` - View current session context
112
+
113
+ ### Provider Management
114
+ - `GET /current-provider` - Get current LLM provider info
115
+ - `POST /switch-provider` - Switch between Gemini and Ollama
116
+
117
+ ### System
118
+ - `GET /debug/personas` - Debug persona configurations
119
+ - `GET /` - API health check
120
+
121
+ ## Configuration
122
+
123
+ ### Supported LLM Providers
124
+
125
+ **Gemini (Default)**
126
+ - Requires GEMINI_API_KEY environment variable
127
+ - Uses gemini-2.0-flash model by default
128
+ - Cloud-based, requires internet connection
129
+
130
+ **Ollama (Local)**
131
+ - Requires Ollama installation
132
+ - Uses llama3.2:1b model by default
133
+ - Runs locally, no internet required
134
+
135
+ ### File Upload Limits
136
+ - Maximum file size: 10MB per file
137
+ - Total session limit: 50MB
138
+ - Supported formats: PDF, DOCX, TXT
139
+
140
+ ### Environment Variables
141
+ ```env
142
+ # Required for Gemini
143
+ GEMINI_API_KEY=your_api_key
144
+
145
+ # Optional configurations
146
+ GEMINI_MODEL=gemini-2.0-flash
147
+ OLLAMA_BASE_URL=http://localhost:11434
148
+ ```
149
+
150
+ ## Development
151
+
152
+ ### Project Structure
153
+ ```
154
+ phd-advisor-frontend/
155
+ ├── public/
156
+ ├── src/
157
+ │ ├── components/ # Reusable UI components
158
+ │ ├── data/ # Advisor configurations
159
+ │ ├── pages/ # Main page components
160
+ │ ├── styles/ # CSS stylesheets
161
+ │ └── utils/ # Helper functions
162
+
163
+ multi_llm_chatbot_backend/
164
+ ├── app/
165
+ │ ├── api/ # API routes
166
+ │ ├── core/ # Business logic
167
+ │ ├── llm/ # LLM client implementations
168
+ │ ├── models/ # Data models
169
+ │ ├── tests/ # Test files
170
+ │ └── utils/ # Utility functions
171
+ ```
172
+
173
+ ### Adding New Advisors
174
+ 1. Create persona in `app/api/routes.py` with system prompt
175
+ 2. Add advisor configuration in frontend `src/data/advisors.js`
176
+ 3. Update advisor styling in `src/styles/`
177
+
178
+ ### Testing Document Upload
179
+ Use the test script:
180
+ ```bash
181
+ cd multi_llm_chatbot_backend/app/tests
182
+ python test_document_upload.py
183
+ ```
184
+
185
+ ## Usage Examples
186
+
187
+ ### Starting a Conversation
188
+ 1. Navigate to the home page
189
+ 2. Click "Start Conversation"
190
+ 3. Type your PhD-related question
191
+ 4. Receive responses from all three advisors
192
+
193
+ ### Uploading Documents
194
+ 1. In the chat interface, click the upload button
195
+ 2. Select your PDF, DOCX, or TXT file
196
+ 3. The document content will be added to the conversation context
197
+ 4. Ask questions about your uploaded documents
198
+
199
+ ### Switching LLM Providers
200
+ ```bash
201
+ curl -X POST "http://localhost:8000/switch-provider" \
202
+ -H "Content-Type: application/json" \
203
+ -d '{"provider": "ollama"}'
204
+ ```
205
+
206
+ ## Contributing
207
+
208
+ 1. Fork the repository
209
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
210
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
211
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
212
+ 5. Open a Pull Request
213
+
214
+
215
+ ## Support
216
+
217
+ - Check the API documentation at `http://localhost:8000/docs`
218
+ - Review the debug endpoints for troubleshooting
219
+ - Ensure all environment variables are properly configured
220
+ - Verify that your LLM provider (Gemini/Ollama) is accessible