Spaces:
Runtime error
AI Interview UI Integration - Complete β
What Was Added
1. API Methods (frontend/src/services/api.js)
Added three new methods:
async createAIInterviewSession(interviewId)
async getAIInterviewSession(sessionId)
async completeAIInterview(sessionId, data)
2. Interviews Page Updates (frontend/src/pages/Interviews.jsx)
New Features:
- "Start AI Interview" button in header (opens modal)
- AI Interview selection modal
handleStartAIInterview()function- Opens AI interview in new tab
How it works:
- Click "Start AI Interview" button
- Modal shows all scheduled AI interviews
- Click on an interview to start
- Creates session via API
- Opens
/ai-interview?interview=X&session=Yin new tab
3. Interviews Table Updates (frontend/src/components/interviews/InterviewsTable.jsx)
New Features:
- Robot icon button for AI interviews
- Only shows for AI type interviews
- Only shows for non-cancelled/non-completed interviews
- Calls
onStartAIhandler
How to Test
Step 1: Ensure Backend is Running
cd backend
python api_app.py
Step 2: Ensure Frontend is Running
cd frontend
npm run dev
Step 3: Test from Interviews Page
Login to the app:
- Go to
http://localhost:5173 - Login with admin credentials
- Go to
Navigate to Interviews page:
- Click "Interviews" in sidebar
Option A: Use "Start AI Interview" Button
- Click yellow "Start AI Interview" button in header
- Modal opens showing all scheduled AI interviews
- Click on an interview
- New tab opens with AI interview
Option B: Use Table Action Button
- Find an AI interview in the table (has robot icon)
- Click the robot icon in Actions column
- New tab opens with AI interview
Step 4: Complete the Interview
In the new tab:
- Interview starts automatically
- Answer questions via text
- View real-time scores
- Complete all questions
- See final score
User Flow Diagram
Interviews Page
β
[Start AI Interview Button] or [Robot Icon in Table]
β
Create Session (API Call)
β
Open New Tab: /ai-interview?interview=X&session=Y
β
AI Interview Component
β
WebSocket Connection
β
Interview Flow
β
Completion Screen
Features Added
1. Start AI Interview Button
- Location: Top of Interviews page
- Color: Yellow (stands out)
- Action: Opens modal with AI interview list
- Icon: Video camera
2. AI Interview Selection Modal
- Shows: All scheduled AI interviews
- Filters: Excludes cancelled/completed
- Display: Candidate name, job, date, time, status
- Action: Click to start interview
3. Table Action Button
- Location: Actions column in table
- Icon: Robot (Bot)
- Visibility: Only for AI interviews
- Condition: Not cancelled or completed
- Action: Directly starts interview
API Integration
Create Session Endpoint
POST /api/v1/ai-interview/session/create?interview_id=1
Authorization: Bearer <token>
Response:
{
"session_id": "uuid",
"interview_id": 1,
"created_at": "timestamp"
}
Frontend Flow
// 1. Create session
const session = await apiService.createAIInterviewSession(interviewId);
// 2. Build URL
const url = `/ai-interview?interview=${interviewId}&session=${session.session_id}`;
// 3. Open in new tab
window.open(url, '_blank');
Testing Checklist
Prerequisites:
- Backend running on port 8000
- Frontend running on port 5173
- Logged in as admin
- At least one AI interview scheduled
Test Cases:
Test 1: Start from Button
- Click "Start AI Interview" button
- Modal opens
- AI interviews are listed
- Click an interview
- New tab opens
- Interview starts
Test 2: Start from Table
- Find AI interview in table
- Robot icon is visible
- Click robot icon
- New tab opens
- Interview starts
Test 3: No AI Interviews
- Cancel all AI interviews
- Click "Start AI Interview" button
- Modal shows "No AI interviews available"
- Message suggests scheduling one
Test 4: Completed Interview
- Complete an AI interview
- Go back to Interviews page
- Robot icon should not appear for completed interview
- Interview should not appear in modal
Test 5: Error Handling
- Stop backend
- Try to start AI interview
- Error alert appears
- User stays on Interviews page
Screenshots Guide
1. Interviews Page with Button
βββββββββββββββββββββββββββββββββββββββββββ
β [Schedule Interview] [Start AI Interview]β
β β
β Interview List β
β ββββββββββββββββββββββββββββββββββββββ β
β β Candidate | Role | Type | Actions β β
β β John Doe | Dev | AI | [π€][βοΈ][β]β
β ββββββββββββββββββββββββββββββββββββββ β
βββββββββββββββββββββββββββββββββββββββββββ
2. AI Interview Selection Modal
βββββββββββββββββββββββββββββββββββββββββββ
β Start AI Interview [β]β
βββββββββββββββββββββββββββββββββββββββββββ€
β Select an AI interview to start β
β β
β βββββββββββββββββββββββββββββββββββββββ β
β β [JD] John Doe β β
β β Software Developer β β
β β π
Feb 12 π 2:00 PM β β
β β [Start] βββ β β
β βββββββββββββββββββββββββββββββββββββββ β
β β
β [Cancel] β
βββββββββββββββββββββββββββββββββββββββββββ
3. New Tab Opens
βββββββββββββββββββββββββββββββββββββββββββ
β AI Interview β
β Question 1 of 5 β
β β
β [Video Preview] β
β β
β Q: Tell me about yourself? β
β β
β [Text Input Area] β
β β
β [Submit Answer] β
βββββββββββββββββββββββββββββββββββββββββββ
Next Steps
Immediate (Optional):
- Add loading state while creating session
- Add success notification
- Store interview results in database
- Create results view page
Future Enhancements:
- Copy interview link to clipboard
- Email interview link to candidate
- Track interview status (not started, in progress, completed)
- Show interview results in table
- Add "View Results" button for completed interviews
Troubleshooting
Issue: "Start AI Interview" button doesn't work
Solution: Check browser console for errors. Ensure backend is running.
Issue: Modal shows no interviews
Solution: Schedule an AI interview first. Check that interview type is "ai_interview".
Issue: New tab doesn't open
Solution: Check browser popup blocker. Allow popups for localhost.
Issue: Interview doesn't start
Solution: Check WebSocket connection. Ensure session was created successfully.
Issue: Robot icon doesn't appear
Solution: Ensure interview type is "AI" and status is not "Cancelled" or "Completed".
Code Changes Summary
Files Modified:
frontend/src/services/api.js- Added 3 methodsfrontend/src/pages/Interviews.jsx- Added button, modal, handlerfrontend/src/components/interviews/InterviewsTable.jsx- Added robot icon button
Lines Added: ~150
Files Created: 0
Time Taken: ~30 minutes
Success Criteria
β
"Start AI Interview" button visible
β
Button opens modal
β
Modal shows AI interviews
β
Clicking interview opens new tab
β
Robot icon appears in table
β
Robot icon starts interview
β
New tab loads AI interview
β
Interview starts automatically
β
No console errors
Status: Complete and Ready for Testing β
Last Updated: February 12, 2026
Next: Test in browser and store results