Skip to content

Avatar#79

Merged
T4RuN05 merged 3 commits into
mainfrom
avatar
Jun 7, 2026
Merged

Avatar#79
T4RuN05 merged 3 commits into
mainfrom
avatar

Conversation

@T4RuN05

@T4RuN05 T4RuN05 commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

No description provided.

Copilot AI review requested due to automatic review settings June 7, 2026 05:16
@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

@T4RuN05 is attempting to deploy a commit to the shreevathsa05's projects team on Vercel, but is not a member of this team. To resolve this issue, you can:

  • Make your repository public. Collaboration is free for open source and public repositories.
  • Upgrade to pro and add @T4RuN05 as a member. A Pro subscription is required to access Vercel's collaborative features.
    • If you're the owner of the team, click here to upgrade and add @T4RuN05 as a member.
    • If you're the user who initiated this build request, click here to request access.
    • If you're already a member of the shreevathsa05's projects team, make sure that your Vercel account is connected to your GitHub account.

To read more about collaboration on Vercel, click here.

@T4RuN05
T4RuN05 merged commit 2aebc0d into main Jun 7, 2026
2 of 3 checks passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an “AI Avatar” survey-taking mode to the citizen frontend and introduces backend support for uploading voice answers and transcribing them via the AI service, plus a new avatar-trigger API scaffold.

Changes:

  • Frontend: adds Avatar mode UI, 3D avatar rendering, scripted avatar flow, and voice recording for text answers.
  • Backend (main2): accepts multipart survey submissions with audio files and asynchronously runs STT to replace placeholders with transcripts.
  • Backend (ai): adds an STT endpoint for raw browser recordings and a dynamic avatar script endpoint; adds tooling for static avatar prompt audio.

Reviewed changes

Copilot reviewed 16 out of 26 changed files in this pull request and generated 11 comments.

Show a summary per file
File Description
frontend/citizen/src/pages/SurveyPage.jsx Adds Avatar mode entry point and switches submission to multipart when audio blobs are present.
frontend/citizen/src/components/avatar/InteractionModal.jsx New modal UI for answering avatar questions (MCQ/checkbox/voice).
frontend/citizen/src/components/avatar/AvatarSurveyMode.jsx New scripted avatar survey runtime (audio playback + sequencing).
frontend/citizen/src/components/avatar/AvatarCanvas.jsx New 3D avatar canvas with basic jaw/head animation driven by audio intensity.
frontend/citizen/package.json Adds react-three dependencies (three, @react-three/*).
frontend/citizen/package-lock.json Locks new 3D dependency tree.
backend/main2/src/utils/audioProcessor.js New STT forwarder that updates stored SurveyResponses with transcripts.
backend/main2/src/routes/responseRoute.js Adds multer to accept multipart uploads on response submission.
backend/main2/src/routes/avatarRoute.js New authenticated API route scaffold for “trigger avatar survey”.
backend/main2/src/models/surveySchema.js Adds avatar to allowedChannels.
backend/main2/src/controllers/responseController.js Parses FormData JSON fields and invokes STT processing in the background worker.
backend/main2/src/controllers/avatarController.js Adds placeholder “dispatch” logic for future avatar/FOD integration.
backend/main2/src/app.js Registers the new /api/avatar route.
backend/ai/src/utils/tts.js Switches Sarvam TTS speaker voice.
backend/ai/src/utils/generate_avatar_statics.js Adds a script to generate and upload static avatar prompt audio.
backend/ai/src/router/speech_conversion.js Adds raw-file STT endpoint and avatar script generation route; supports static audio bucket routing.
backend/ai/package.json Adds multer dependency for STT file uploads.
Files not reviewed (1)
  • frontend/citizen/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -0,0 +1,303 @@
import React, { useState, useRef, useEffect } from 'react';
import { Mic, Square, Check, Loader2 } from 'lucide-react';
Comment on lines +29 to +42
useEffect(() => {
setSelectedOptions([]);
setSubmittedOption(null);
setIsRecording(false);
setRecordingTime(0);
setMicIntensity(0);
audioChunksRef.current = [];
if (timerRef.current) clearInterval(timerRef.current);
if (vadReqRef.current) cancelAnimationFrame(vadReqRef.current);
if (audioCtxRef.current) {
audioCtxRef.current.close();
audioCtxRef.current = null;
}
}, [question?.qid]);
Comment on lines +176 to +180
if (node.step === 'greeting' || node.step === 'outro' || node.step === 'instruction') {
await playAudio(node.audioId, node.fallbackText);
} else if (node.step === 'question') {
await playAudio(node.audioId, node.fallbackText);
}
Comment on lines +59 to +70
// Cleanup audio on unmount
useEffect(() => {
return () => {
if (reqAnimRef.current) cancelAnimationFrame(reqAnimRef.current);
if (audioRef.current) {
audioRef.current.pause();
audioRef.current = null;
}
window.speechSynthesis.cancel();
setAudioIntensity(0);
};
}, []);
Comment on lines +28 to +34
// Parse JSON if received via FormData
if (typeof response === "string") {
try { response = JSON.parse(response); } catch(e) {}
}
if (typeof paraInfo === "string") {
try { paraInfo = JSON.parse(paraInfo); } catch(e) {}
}
Comment on lines +63 to +66
// Cleanup temp file
if (fs.existsSync(file.path)) {
fs.unlinkSync(file.path);
}
Comment on lines +63 to +65
if (req.file && fs.existsSync(req.file.path)) {
fs.unlinkSync(req.file.path);
}
import fs from 'fs';
import { SurveyResponse } from '../models/responsesSchema.js';

const AI_SERVICE_URL = process.env.AI_SERVER_URL || 'http://localhost:3001';
import fs from "fs";
import { sarvam_voice } from "../models/llms.js";

const upload = multer({ dest: "uploads/" });
Comment on lines +5 to +7
import multer from "multer";

const upload = multer({ dest: "uploads/" }); // Temporary local storage before processing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants