Skip to content

Commit 7e4594d

Browse files
frontend changes
1 parent 54a3f1b commit 7e4594d

File tree

9 files changed

+10276
-2591
lines changed

9 files changed

+10276
-2591
lines changed

src/pages/Application.jsx

Lines changed: 370 additions & 435 deletions
Large diffs are not rendered by default.

src/pages/DasInterViewPlatForm.jsx

Lines changed: 2489 additions & 462 deletions
Large diffs are not rendered by default.

src/pages/Interview.jsx

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { getAuthToken } from '../utils/handleToken';
66
import { useParams, useNavigate } from 'react-router-dom';
77
import { toast} from 'react-toastify';
88

9-
const GEMINI_API_KEY = import.meta.env.VITE_GEMINI_API_KEY;
9+
const GROQ_API_KEY = import.meta.env.VITE_GROQ_API_KEY;
1010
const baseUrl = import.meta.env.VITE_API_URL;
1111

1212
// Form Container Component
@@ -284,9 +284,9 @@ const QuestionsConfig = ({ onNext, onBack, formData, setFormData }) => {
284284
}));
285285
};
286286

287-
const generateQuestionsWithGemini = async () => {
288-
if (!GEMINI_API_KEY) {
289-
toast.error('Gemini API key not configured');
287+
const generateQuestionsWithGroq = async () => {
288+
if (!GROQ_API_KEY) {
289+
toast.error('Groq API key not configured');
290290
return;
291291
}
292292

@@ -310,23 +310,20 @@ Example format:
310310
}
311311
]`;
312312

313-
const response = await fetch(`https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent?key=${GEMINI_API_KEY}`, {
313+
const response = await fetch('https://api.groq.com/openai/v1/chat/completions', {
314314
method: 'POST',
315315
headers: {
316316
'Content-Type': 'application/json',
317+
'Authorization': `Bearer ${GROQ_API_KEY}`,
317318
},
318319
body: JSON.stringify({
319-
contents: [{
320-
parts: [{
321-
text: prompt
322-
}]
320+
model: 'llama-3.3-70b-versatile',
321+
messages: [{
322+
role: 'user',
323+
content: prompt
323324
}],
324-
generationConfig: {
325-
temperature: 0.7,
326-
topK: 40,
327-
topP: 0.95,
328-
maxOutputTokens: 2048,
329-
}
325+
temperature: 0.7,
326+
max_tokens: 2048,
330327
})
331328
});
332329

@@ -336,11 +333,11 @@ Example format:
336333

337334
const data = await response.json();
338335

339-
if (!data.candidates || !data.candidates[0] || !data.candidates[0].content) {
340-
throw new Error('Invalid response format from Gemini API');
336+
if (!data.choices || !data.choices[0] || !data.choices[0].message) {
337+
throw new Error('Invalid response format from Groq API');
341338
}
342339

343-
const generatedText = data.candidates[0].content.parts[0].text;
340+
const generatedText = data.choices[0].message.content;
344341

345342
let cleanedText = generatedText.replace(/```json\n?/g, '').replace(/```\n?/g, '').trim();
346343

@@ -438,7 +435,7 @@ Example format:
438435
<h3 className="text-xl font-semibold text-gray-900">Development Questions ({formData.Dev}%)</h3>
439436
<div className="flex space-x-3">
440437
<button
441-
onClick={generateQuestionsWithGemini}
438+
onClick={generateQuestionsWithGroq}
442439
disabled={isGenerating}
443440
className="px-6 py-3 bg-gradient-to-r from-green-500 to-emerald-500 text-white rounded-2xl font-semibold hover:from-green-600 hover:to-emerald-600 transition-all duration-300 disabled:opacity-50 flex items-center space-x-2 shadow-lg"
444441
>

0 commit comments

Comments
 (0)