CHRISDANIEL145 commited on
Commit
dc4ebce
·
1 Parent(s): 8e430e4

Fix 404 redirect and improve question generation with in-depth concepts

Browse files
Files changed (1) hide show
  1. app.py +27 -7
app.py CHANGED
@@ -115,7 +115,8 @@ def serve_static(filename):
115
  file_path = os.path.join(STATIC_DIR, filename)
116
  if os.path.exists(file_path):
117
  return send_from_directory(STATIC_DIR, filename)
118
- return jsonify({'error': 'Not found'}), 404
 
119
 
120
  # API Endpoints
121
  @app.route('/upload_resume', methods=['POST'])
@@ -172,13 +173,32 @@ def setup_interview():
172
  return jsonify({'error': 'Position and profile required'}), 400
173
 
174
  skills = ", ".join(profile.get('key_skills', []))
 
175
 
176
- # Generate only non-coding questions (Technical theory, Soft Skills, Communication)
177
- prompt = f'''Generate interview questions for {profile.get('name','Candidate')} for "{position}".
178
- Skills: {skills}. Experience: {profile.get('experience','N/A')}.
179
- Generate exactly 15 questions: 10 Technical (theory/concepts only, NO coding), 3 Soft Skills, 2 Communication.
180
- DO NOT include any coding challenges, programming problems, or questions asking to write code.
181
- Return: {{"questions":[{{"id":"q1","question":"...","tags":["technical"]}}]}}'''
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
 
183
  resp = generate_content_with_groq(prompt)
184
  if resp:
 
115
  file_path = os.path.join(STATIC_DIR, filename)
116
  if os.path.exists(file_path):
117
  return send_from_directory(STATIC_DIR, filename)
118
+ # For any non-existent file, redirect to dashboard instead of 404
119
+ return send_from_directory(STATIC_DIR, 'index.html')
120
 
121
  # API Endpoints
122
  @app.route('/upload_resume', methods=['POST'])
 
173
  return jsonify({'error': 'Position and profile required'}), 400
174
 
175
  skills = ", ".join(profile.get('key_skills', []))
176
+ experience = profile.get('experience', 'N/A')
177
 
178
+ # Generate in-depth concept questions based on resume skills
179
+ prompt = f'''Generate 15 IN-DEPTH interview questions for {profile.get('name','Candidate')} applying for "{position}".
180
+
181
+ Candidate Skills: {skills}
182
+ Experience: {experience}
183
+
184
+ Generate questions that test DEEP understanding of concepts. Questions should be:
185
+ - Based on the candidate's actual skills from their resume
186
+ - Testing theoretical knowledge, architecture decisions, best practices
187
+ - Asking about real-world scenarios and problem-solving approaches
188
+ - NO coding/programming challenges - only conceptual questions
189
+
190
+ Question Distribution:
191
+ - 10 Technical questions (in-depth concepts about their listed skills like {skills})
192
+ - 3 Soft Skills questions (teamwork, leadership, conflict resolution)
193
+ - 2 Communication questions (explaining technical concepts, stakeholder management)
194
+
195
+ Example good technical questions:
196
+ - "Explain the difference between SQL and NoSQL databases and when you would choose each"
197
+ - "What are the SOLID principles and how have you applied them?"
198
+ - "Describe microservices architecture and its trade-offs vs monolithic"
199
+ - "How does garbage collection work in [language]?"
200
+
201
+ Return JSON: {{"questions":[{{"id":"q1","question":"...","tags":["technical"]}}]}}'''
202
 
203
  resp = generate_content_with_groq(prompt)
204
  if resp: