Codefessor

Code Buddy - AI Detection Interview System

A web application that conducts AI-powered interviews to assess whether submitted code was written by a human or AI. Uses the Ribbon API to create personalized code review interviews.

Features

Setup Instructions

1. Prerequisites

2. Get Ribbon API Key

  1. Sign up at Ribbon AI
  2. Navigate to your API settings
  3. Generate an API key
  4. Copy the API key for use in step 4

3. Install Dependencies

cd "/Users/ciqbian/Desktop/VS/HT6 25/Code Buddy 2"
npm install

4. Configure Environment

  1. Open the .env file
  2. Replace your_ribbon_api_key_here with your actual Ribbon API key:
RIBBON_API_KEY=your_actual_api_key_here
PORT=3000

5. Start the Application

For development (with auto-restart):

npm run dev

For production:

npm start

6. Access the Application

Open your browser and navigate to:

http://localhost:3000

How It Works

1. Code Submission

2. Interview Creation

3. Interview Process

4. Analysis & Scoring

5. Results

API Endpoints

POST /api/submit-code

Submit code for interview creation.

Request Body:

{
  "code": "string",
  "language": "string",
  "studentName": "string",
  "studentEmail": "string"
}

Response:

{
  "success": true,
  "sessionId": "string",
  "interviewLink": "string",
  "interviewId": "string"
}

GET /api/interview-status/:interviewId

Check interview completion status and get results.

Response:

{
  "status": "completed",
  "analysis": {
    "score": 75,
    "confidence": "high",
    "aiLikelihood": "likely human-written",
    "reasoning": "Claims personal authorship (+15); Uses technical terminology (4 matches) (+10)"
  },
  "transcript": "string",
  "studentInfo": {
    "name": "string",
    "language": "string"
  }
}

Scoring Algorithm

The AI detection algorithm considers multiple factors:

Positive Indicators (Human-written)

Negative Indicators (AI-generated)

Score Interpretation

Supported Programming Languages

Customization

Adding New Languages

Edit the generateCodeQuestions function in server.js to add language-specific questions.

Modifying Scoring Algorithm

Update the analyzeForAIDetection function in server.js to adjust scoring factors and weights.

Interview Questions

Customize the base questions in the generateCodeQuestions function to focus on different aspects of code understanding.

Troubleshooting

Common Issues

  1. “Missing required fields” error: Ensure all form fields are filled out
  2. “Failed to create interview” error: Check your Ribbon API key is correct
  3. Interview not starting: Verify the Ribbon API key has proper permissions
  4. Results not loading: Check browser console for errors and verify API connectivity

API Rate Limits

Be aware of Ribbon API rate limits. The application includes basic error handling, but you may need to implement additional retry logic for high-volume usage.

Security Considerations

License

This project is for educational purposes. Please ensure compliance with Ribbon AI’s terms of service.