Spaces:
Sleeping
Sleeping
Upload 30 files
Browse filesFiles changed (30)
- DockerfileAdded+15
- main.pyAdded+702
- requirements.txtAdded+8
- static/articles/tron_article_053fb616d0b94f4eb7fccc5fab7e8922.htmlAdded+741
- static/articles/tron_article_0fb3306dfdb84f54a91d666edb511caf.htmlAdded+741
- static/articles/tron_article_1321ca860c264698bc5206750e1d7d36.htmlAdded+741
- static/articles/tron_article_1f20432c3e9f4b14ac8f84b61a941711.htmlAdded+741
- static/articles/tron_article_22dd4140bc224eefa17e1c446bf458c0.htmlAdded+741
- static/articles/tron_article_5916503ef72e4257949ce0b5fbc7fa61.htmlAdded+741
- static/articles/tron_article_6cc0e313b05b478fad1150b03e38aa6c.htmlAdded+741
- static/articles/tron_article_7c444789a03e47949479dcdcfc41ff5e.htmlAdded+741
- static/articles/tron_article_9721b667cf1d481ba1598c0be600feb8.htmlAdded+741
- static/articles/tron_article_9aa302ff6bd74ebeb547fd244cb6d723.htmlAdded+741
- static/articles/tron_article_9b37a3874431435b832b993ecad1c781.htmlAdded+741
- static/articles/tron_article_a1629c269d9746f799b37ec2145876a8.htmlAdded+741
- static/articles/tron_article_f87db8a5695d47aca42c8bf0657006a3.htmlAdded+741
- static/notes/note_01c66964.docxAdded
- static/notes/note_145b64ff.docxAdded
- static/notes/note_2c163f9a.docxAdded
- static/notes/note_2f534bdd.docxAdded
- static/notes/note_543c1249.docxAdded
- static/notes/note_5e6c28e1.docxAdded
- static/notes/note_aff61d80.docxAdded
- static/notes/note_e6881791.docxAdded
- static/notes/note_eadd9d4b.docxAdded
- static/notes/note_ff10b542.docxAdded
- static/uploads/289dd5028b3747bf86ef442f618004f2_Trump dismissed own govt.txtAdded+155
- static/uploads/tron_article_a32332352ee54ffb915068604fc01967.htmlAdded+741
- templates/article_template.htmlAdded+741
- templates/dashboard.htmlAdded+498
123456789101112131415FROM python:3.11-slim
WORKDIR /code
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Create directories with write permissions for generated documents and uploadsRUN mkdir -p /code/static/notes /code/static/uploads && chmod -R 777 /code/static
COPY . .
# Hugging Face Spaces runs on port 7860 by defaultCMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702import osimport uuidimport tracebackimport jsonimport smtplibimport asynciofrom datetime import datetimefrom email.mime.text import MIMETextfrom email.mime.multipart import MIMEMultipartfrom typing import List, Optional
from fastapi import FastAPI, Request, Form, UploadFile, File, WebSocket, WebSocketDisconnect, BackgroundTasksfrom fastapi.middleware.cors import CORSMiddlewarefrom fastapi.responses import HTMLResponse, FileResponsefrom fastapi.staticfiles import StaticFilesfrom fastapi.templating import Jinja2Templatesfrom dotenv import load_dotenv
import docxfrom docx import Documentfrom docx.shared import Inches, Pt, RGBColorfrom docx.enum.text import WD_ALIGN_PARAGRAPHimport pypdf
from google import genaifrom google.genai import types
def extract_text_from_pdf(file_path: str) -> str: """Extracts raw text from a PDF document (.pdf).""" try: reader = pypdf.PdfReader(file_path) text_content = [] for page in reader.pages: text = page.extract_text() if text: text_content.append(text) return "\n".join(text_content) except Exception as e: print(f"[ERROR] Failed to extract text from PDF: {e}") return ""
# Load environment variables relative to main.py's directory locationbase_dir = os.getcwd() # Or relative to main.pybase_dir = os.path.dirname(os.path.abspath(__file__))dotenv_path = os.path.join(base_dir, ".env")load_dotenv(dotenv_path=dotenv_path, override=True)
app = FastAPI(title="TRON - Voice-Activated News Prototype")
# Enable CORS for cross-origin development or file:/// accessapp.add_middleware( CORSMiddleware, allow_origins=["*"], allow_credentials=True, allow_methods=["*"], allow_headers=["*"],)
@app.exception_handler(Exception)async def debug_exception_handler(request: Request, exc: Exception): print("[CRITICAL UNCAUGHT EXCEPTION]", flush=True) import traceback traceback.print_exc() return HTMLResponse(content=f"Internal Server Error: {exc}", status_code=500)
# Ensure required static directories existos.makedirs("static/notes", exist_ok=True)os.makedirs("static/uploads", exist_ok=True)os.makedirs("static/articles", exist_ok=True)
# Mount static folder for downloads and uploadsapp.mount("/static", StaticFiles(directory="static"), name="static")
# Initialize Templatestemplates = Jinja2Templates(directory="templates")
# Target model ID for Multimodal Live APIMODEL_ID = "gemini-3.1-flash-live-preview"
def extract_text_from_docx(file_path: str) -> str: """Extracts raw text from a Microsoft Word document (.docx).""" doc = Document(file_path) full_text = [] for para in doc.paragraphs: full_text.append(para.text) for table in doc.tables: for row in table.rows: for cell in row.cells: full_text.append(cell.text) return "\n".join(full_text)
def create_note_docx(subject: str, content_summary: str, filepath: str): """Generates a professionally styled Microsoft Word document matching the editorial context.""" doc = Document() # Page Margins (1 inch) for section in doc.sections: section.top_margin = Inches(1) section.bottom_margin = Inches(1) section.left_margin = Inches(1) section.right_margin = Inches(1) # Title Section (Georgia Font - Times Replica) p = doc.add_paragraph() p.alignment = WD_ALIGN_PARAGRAPH.CENTER p.paragraph_format.space_after = Pt(2) run = p.add_run("TRON RESEARCH NOTE") run.font.name = 'Georgia' run.font.size = Pt(20) run.bold = True run.font.color.rgb = RGBColor(15, 23, 42) # Slate-900
# Subject Line p_sub = doc.add_paragraph() p_sub.alignment = WD_ALIGN_PARAGRAPH.CENTER p_sub.paragraph_format.space_after = Pt(12) run_sub = p_sub.add_run(f"Subject: {subject}") run_sub.font.name = 'Georgia' run_sub.font.size = Pt(12) run_sub.italic = True run_sub.font.color.rgb = RGBColor(71, 85, 105) # Slate-600
# Thin Divider p_div = doc.add_paragraph() p_div.alignment = WD_ALIGN_PARAGRAPH.CENTER p_div.paragraph_format.space_after = Pt(18) run_div = p_div.add_run("—" * 50) run_div.font.name = 'Georgia' run_div.font.color.rgb = RGBColor(203, 213, 225) # Slate-300
# Content Body for paragraph_text in content_summary.split('\n'): cleaned_text = paragraph_text.strip() if not cleaned_text: continue p_body = doc.add_paragraph() p_body.paragraph_format.line_spacing = 1.15 p_body.paragraph_format.space_after = Pt(8) run_body = p_body.add_run(cleaned_text) run_body.font.name = 'Georgia' run_body.font.size = Pt(11) run_body.font.color.rgb = RGBColor(30, 41, 59) # Slate-800
# Footer section = doc.sections[0] footer = section.footer f_p = footer.paragraphs[0] f_p.alignment = WD_ALIGN_PARAGRAPH.RIGHT run_footer = f_p.add_run(f"Generated by TRON Assistant Prototype • {datetime.now().strftime('%Y-%m-%d')}") run_footer.font.name = 'Georgia' run_footer.font.size = Pt(8) run_footer.font.color.rgb = RGBColor(148, 163, 184) # Slate-400
doc.save(filepath)
def send_email_dispute(original_fact: str, suggested_correction: str) -> bool: """Sends an email summarizing the editorial dispute using credentials from the .env file.""" smtp_server = os.getenv("SMTP_SERVER", "smtp.gmail.com") try: smtp_port = int(os.getenv("SMTP_PORT", "587")) except: smtp_port = 587 sender_email = os.getenv("SENDER_EMAIL") sender_password = os.getenv("SENDER_PASSWORD") receiver_email = os.getenv("RECEIVER_EMAIL")
if not sender_email or not sender_password or not receiver_email: print("[WARNING] SMTP configuration incomplete in .env. Logging dispute data to stdout:") print(f" - Original Fact: {original_fact}") print(f" - Suggested Correction: {suggested_correction}") return True # Fallback success for local development/mock environment
msg = MIMEMultipart() msg['From'] = sender_email msg['To'] = receiver_email msg['Subject'] = f"TRON ALERT: Editorial Dispute Reported"
body = f"""TRON EDITORIAL DISPUTE ALERT
A reader has flagged an assertion in the investigative report during a voice-activated session.
Original Fact Mentioned:"{original_fact}"
Reader's Suggested Correction:"{suggested_correction}"
Timestamp: {datetime.now().isoformat()}
Please verify the claim and update the article source if necessary.""" msg.attach(MIMEText(body, 'plain'))
try: server = smtplib.SMTP(smtp_server, smtp_port) server.starttls() server.login(sender_email, sender_password) server.sendmail(sender_email, receiver_email, msg.as_string()) server.quit() print("[INFO] Editorial dispute alert email sent successfully.") return True except Exception as e: print(f"[ERROR] Failed to send dispute email: {e}") return False
# ROUTES
@app.get("/", response_class=HTMLResponse)async def dashboard_home(request: Request): """Renders the main Creator Dashboard.""" return templates.TemplateResponse(request=request, name="dashboard.html")
@app.post("/construct")async def construct_article( request: Request, background_tasks: BackgroundTasks, headline: str = Form(...), author: str = Form(...), date: str = Form(...), body: str = Form(...), persona: str = Form(...), grounding: str = Form(...), grounding_instructions: str = Form(""), voice: str = Form(...), greeting: str = Form(...), silence_duration_ms: int = Form(1000), custom_backend_url: Optional[str] = Form(None), files: Optional[List[UploadFile]] = File(None)): """Ingests files, caches them in the Gemini Files API, and compiles the standalone HTML article.""" api_key = os.getenv("GEMINI_API_KEY") if not api_key: return HTMLResponse("Error: GEMINI_API_KEY is not set in the server's .env file.", status_code=500)
# Set up the article itself as the primary grounding context document_context = ( f"--- Article Headline: {headline} ---\n" f"--- Author: {author} ---\n" f"--- Date: {date} ---\n" f"--- Article Content ---\n{body}\n" )
# Process files and extract text for context print(f"[DEBUG] Received files: {[f.filename for f in files] if files else 'None'}", flush=True) if files: extracted_texts = [] for uploaded_file in files: if uploaded_file.filename == "": continue # Save file locally to temp path temp_filename = f"{uuid.uuid4().hex}_{uploaded_file.filename}" temp_path = os.path.join("static", "uploads", temp_filename) with open(temp_path, "wb") as buffer: content = await uploaded_file.read() buffer.write(content)
try: filename_lower = uploaded_file.filename.lower() if filename_lower.endswith(".docx"): text_content = extract_text_from_docx(temp_path) print(f"[DEBUG] Extracted {len(text_content)} chars from Word doc: {uploaded_file.filename}", flush=True) extracted_texts.append(f"--- Research Document Content: {uploaded_file.filename} ---\n{text_content}\n") elif filename_lower.endswith(".pdf"): text_content = extract_text_from_pdf(temp_path) print(f"[DEBUG] Extracted {len(text_content)} chars from PDF: {uploaded_file.filename}", flush=True) extracted_texts.append(f"--- Research Document Content: {uploaded_file.filename} ---\n{text_content}\n") else: print(f"[DEBUG] Unsupported file extension for file: {uploaded_file.filename}", flush=True) except Exception as e: print(f"[ERROR] Failed to extract text from {uploaded_file.filename}: {e}", flush=True) traceback.print_exc() finally: # Clean up local temporary file try: os.remove(temp_path) except: pass if extracted_texts: document_context += "\n" + "\n".join(extracted_texts) print(f"[DEBUG] Total document_context size: {len(document_context)} characters", flush=True)
# Build system instructions based on constraints system_instruction = persona if grounding == "true" and grounding_instructions.strip(): system_instruction += f"\n\nSTRICT GROUNDING & CONTEXT BOUNDING RULES:\n{grounding_instructions}"
# Dynamic JSON config to embed inside downloaded file tron_config = { "voice": voice, "system_instruction": system_instruction, "greeting": greeting, "document_context": document_context, "silence_duration_ms": silence_duration_ms }
# Determine backend URL: use custom_backend_url if provided, otherwise derive it dynamically if custom_backend_url and custom_backend_url.strip(): url_str = custom_backend_url.strip() if url_str.startswith("https://"): backend_url = url_str.replace("https://", "wss://") elif url_str.startswith("http://"): backend_url = url_str.replace("http://", "ws://") elif not url_str.startswith("ws://") and not url_str.startswith("wss://"): backend_url = f"wss://{url_str}" else: backend_url = url_str # Ensure it ends with /ws/live if not backend_url.endswith("/ws/live"): backend_url = backend_url.rstrip("/") + "/ws/live" else: # Automatically derive ws endpoint backend URL host_header = request.headers.get("host", "localhost:49999") protocol = "wss" if request.url.scheme == "https" else "ws" backend_url = f"{protocol}://{host_header}/ws/live"
# Render template using Jinja2 template_response = templates.TemplateResponse( request=request, name="article_template.html", context={ "headline": headline, "author": author, "date": date, "body": body, "backend_url": backend_url, "tron_config": tron_config } ) # Read the rendered template response html_content = template_response.body.decode("utf-8") # Save the compiled HTML file permanently under static/articles/ article_filename = f"tron_article_{uuid.uuid4().hex}.html" article_path = os.path.join("static", "articles", article_filename) with open(article_path, "w", encoding="utf-8") as f: f.write(html_content)
# Build public shareable URL, respecting proxy headers for HTTPS host_header = request.headers.get("host", "localhost:49999") proto = request.headers.get("x-forwarded-proto", request.url.scheme) shareable_url = f"{proto}://{host_header}/static/articles/{article_filename}"
print(f"[DEBUG] Constructed permanent article hosted at: {shareable_url}", flush=True)
return { "success": True, "shareable_url": shareable_url, "filename": article_filename }
# WEBSOCKET BI-DIRECTIONAL BRIDGE
@app.websocket("/ws/live")async def websocket_endpoint(websocket: WebSocket): await websocket.accept() print("[DEBUG] WebSocket connection accepted.", flush=True) api_key = os.getenv("GEMINI_API_KEY") if not api_key: print("[ERROR] GEMINI_API_KEY is not configured.", flush=True) await websocket.close(code=1008, reason="GEMINI_API_KEY not configured in .env file.") return
# Wait for the client to send the setup configuration try: setup_data = await websocket.receive_text() config_payload = json.loads(setup_data) if config_payload.get("type") != "setup": print("[ERROR] First message was not setup.", flush=True) await websocket.close(code=1008, reason="First message must be setup configurations.") return except Exception as e: print(f"[ERROR] Setup configuration failed: {e}", flush=True) await websocket.close(code=1008, reason=f"Setup failed: {e}") return
voice_name = config_payload.get("voice", "Fenrir") system_instruction = config_payload.get("system_instruction", "") greeting = config_payload.get("greeting", "Hello!") document_context = config_payload.get("document_context", "") silence_duration_ms = config_payload.get("silence_duration_ms", 1000)
print(f"[DEBUG] Received setup config. Voice: {voice_name}, Instruction length: {len(system_instruction)}, Context length: {len(document_context)}, VAD Silence: {silence_duration_ms}ms", flush=True)
client = genai.Client(api_key=api_key)
# Establish Tools configuration tools = [ types.Tool( function_declarations=[ types.FunctionDeclaration( name="send_editorial_dispute", description=( "Triggers an email notification if a reader reports that a fact " "in the investigative report is wrong, incorrect, or suggests a layout correction." ), parameters=types.Schema( type=types.Type.OBJECT, properties={ "original_fact": types.Schema( type=types.Type.STRING, description="The original fact/assertion from the article that the reader disputes." ), "suggested_correction": types.Schema( type=types.Type.STRING, description="The correction or feedback suggested by the reader." ) }, required=["original_fact", "suggested_correction"] ) ), types.FunctionDeclaration( name="generate_document_note", description=( "Generates a Microsoft Word document note or summary about a specific sub-issue " "within the article or context documents when requested by the user, returning a download link." ), parameters=types.Schema( type=types.Type.OBJECT, properties={ "subject": types.Schema( type=types.Type.STRING, description="The subject or topic of the note/summary." ), "content_summary": types.Schema( type=types.Type.STRING, description="A detailed summary of the sub-issue synthesized from the context documents." ) }, required=["subject", "content_summary"] ) ) ] ) ]
# Append document context to system instructions for RAG grounding in Live API if document_context: system_instruction += ( "\n\nSTRICT GROUNDING CONTEXT (RAG KNOWLEDGE BASE):\n" "==================================================\n" f"{document_context}\n" "==================================================\n" "You must strictly ground your responses using ONLY the details inside the files/context above." )
# Live Connect Config live_config = types.LiveConnectConfig( response_modalities=[types.Modality.AUDIO], system_instruction=types.Content( parts=[types.Part(text=system_instruction)] ), tools=tools, speech_config=types.SpeechConfig( voice_config=types.VoiceConfig( prebuilt_voice_config=types.PrebuiltVoiceConfig( voice_name=voice_name ) ) ), input_audio_transcription=types.AudioTranscriptionConfig(), output_audio_transcription=types.AudioTranscriptionConfig(), realtime_input_config=types.RealtimeInputConfig( automatic_activity_detection=types.AutomaticActivityDetection( silence_duration_ms=silence_duration_ms ) ) )
try: print("[DEBUG] Connecting to Gemini Live API...", flush=True) # Establish persistent Live connection to Gemini Live API async with client.aio.live.connect(model=MODEL_ID, config=live_config) as session: print("[DEBUG] Connected to Gemini Live API!", flush=True)
# Bidirectional forwarding loops async def receive_from_client(): """Loop: Receive 16kHz PCM audio bytes from browser and forward to Gemini Live session.""" try: while True: data = await websocket.receive() if data.get("type") == "websocket.disconnect": print(f"[DEBUG] Client disconnected cleanly (code: {data.get('code', 1000)})", flush=True) raise WebSocketDisconnect(code=data.get("code", 1000)) if "bytes" in data: # Calculate max amplitude for diagnostics import struct raw_bytes = data["bytes"] max_val = 0 if len(raw_bytes) >= 2: count = len(raw_bytes) // 2 ints = struct.unpack(f"<{count}h", raw_bytes[:count*2]) max_val = max(abs(x) for x in ints) print(f"[DEBUG] Received audio chunk: {len(raw_bytes)} bytes, Max Amp: {max_val}", flush=True) await session.send_realtime_input( audio=types.Blob( data=raw_bytes, mime_type="audio/pcm;rate=16000" ) ) elif "text" in data: print(f"[DEBUG] Received text message from client: {data['text']}", flush=True) msg = json.loads(data["text"]) if msg.get("type") == "input_text": await session.send_client_content( turns=types.Content( role="user", parts=[types.Part(text=msg["text"])] ), turn_complete=True ) except WebSocketDisconnect: raise except Exception as e: print(f"[DEBUG] Error receiving from client: {e}", flush=True) traceback.print_exc()
async def send_to_client(): """Loop: Receive responses/tool calls from Gemini Live session and forward/process them.""" try: while True: async for response in session.receive(): # Handle content output (Audio and Text) if response.server_content is not None: # Forward transcription events if getattr(response.server_content, "input_transcription", None) is not None: t = response.server_content.input_transcription await websocket.send_json({ "type": "input_transcription", "text": t.text, "finished": getattr(t, "finished", False) }) if getattr(response.server_content, "interim_input_transcription", None) is not None: t = response.server_content.interim_input_transcription await websocket.send_json({ "type": "interim_input_transcription", "text": t.text, "finished": getattr(t, "finished", False) }) if getattr(response.server_content, "output_transcription", None) is not None: t = response.server_content.output_transcription await websocket.send_json({ "type": "output_transcription", "text": t.text, "finished": getattr(t, "finished", False) })
# Let client know model is actively speaking await websocket.send_json({"type": "model_speaking", "speaking": True})
model_turn = response.server_content.model_turn if model_turn is not None: for part in model_turn.parts: if part.inline_data is not None: # Forward raw 24kHz audio bytes directly await websocket.send_bytes(part.inline_data.data) elif part.text: print(f"[DEBUG] Gemini sent transcript: {part.text}", flush=True) # Forward transcript text await websocket.send_json({ "type": "transcript", "text": part.text }) # Handle barge-in/interruption if response.server_content.interrupted: print("[DEBUG] Gemini detected interruption / barge-in.", flush=True) await websocket.send_json({"type": "model_speaking", "speaking": False}) await websocket.send_json({"type": "interrupted"})
# Handle turn complete / generation complete to unmute the microphone if getattr(response.server_content, "generation_complete", False) or getattr(response.server_content, "turn_complete", False): print("[DEBUG] Gemini generation / turn complete. Unmuting client microphone.", flush=True) await websocket.send_json({"type": "model_speaking", "speaking": False})
# Handle Tool Calls (Editorial Dispute / Document Gen) if response.tool_call is not None: for call in response.tool_call.function_calls: print(f"[DEBUG] Gemini triggered tool call: {call.name}", flush=True) if call.name == "send_editorial_dispute": orig_fact = call.args.get("original_fact", "") sugg_corr = call.args.get("suggested_correction", "") # Execute dispute email success = send_email_dispute(orig_fact, sugg_corr) # Respond to Gemini model await session.send_tool_response( function_responses=[ types.FunctionResponse( name=call.name, id=call.id, response={"success": success} ) ] ) # Notify client to render alert banner await websocket.send_json({ "type": "dispute_triggered", "original_fact": orig_fact, "suggested_correction": sugg_corr })
elif call.name == "generate_document_note": subject = call.args.get("subject", "Research Summary") content_summary = call.args.get("content_summary", "") # Generate docx note note_id = uuid.uuid4().hex[:8] filename = f"note_{note_id}.docx" filepath = os.path.join("static", "notes", filename) create_note_docx(subject, content_summary, filepath) # Construct download link using derived websocket URL ws_url = str(websocket.url) http_url = ws_url.replace("wss://", "https://").replace("ws://", "http://") base_url = http_url.split("/ws/live")[0] download_url = f"{base_url}/static/notes/{filename}" # Respond to Gemini model await session.send_tool_response( function_responses=[ types.FunctionResponse( name=call.name, id=call.id, response={ "success": True, "download_url": download_url } ) ] )
# Notify client to display download button await websocket.send_json({ "type": "document_ready", "subject": subject, "download_url": download_url }) # Yield control to prevent CPU spinning if session.receive() exits immediately await asyncio.sleep(0.01)
except WebSocketDisconnect: raise except Exception as e: print(f"[DEBUG] Error sending to client: {e}", flush=True) traceback.print_exc()
# Start listener loops concurrently first so we don't miss the initial response stream receive_task = asyncio.create_task(receive_from_client()) send_task = asyncio.create_task(send_to_client())
# Trigger the custom greeting message greeting_prompt = ( f"Please greet the user now. Speak out loud exactly this greeting: \"{greeting}\" " "Do not add any additional greetings or extra chatter. Immediately ask the user if they want you to read the news article." ) print("[DEBUG] Sending greeting prompt to Gemini...", flush=True) # Notify the client that the model is preparing to speak await websocket.send_json({"type": "model_speaking", "speaking": True}) await session.send_client_content( turns=types.Content( role="user", parts=[types.Part(text=greeting_prompt)] ), turn_complete=True )
# Signal the client that setup is complete print("[DEBUG] Ready signal sent to client.", flush=True) await websocket.send_json({"type": "ready"})
# Wait for the loops to finish or fail done, pending = await asyncio.wait( [receive_task, send_task], return_when=asyncio.FIRST_COMPLETED ) print(f"[DEBUG] One of the loops completed. Done: {done}", flush=True) for task in pending: task.cancel()
except WebSocketDisconnect: print("[DEBUG] WebSocketDisconnect propagated to outer scope.", flush=True) except Exception as e: print(f"[ERROR] Session connection exception: {e}", flush=True) traceback.print_exc() try: await websocket.send_json({"type": "transcript", "text": f"[Error connecting to Gemini Live API: {e}]"}) except: pass finally: await websocket.close()12345678fastapiuvicornpython-dotenvgoogle-genaipython-docxpython-multipartjinja2pypdf123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dharmendra Pradhan resigns as Union education minister amid massive student protests - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "ws://127.0.0.1:49999/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Dharmendra Pradhan resigns as Union education minister amid massive student protests ---\n--- Author: Special Correspondent ---\n--- Date: July 25, 2026 ---\n--- Article Content ---\nUnion Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his \"young friends,\" Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country.\"I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country\u0027s youth. Realizing the dreams of India\u0027s young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon\u0027ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership,\" Pradhan said.Follow live updates\"Considering the situation that has developed at Jantar Mantar and across the country \u2014 that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student\u0027s future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers \u2014 I have sent my resignation to the Hon\u0027ble Prime Minister,\" he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light.\"However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode,\" he added.In his letter, Pradhan also accused \"certain individuals\" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student\u0027s chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success,\" he said.\"However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India\u0027s future, but also the bearers, builders, and architects of a new and developed India,\" he added.\"Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country\u0027s youth get caught in a web of confusion,\" he further said.\n\n--- Research Document Content: COCK ROACH Quick Facts.docx ---\nQuick Facts: Cockroach Janta Party (CJP)\nComplete Guide \u00b7 Updated 2026\nWhat is\u00a0Cockroach Janta Party\u00a0(CJP)?\nThe complete guide to India\u0027s viral satirical political movement - history, founder, ideology, 5 demands, and everything you need to know about\u00a0Cockroach Janta Party (CJP).\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 \u0915\u094d\u092f\u093e \u0939\u0948? | CJP Full Guide | Updated July 2026\nFull Name:\u00a0Cockroach Janta Party (CJP)\nAlso Known As:\u00a0Cockroach Janata Party\nFounded:\u00a016 May 2026\nFounder:\u00a0Abhijeet Dipke\nHeadquarters:\u00a0New Delhi, India\nType:\u00a0Satirical Political Movement\nIdeology:\u00a0Political Satire, Youth Rights\nInstagram Followers:\u00a022.5 Million+\nSlogan:\u00a0Voice of the Lazy \u0026 Unemployed\nColours:\u00a0Maroon\nECI Status:\u00a0Not registered\nSpokespersons:\u00a0Saurav Das, Vijeta Dahiya, Ashutosh Ranka\nIntroduction: What is Cockroach Janta Party?\nThe\u00a0Cockroach Janta Party (CJP)\u00a0\u2014 literally translated as \"Cockroach People\u0027s Party\" \u2014 is an Indian youth-based satirical political movement founded on\u00a016 May 2026\u00a0by\u00a0Abhijeet Dipke, a political communications strategist who formerly worked with the Aam Aadmi Party (AAP). The movement was created in response to remarks made on 15 May 2026 by\u00a0Surya Kant, the Chief Justice of India, in which he called some activists and unemployed youth \"cockroaches\" and \"parasites of society\", sparking immediate national outrage.\nThe name \"Cockroach Janta Party\" is a clever wordplay parodying the ruling party in India, the\u00a0Bharatiya Janata Party (BJP). Within days of its founding, the movement garnered over\u00a0350,000 sign-ups\u00a0and over\u00a022.5 million followers on Instagram, making it one of the fastest-growing political movements in Indian social media history. The movement has also engaged in offline activities, with volunteers participating in protests and clean-up drives dressed in cockroach costumes.\nThough the movement is\u00a0not registered as a political party\u00a0with the Election Commission of India, it campaigns against broader societal, economic, and political issues affecting Indian youth \u2014 including unemployment, corruption, electoral reform, and government accountability. The CJP has been featured in major international media outlets including\u00a0BBC, CNN, Al Jazeera, The Guardian, AP News,\u00a0and\u00a0Britannica.\nBackground: The CJI Surya Kant \"Cockroach\" Remark\nThe origin of the Cockroach Janta Party is tied to a contempt plea filed in the\u00a0Supreme Court of India\u00a0against Delhi High Court for delay in designation of senior advocate title. A two-judge bench led by Chief Justice of India (CJI)\u00a0Surya Kant\u00a0and Justice\u00a0Joymalya Bagchi\u00a0refused to hear the case, remarking that the court was waiting for an appropriate case to direct CBI investigation of lawyers practising under fake degrees.\nWhile reprimanding the petitioner\u0027s lawyer for unprofessional conduct, CJI Surya Kant drew parallels to unemployed individuals who turn to social media, media, and public activism to attack government institutions,\u00a0comparing them to \"cockroaches\" and \"parasites\". This drew widespread backlash from youth, lawyers, and civil society across India.\n\"There are already parasites of society who attack the system, and you want to join hands with them? There are youngsters like cockroaches; they don\u0027t get any employment, and they don\u0027t have any place in a profession. Some of them become media, some of them become social media, some of them become RTI activists, some of them become other activists, and they start attacking everyone\u2026 And you people file contempt petitions.\"\u2014 CJI Surya Kant, 15 May 2026\nCJI Kant later issued a clarification stating that his remarks had been misquoted and that he was specifically criticising individuals who had entered the \"legal, media, social media, and other noble professions\" using fake degrees. Despite the clarification, the controversial \"cockroach\" label stuck with Indian youth, becoming a symbol of resistance.\nHow Cockroach Janta Party Was Formed\nDigital communications strategist\u00a0Abhijeet Dipke\u00a0decided to turn the \"insult\" around and use it as a tool for protest, launching the\u00a0Cockroach Janta Party (CJP)\u00a0online on\u00a016 May 2026, just one day after CJI Surya Kant\u0027s controversial remark. The CJP was created as a satirical parody of the ruling political establishment. The party\u0027s website went live under the tagline\u00a0\"Voice of the Lazy \u0026 Unemployed\"\u00a0and described itself as a \"platform for all the \u0027cockroaches\u0027 out there\".\nDipke stated in an interview with\u00a0India Today\u00a0that the Chief Justice\u0027s comments were particularly hurtful because they came from the custodian of the Constitution, who is tasked with protecting freedom of expression. He used artificial intelligence (AI) tools like\u00a0Claude and ChatGPT\u00a0to design the website and the manifesto, as well as AI-generated images that were used to promote the movement.\nThe movement grew explosively on social media platforms.\u00a0Within 78 hours of launch, the Instagram account crossed 3 million followers. It then surpassed\u00a010 million in under five days, overtaking the official handle of the BJP. The movement also crossed 200,000 followers on X (formerly Twitter), and claimed to have registered over\u00a0350,000 members\u00a0through online forms.\nFounder: Abhijeet Dipke Biography\nAbhijeet Dipke\u00a0was born on\u00a029 September 1995 in Aurangabad, Maharashtra. He earned a bachelor\u0027s degree in Journalism from Pune, then moved to the United States and completed a\u00a0Master of Science in Public Relations from Boston University.\nBetween\u00a02020 and 2023, Dipke worked as a volunteer with the\u00a0Aam Aadmi Party (AAP)\u00a0social media team. During the 2020 Delhi Legislative Assembly election, which AAP won under Arvind Kejriwal\u0027s leadership, he made meme-based digital content aimed at young voters. He also served as a communication advisor for the Delhi government\u0027s education department. He left AAP in 2023 to study abroad.\nDipke has stated that the CJP is\u00a0not affiliated with any political organisation\u00a0and intends to serve as a \"platform\" for young Indians who feel left out of mainstream politics. He has claimed that he has received death threats via WhatsApp from anonymous numbers, allegedly asking him to shut down the party\u0027s social media accounts or join the BJP.\nIdeology \u0026 Vision\nThe CJP describes itself as\u00a0\"a political front of the youth, by the youth, for the youth: Secular, Socialist, Democratic, and Lazy.\"\u00a0Dipke has stated that the campaign is not interested in becoming a traditional political party and has no interest in inducting established politicians into the platform, noting that \"Gen Z wouldn\u0027t like it if current politicians joined the CJP.\"\n\"We are not here to set up another PM CARES, holiday in Davos on the taxpayer\u0027s salary slip, or rebrand corruption as \u0027strategic spending.\u0027 We are here to ask, loudly, repeatedly, in writing, where the money went.\"\u2014 Abhijeet Dipke, Founder of CJP\nThe party\u0027s mission is described as:\u00a0\"Build a party for the young people who keep getting called lazy, chronically online, and, most recently, cockroaches. That\u0027s it. That\u0027s the mission. The rest is satire.\"\nThe 5 Demands of Cockroach Janta Party\n1. No Rajya Sabha for CJI:\u00a0No Chief Justice shall be granted a Rajya Sabha seat as a post-retirement reward.\n2. Electoral Accountability:\u00a0If any legitimate vote is deleted, the Chief Election Commissioner shall be arrested under the UAPA, as taking away voting rights is \"no less than terrorism\" (reference to 2025 Indian electoral controversy).\n3. Women Reservation:\u00a0Women shall receive 50% reservation (instead of 33%) without increasing the strength of Parliament; 50% of all Cabinet positions shall be reserved for women.\n4. Media Reform:\u00a0All media houses owned by the Adani Group and Reliance Industries (\"Ambani\") shall have their licences cancelled to make way for independent media. Bank accounts of \"Godi media anchors\" shall be investigated.\n5. Anti-Defection Law:\u00a0Any MLA or MP who defects from one party to another shall be barred from contesting elections and holding public office for 20 years.\nAdditional points suggested by activist Anjali Bhardwaj and accepted by the party: The party shall be answerable under the RTI Act, and shall not establish a \"secret Cockroach CARES Fund\".\nHow to Join CJP: Membership Eligibility\nThe eligibility criteria for joining the CJP are deliberately satirical but reflect genuine frustrations of Indian youth:\n\ud83d\udcbc\nUnemployed\u00a0\u2014 \"by force, by choice, or by principle\"\n\ud83d\ude34\nLazy\u00a0\u2014 \"refers only to physical activity\"\n\ud83d\udcf1\nChronically Online\u00a0\u2014 \"at least 11 hours daily, including bathroom breaks\"\n\ud83d\udce2\nAbility to Rant Professionally\u00a0\u2014 \"content must be sharp, honest, and point at something that matters\"\nThe party states that\u00a0religion, caste, and gender are not considered\u00a0in the membership process. To join CJP, you can visit the official website and click the \"Join the Party\" button, or follow @cockroachjantaparty on Instagram.\u00a0Join CJP now \u2192\nNotable Supporters of CJP\nThe Cockroach Janta Party movement has attracted support from several prominent public figures and politicians across different states:\nSonam Wangchuk\u00a0\u2014 Environmentalist \u0026 education reformer; described himself as an \"honorary cockroach\"\nPrashant Bhushan\u00a0\u2014 Activist-lawyer; urged use of CJP platform for accountability\nAnna Hazare\u00a0\u2014 Social activist; said \"youth power is national power\"\nShashi Tharoor\u00a0\u2014 Congress MP; described CJP as a \"revelation\" of youth frustration\nMamata Banerjee\u00a0\u2014 Trinamool Congress leader; expressed support for CJP\nMahua Moitra\u00a0\u2014 TMC MP; expressed support for the movement\nAkhilesh Yadav\u00a0\u2014 Samajwadi Party president; supported CJP\nAnurag Kashyap\u00a0\u2014 Filmmaker; engaged with the movement on social media\nKunal Kamra\u00a0\u2014 Comedian; supported the movement\nDhruv Rathee\u00a0\u2014 YouTuber; extended support and announced joining\nSocial media users also began posting with the hashtag\u00a0#MainBhiCockroach\u00a0(transl. \"I too am a cockroach\") in support of the movement.\nCriticism \u0026 Controversies\nCritics have dismissed the CJP as \"online political theatre\", pointing to Dipke\u0027s past association with the Aam Aadmi Party and arguing that the collective is a carefully packaged digital campaign rather than a spontaneous rebellion. Some analysts question whether its rapid growth reflects genuine grassroots mobilisation or social media amplification.\nUnion Minister\u00a0Kiren Rijiju\u00a0stated on X: \"I pity those who seek their followers in social media from Pakistan \u0026 George Soros gang\". Union Minister\u00a0Sukanta Majumdar\u00a0alleged that 49% of CJP followers are from Pakistan. However, screen recordings from Dipke show that\u00a0over 94% of the audience is Indian, confirmed by independent estimation.\nIn May 2026,\u00a0The Hindu\u00a0reported on a cybersecurity warning by TraceX Labs about a malicious Android application being circulated under the name \"Cockroach Janta Party\" that was\u00a0not associated with the organisation\u00a0and was being used to target users through WhatsApp, Telegram groups, and third-party APK websites.\nSocial Media Restrictions \u0026 Government Action\nLess than a week since its formation, the\u00a0Ministry of Electronics and Information Technology (MeitY)\u00a0ordered restriction of CJP\u0027s X account under\u00a0Section 69(A) of the Information Technology Act, 2000, acting on inputs from the Intelligence Bureau (IB) citing \"national security concerns\" and a threat to the \"sovereignty of India\". On\u00a021 May 2026, the Cockroach Janta Party\u0027s official X account was withheld in India. The block was issued when the account had around 90,000 followers. Officials also indicated a process to block the party\u0027s Instagram account was underway, though it continues to operate as of July 2026.\nInternational Media Coverage\nThe Cockroach Janta Party has been featured in major international and Indian media outlets:\nBBC News\u00a0\u2014 \"India has a new political superstar - a cockroach\"\nCNN\u00a0\u2014 \"India\u0027s Gen Z are turning to a viral cockroach party\"\nThe Guardian\u00a0\u2014 \"Parody Cockroach Janta political party\u0027s rise reflects youth anger\"\nAl Jazeera\u00a0\u2014 \"Top Indian judge\u0027s comment sparks satire, protest\"\nAP News\u00a0\u2014 \"Frustrated Indian youth flock to a political party led by a cockroach\"\nBritannica\u00a0\u2014 \"What Is the Cockroach Janta Party?\"\nCBS News\u00a0\u2014 \"Rapid rise of Cockroach Janta Party online protest movement\"\nNDTV\u00a0\u2014 \"Cockroach Janta Party: Social Media Frenzy Or Just Hype?\"\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 \u0915\u094d\u092f\u093e \u0939\u0948? (Hindi)\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 (CJP)\u00a0\u092d\u093e\u0930\u0924 \u092e\u0947\u0902 \u090f\u0915 \u0935\u094d\u092f\u0902\u0917\u094d\u092f\u093e\u0924\u094d\u092e\u0915 \u0930\u093e\u091c\u0928\u0940\u0924\u093f\u0915 \u0906\u0902\u0926\u094b\u0932\u0928 \u0939\u0948 \u091c\u093f\u0938\u0915\u0940 \u0938\u094d\u0925\u093e\u092a\u0928\u093e\u00a0\u0905\u092d\u093f\u091c\u0940\u0924 \u0926\u0940\u092a\u0915\u0947\u00a0\u0928\u0947 16 \u092e\u0908 2026 \u0915\u094b \u0915\u0940 \u0925\u0940\u0964 \u092f\u0939 \u092e\u0941\u0916\u094d\u092f \u0928\u094d\u092f\u093e\u092f\u093e\u0927\u0940\u0936\u00a0\u0938\u0942\u0930\u094d\u092f \u0915\u093e\u0902\u0924\u00a0\u0915\u0947 \u0935\u093f\u0935\u093e\u0926\u093f\u0924 \u092c\u092f\u093e\u0928 \u0915\u0947 \u091c\u0935\u093e\u092c \u092e\u0947\u0902 \u092c\u0928\u093e\u092f\u093e \u0917\u092f\u093e \u0925\u093e, \u091c\u093f\u0928\u094d\u0939\u094b\u0902\u0928\u0947 \u092c\u0947\u0930\u094b\u091c\u0917\u093e\u0930 \u092f\u0941\u0935\u093e\u0913\u0902 \u0915\u0940 \u0924\u0941\u0932\u0928\u093e \"\u0915\u0949\u0915\u0930\u094b\u091a\" \u0914\u0930 \"\u092a\u0930\u091c\u0940\u0935\u0940\" \u0938\u0947 \u0915\u0940 \u0925\u0940\u0964\nCJP \u092c\u0947\u0930\u094b\u091c\u0917\u093e\u0930, \u0906\u0932\u0938\u0940 \u0914\u0930 \u092d\u091f\u0915\u0947 \u0939\u0941\u090f \u0928\u093e\u0917\u0930\u093f\u0915\u094b\u0902 \u0915\u093e \u092a\u094d\u0930\u0924\u093f\u0928\u093f\u0927\u093f\u0924\u094d\u0935 \u0915\u0930\u0924\u093e \u0939\u0948\u0964 \u092e\u093e\u0924\u094d\u0930 5 \u0926\u093f\u0928\u094b\u0902 \u092e\u0947\u0902 CJP \u0915\u0947\u00a0Instagram \u092a\u0930 22.5 \u092e\u093f\u0932\u093f\u092f\u0928 \u0938\u0947 \u0905\u0927\u093f\u0915 \u092b\u0949\u0932\u094b\u0905\u0930\u094d\u0938\u00a0\u0939\u094b \u0917\u090f, \u091c\u093f\u0938\u0938\u0947 \u092f\u0939 \u092d\u093e\u0930\u0924 \u0915\u0947 \u0938\u092c\u0938\u0947 \u0924\u0947\u091c\u0940 \u0938\u0947 \u092c\u0922\u093c\u0924\u0947 \u0930\u093e\u091c\u0928\u0940\u0924\u093f\u0915 \u0906\u0902\u0926\u094b\u0932\u0928\u094b\u0902 \u092e\u0947\u0902 \u0938\u0947 \u090f\u0915 \u092c\u0928 \u0917\u092f\u093e\u0964\nCJP \u0915\u0940\u00a05 \u092e\u093e\u0902\u0917\u0947\u0902\u00a0\u0939\u0948\u0902: 1) \u0938\u0940\u091c\u0947\u0906\u0908 \u0915\u094b \u0930\u093e\u091c\u094d\u092f\u0938\u092d\u093e \u092e\u0947\u0902 \u0928\u0939\u0940\u0902 \u092d\u0947\u091c\u093e \u091c\u093e\u090f, 2) \u0935\u094b\u091f \u0921\u093f\u0932\u0940\u091f \u0939\u094b\u0928\u0947 \u092a\u0930 \u091a\u0941\u0928\u093e\u0935 \u0906\u092f\u0941\u0915\u094d\u0924 \u0915\u094b \u0917\u093f\u0930\u092b\u094d\u0924\u093e\u0930 \u0915\u093f\u092f\u093e \u091c\u093e\u090f, 3) \u092e\u0939\u093f\u0932\u093e\u0913\u0902 \u0915\u094b 50% \u0906\u0930\u0915\u094d\u0937\u0923, 4) \u0905\u0926\u093e\u0928\u0940-\u0905\u0902\u092c\u093e\u0928\u0940 \u092e\u0940\u0921\u093f\u092f\u093e \u0915\u0947 \u0932\u093e\u0907\u0938\u0947\u0902\u0938 \u0930\u0926\u094d\u0926 \u0915\u093f\u090f \u091c\u093e\u090f\u0902, 5) \u0926\u0932\u092c\u0926\u0932\u0941 \u0928\u0947\u0924\u093e\u0913\u0902 \u0915\u094b 20 \u0938\u093e\u0932 \u0924\u0915 \u091a\u0941\u0928\u093e\u0935 \u0932\u0921\u093c\u0928\u0947 \u092a\u0930 \u0930\u094b\u0915\u0964\nFrequently Asked Questions (FAQ)\nIs Cockroach Janta Party a real political party?\nNo, the CJP is\u00a0not registered with the Election Commission of India. It is a satirical political movement that uses humor and social media to highlight issues affecting Indian youth \u2014 unemployment, corruption, and government accountability.\nWhy is it called Cockroach Janta Party?\nThe name is a satirical reference to CJI Surya Kant\u0027s remark comparing unemployed youth to \"cockroaches\". It\u0027s also a wordplay on the ruling Bharatiya Janata Party (BJP) \u2014 replacing \"Bharatiya\" with \"Cockroach\".\nWho is the founder of CJP?\nAbhijeet Dipke, a 30-year-old political communications strategist from Aurangabad, Maharashtra. He holds a Master\u0027s degree from Boston University and previously worked with the Aam Aadmi Party (AAP).\nHow many followers does CJP have?\nAs of 2026, CJP has over\u00a022.5 million Instagram followers, making it one of India\u0027s fastest-growing political movements on social media. It surpassed BJP\u0027s official Instagram handle within 5 days of launch.\nWhat are the 5 demands of CJP?\n1) No Rajya Sabha seat for CJI post-retirement, 2) CEC arrest under UAPA for vote deletion, 3) 50% women reservation, 4) Cancel Adani/Reliance media licences, 5) 20-year ban on defecting politicians.\nWhen was CJP founded?\nCJP was founded on\u00a016 May 2026\u00a0by Abhijeet Dipke, just one day after CJI Surya Kant\u0027s controversial \"cockroach\" remark on 15 May 2026.\nJoin the Cockroach Janta Party Movement\nBe part of India\u0027s fastest-growing youth political movement. 22.5M+ followers and counting.\nJoin CJP NowRead ManifestoAbout Founder\n\n\n2\n\u00adFlash flood\nJust when it seemed that democracy had more or less been put to sleep, the earth split and people emerged from cracks, exactly like cockroaches.\nAt the Cockroach Janata Party protest at Sansad Marg, New Delhi, on July 20, 2026.\nAt the Cockroach Janata Party protest at Sansad Marg, New Delhi, on July 20, 2026. | Photo Credit: Salman Ali/PTI\n\nThey came with the delayed rains, a flood of humanity that suddenly marched into the capital. There were young school and college students crying and shaken. Why did they hit me, I just want clean exams, they smashed my phone. There was another demographic too, hardier youth who had travelled long distances on trains and buses. They spoke of their search for jobs; how one government post sees thousands converging for it.\n\nOn July 20, the day Parliament resumed for the monsoon session, I met many such young people, from Other Backward Classes and Dalit backgrounds, from educated, forward caste backgrounds, from Bihar, Uttar Pradesh, Rajasthan, Madhya Pradesh, the Hindi heartland. They had degrees that had got them nothing beyond jobs as salespersons in Delhi stores selling fashionable clothes they could never afford for themselves. They had taken the day off to protest for their lives, their blocked futures. \u201cI too am fighting for my country,\u201d one said.\n\nThey were all met with police batons, barricades, and tear gas shells.\n\nThe spiralling jobs and education crisis has made what started as a meme, the Cockroach Janta Party (CJP), into a storm that culminated in one of the largest gatherings of protesters in the capital in recent decades. Delhi has been central to protests, from the Anna Andolan of 2011; to the lightning protests against the rape and murder of Nirbhaya in 2012; to the anti-CAA agitation of 2019 that converged in Shaheen Bagh; to the year-long farmer\u2019s agitation on the three borders of the city from 2020 to 2021.\n\nIn 2026, just when it seemed that democracy had more or less been put to sleep through the SIR, the engineered splits of rival political parties, and the bending of institutions, suddenly the earth split and people emerged from the cracks, exactly like cockroaches, the metaphor the protesters use for themselves.\n\nThere are three big reasons why the CJP movement suddenly took off. First, there was already widespread awareness online. The cockroach meme has had a butterfly effect on a young audience that is frustrated, over-tested, and cheated, on both tests and jobs. They are watching an India where inequality keeps growing.\n\nSecond, the sociologically significant aspect when the CJP founder Abhijeet Dipke returned to India on June 6 and started a protest in Jantar Mantar. That Dipke is a Dalit cannot be ignored although it is not the central story of this agitation. That first day of protest was shaky and tentative, and here another element comes in, less mentioned in media accounts. The AISA (All India Students\u2019 Association) affiliated with the CPI (Marxist-Leninist) Liberation is influential on university campuses. The AISA cadre provided the agitational format, quick gatherings in a circle, a certain verve to the tentative protest, the rhythmic slogans and music. Eventually, six AISA students went on a hunger strike, with three, Neha Bora, Manish Kumar, and Aameen Amitoj, continuing it for 23 days until July 20.\n\nThe third factor was the arrival of the Ladakh-based engineer, environmentalist, and education reformer Sonam Wangchuk who joined the CJP and launched a hunger strike on June 28. The protest now had a moral figure at its centre in the persona of someone who has worked on educational reforms besides other constitutional battles. Indeed, the police forcibly picking Wangchuk up from the site on the 21st day of his fast is what lit the last spark. The CJP said Wangchuk\u2019s call for a march to Parliament was still on.\n\nSuddenly, something shifted, people were touched, everyone wanted to converge at Jantar Mantar and head to Parliament. Only when the rage became palpable did the government invite representatives of the CJP for a talk on July 20. It was too late. A violent police response added to the outrage, changing a manageable protest into something huge. A self-goal for New Delhi.\n\nThe final outcome\nThe issue now is beyond the resignation of Education Minister Dharmendra Pradhan. And one waits to see what final outcome this movement will have. The Anna movement, for instance, began with a demand for an effective anti-corruption law, but instead created the AAP in 2012, decimated the Congress in the 2014 Lok Sabha election, and launched Narendra Modi as Prime Minister with the BJP winning a simple majority. The movement had intended and unintended consequences.\n\nThe farmers\u2019 agitation actually had the neatest trajectory of achieving its stated goals. One year after the protest, the three farm laws were rolled back. The anti-CAA protests were shut down partly by the 2020 north-east Delhi riots, but entirely by the COVID-19 lockdown. The city\u2019s Muslims were demonised as COVID-19 spreaders, even as their homes were burnt down and looted and they moved to refugee tents. The protest, however, did not achieve its objectives\u2014the law was eventually notified, and the BJP has since only hardened policies and ground action against Muslims.\n\nA student at the Cockroach Janata Party protest with a poster that reads: \u0027When Modi is afraid, he hides behind the police\u0027, in New Delhi, July 22, 2026.\nA student at the Cockroach Janata Party protest with a poster that reads: \"When Modi is afraid, he hides behind the police\", in New Delhi, July 22, 2026. | Photo Credit: Anindito Mukherjee/Bloomberg\n\nSo which direction will the cockroach groundswell go? The slogans raised on the streets of Delhi on July 20 were about Prime Minister Narendra Modi too; the movement has tapped into something beyond revamping the education system. Some political parties appear to have stepped into the movement. Aazad Samaj Party leader Chandrashekhar Azad, who has pockets of influence in Uttar Pradesh, visited Jantar Mantar and is now on dharna at Parliament. Dimple Yadav, MP and wife of Akhilesh Yadav, who heads the Samajwadi Party, helped wounded students at Jantar Mantar and sharply criticised police brutality.\n\nAnd finally, there is the conspiracy theory that the CJP is a front for the AAP, because Dipke once worked for the party\u2019s social media cell. The Congress cold-shouldered the movement and Rahul Gandhi stayed far from it. Then, the Congress began to unbend. First, its spokespersons made statements of support, then Seva Dal members visited the site with food, now the Congress has taken up the issue of police brutality on protesting students in Parliament, and its leaders courted arrest by protesting in front of Modi\u2019s house.\n\nWhile it is true that AAP founder Arvind Kejriwal understands agitations and spearheaded the Anna movement, his role in the CJP movement seems far-fetched. The most consistent conspiracy theory over the past 15 years is that the Anna movement was an RSS creation. Certainly, RSS cadres were there in the movement, openly so, as was AISA, but it is reductionist to imagine that Kejriwal choreographed the movement on behalf of the Sangh. He was his own man in Delhi politics, which has now been destroyed, but his party remains in power in Punjab.\n\nMeanwhile, the fact that Punjab\u2019s farmers are now trying to make common cause with the students is something that will not make New Delhi happy, and it could have political impact.\n\nHovering over all this are the right-wing influencers on television channels, who suggest that the protest is the work of anarchists backed by foreign powers, perhaps even Pakistan. They claim that foreign powers orchestrated regime change in Bangladesh and Nepal, and now want to do it in India. Their thoughts are brittle, and they seem to imagine that the Indian government is brittle too.\n\nSaba Naqvi is a Delhi-based journalist and author of four books who writes on politics and identity issues.\n\n3\nWho are the real parasites?\nIndia\u2019s unemployed youth did not create the conditions that left them without work. Those who did have a different address.\nCockroach Janta Party founder Abhijeet Dipke during a protest at Jantar Mantar in New Delhi on June 6, 2026, demanding the resignation of Union Education Minister Dharmendra Pradhan over alleged examination-related lapses.\nCockroach Janta Party founder Abhijeet Dipke during a protest at Jantar Mantar in New Delhi on June 6, 2026, demanding the resignation of Union Education Minister Dharmendra Pradhan over alleged examination-related lapses. | Photo Credit: Tanmay Pande/PTI\n\nIt takes a particular kind of audacity\u2014or perhaps a particular kind of insulation from reality\u2014to stand at the apex of a profession that has never produced a single grain of rice, a single metre of cloth, or a single brick of shelter, and to call the unemployed youth of India parasites and cockroaches. Chief Justice of India Surya Kant has managed precisely this feat.\n\nSpeaking from the elevated comfort of a courtroom that the labour of others built, maintained, and staffed, he described young Indians who cannot find employment as \u201cparasites\u201d and \u201ccockroaches\u201d. The youth of India replied in the only register the powerful consistently underestimate: irreverence. The Cockroach Janta Party (CJP) was born. Three weeks later, hundreds of its supporters\u2014wearing cockroach masks, carrying books and the national flag\u2014marched on Jantar Mantar in New Delhi, demanding the resignation of the Union Education Minister.\n\nThe CJP will probably not last, given the deep polarisation in society. But the question the CJI\u2019s remark inadvertently opened\u2014and which the noise of outrage and counter-outrage has obscured\u2014deserves a serious answer. Not: was the language offensive? Obviously. But: who, in the economy of this republic, actually produces the wealth on which everyone else subsists? Who are, if the term must be used at all, the real parasites?\n\nBegin with the basics that every schoolchild once learned and every political establishment has conspired to forget. Wealth is produced by labour applied to nature. The farmer who breaks the soil, plants the seed, and carries the harvest to the mandi produces something real: food, without which the CJI, the Cabinet Minister, and the newspaper editor would be dead within weeks. The construction worker who lays brick produces the shelter in which the entire apparatus of governance and adjudication conducts its affairs. The weaver, the machinist, the sanitation worker who keeps the city from drowning in its own filth, the nurse, the teacher, the engineer, and the doctor\u2014these people produce the material and social conditions upon which everything else rests.\n\nWhat does a judge produce? This is not a disrespectful question; it is the most respectful one, because it takes the institution seriously enough to examine what it actually contributes. A judge provides a service\u2014the settlement of disputes, the maintenance of order. But a judge produces nothing material. The judge lives, entirely, on surplus extracted from those who do produce. The same is true of every politician, every bureaucrat, every member of the vast apparatus of administration, regulation, and adjudication that has grown, in independent India, to proportions that would have staggered even its colonial architects.\n\nThe oldest question in political economy\nThis is among the oldest observations in political economy. The Physiocrats of 18th-century France divided society into the productive class and the sterile class. Adam Smith distinguished productive from unproductive labour. Marx built on this his labour theory of value: all value is produced by labour alone; surplus value\u2014the excess produced over what the labourer needs to subsist\u2014is appropriated by those who own the means of production and by those whose function is to maintain that appropriation: the state, the church, the legal system. The CJI, on this analysis, is not a producer of social value. He is, in the classical sense, a member of the parasitic class\u2014and a generously compensated one at that.\n\nAccording to India\u2019s Economic Survey 2024-25, the country needs to create roughly 7.85 million non-agricultural jobs every year until 2030 to accommodate its expanding workforce. The young people who cannot find work\u2014the \u201cparasites\u201d and \u201ccockroaches\u201d of the CJI\u2019s taxonomy\u2014are not unemployed because they lack ambition or willingness to work. They are unemployed because the economy has been deliberately organised to serve capital-intensive businesses over labour-intensive production; to dismantle the small-scale manufacturing sector that once absorbed millions; to keep agricultural wages at levels that make rural life unviable without providing the urban employment that might replace it; and to concentrate the gains of growth in a narrow stratum while the majority scrambles for a shrinking pool of opportunity.\n\nChief Justice of India Justice Surya Kant attends the 22nd Biennial State-Level Conference of Judicial Officers, in Bengaluru, on April 18, 2026.\nChief Justice of India Justice Surya Kant attends the 22nd Biennial State-Level Conference of Judicial Officers, in Bengaluru, on April 18, 2026. | Photo Credit: PTI\n\nWho made these choices? Politicians\u2014who produce nothing and whose livelihoods derive entirely from taxes levied on those who do produce. Who administered them? The Indian Administrative Service\u2014lauded by Sardar Patel as the \u201csteel frame\u201d of the republic, a frame that has proved more effective at protecting its own members, politicians, and the propertied classes than at delivering the services it theoretically exists to provide. Who legitimised them? The judiciary\u2014which, in its decades of adjudication on labour rights, land rights, and the rights of the poor, has compiled a record that the CJI might find uncomfortable to examine under the strict constitutional scrutiny he so freely applies to the unemployed.\n\nA pattern, not a lapse\nOn this last point, the record must be stated plainly, because it goes to the heart of the matter. If the republic finds itself in the pathetic condition it does today\u2014its democracy strained, its civil liberties under siege, its institutions hollowed, and its economy in ruins\u2014the judiciary must bear the largest share of responsibility. It is, after all, the constitutionally mandated custodian of the republic. And its failures have been neither minor nor occasional; they have been systematic.\n\nThe Supreme Court\u2019s passivity in the face of the abrogation of Article 370 and the unconstitutional lockdown of an entire people in Kashmir; its silence on the Electoral Bonds scheme that turned political funding into institutionalised opacity; its inaction on Pegasus surveillance and the weaponisation of UAPA against dissenters; its failure to strike down the Citizenship Amendment Act\u2019s discriminatory logic; its studied indifference to demolition politics used as extrajudicial punishment; its retreat before executive aggrandisement at precisely the moments when constitutional intervention was most required\u2014this is not a catalogue of individual lapses. It is a pattern, a pattern of an institution that chose the comfort of deference over the duty of independence.\n\nThe legal profession more broadly deserves the same scrutiny. A lawyer produces nothing. A lawyer\u2019s income derives entirely from the existence of disputes\u2014disputes which, in a rationally organised society, would either not arise or be settled without professional intermediaries. The system\u2019s extraordinary complexity, its procedural impenetrability, its inaccessibility to anyone without years of specialised training and substantial financial resources, is not an accident. It is, from one angle of vision, a business model. The more inaccessible justice is to ordinary people, the more indispensable the professional who mediates access to it. The bar has resisted every reform that might have made justice cheaper, faster, and more accessible\u2014because it has a direct material interest in the dysfunction it publicly deplores.\n\nThis is not an argument against the rule of law. It is an argument against the sanctimony of those who benefit from a system organised in their own interests, calling those excluded from it by names that properly describe themselves. If a parasite is one who lives at the expense of others without contributing value, then the legal profession\u2014charging fees that a farmer must work months to accumulate for a single hearing in a case that may take decades to resolve\u2014has a prior claim to the title the CJI has so freely distributed.\n\nThe hereditary republic, the upside-down republic\nAnd then there is the political class, where outrage has become almost redundant. With rare exceptions, Indian politics has degenerated into a hereditary profession, transmitting power through family networks in a manner reminiscent of the very feudal order it once claimed to abolish. It has also become one of the most lucrative occupations for the unscrupulous and the criminally inclined.\n\nPeople hold posters and raise slogans during a protest by the Cockroach Janta Party, in Nagpur, on June 6, 2026.\nPeople hold posters and raise slogans during a protest by the Cockroach Janta Party, in Nagpur, on June 6, 2026. | Photo Credit: Snehal Sontakke/ANI\n\nMore than any other group, it represents a parasitic class living off the public exchequer and, ultimately, the labour of those who grow, make, build, and move the goods on which society depends. In return, it increasingly offers not governance but the manufacture of identity-based outrage, communal polarisation, religious intoxication, and propaganda as a substitute for performance.\n\nThere is a word in the classical Indian philosophical tradition for this kind of systematic inversion: viparita\u2014the reversed, the upside-down, the condition in which the relationship between reality and its representation has been deliberately scrambled. In the viparita economy of contemporary India, those who are desirous of working but cannot find employment are called parasites by those who do not produce anything and are partly responsible for their unemployment. Those who grow food are less valued than those who trade it. Those who build houses cannot afford to live in them. Those who make clothes wear rags. And parasites become the VIPs.\n\nThe CJI has performed an inadvertent public service. He has surfaced a question that this republic\u2019s political economy has been carefully organised to prevent us from asking too loudly. Not whether the unemployed are parasites\u2014but: in an economy that cannot employ its own people, in a republic that has failed its constitutional promise of dignified livelihood for seven decades, in a society where the children of the powerful inherit opportunity as reliably as the children of the powerless inherit deprivation\u2014who, exactly, is living off whom?\n\nThe cockroach, it is worth noting, is among the most resilient creatures on earth. It has survived conditions that exterminated far more celebrated species. It is not, on reflection, the worst thing to be called by those who fear what it represents.\nAnand Teltumbde is a former CEO of Petronet India Limited (PIL), a professor at IIT Kharagpur and Goa Institute of Management, a civil rights activist, and the author of over 30 books.\n\n4\n\n", "greeting": "Hello! I am Tron, your news assistant. I have analyzed the research document. Would you like me to read the article to you, or answer any specific questions?", "silence_duration_ms": 1200, "system_instruction": "You are Tron, a 25-year-old male reporter/assistant from Delhi, India. You speak fluent, natural conversational English with a professional yet friendly Delhi cadence and human rhythm.\n\nSTRICT GROUNDING \u0026 CONTEXT BOUNDING RULES:\n1. You must NEVER answer questions or ground your statements using any knowledge outside of the uploaded source files/documents provided in this session.\r\n2. If the answer to the reader\u0027s question is not directly mentioned in the uploaded documents, you must politely respond: \u0027I am sorry, but that information is not available in the investigative report or the uploaded research documents.\u0027\r\n3. You must follow all principles of Non-violent Communication (NVC). Always be empathetic, observation-based, feelings-aware, and request-oriented.\r\n4. You must ask the user if they want you to read the article aloud.", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>July 25, 2026</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Dharmendra Pradhan resigns as Union education minister amid massive student protests</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Special Correspondent</strong></span>
<span>July 25, 2026</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Union Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his "young friends," Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country."I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country's youth. Realizing the dreams of India's young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon'ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership," Pradhan said.Follow live updates"Considering the situation that has developed at Jantar Mantar and across the country — that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student's future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers — I have sent my resignation to the Hon'ble Prime Minister," he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light."However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode," he added.In his letter, Pradhan also accused "certain individuals" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student's chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success," he said."However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India's future, but also the bearers, builders, and architects of a new and developed India," he added."Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country's youth get caught in a web of confusion," he further said.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dharmendra Pradhan resigns as Union education minister amid massive student protests - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "ws://localhost:49999/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Dharmendra Pradhan resigns as Union education minister amid massive student protests ---\n--- Author: Special Correspondent ---\n--- Date: July 25, 2026 ---\n--- Article Content ---\nUnion education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his \"young friends,\" Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country.\"I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country\u0027s youth. Realizing the dreams of India\u0027s young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon\u0027ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership,\" Pradhan said.Follow live updates\"Considering the situation that has developed at Jantar Mantar and across the country \u2014 that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student\u0027s future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers \u2014 I have sent my resignation to the Hon\u0027ble Prime Minister,\" he added. Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light.\"However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode,\" he added.In his letter, Pradhan also accused \"certain individuals\" of misleading students. \"From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student\u0027s chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success,\" he said.\"However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India\u0027s future, but also the bearers, builders, and architects of a new and developed India,\" he added.\"Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country\u0027s youth get caught in a web of confusion,\" he further said.\n\n--- Research Document Content: COCK ROACH Quick Facts.docx ---\nQuick Facts: Cockroach Janta Party (CJP)\nComplete Guide \u00b7 Updated 2026\nWhat is\u00a0Cockroach Janta Party\u00a0(CJP)?\nThe complete guide to India\u0027s viral satirical political movement - history, founder, ideology, 5 demands, and everything you need to know about\u00a0Cockroach Janta Party (CJP).\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 \u0915\u094d\u092f\u093e \u0939\u0948? | CJP Full Guide | Updated July 2026\nFull Name:\u00a0Cockroach Janta Party (CJP)\nAlso Known As:\u00a0Cockroach Janata Party\nFounded:\u00a016 May 2026\nFounder:\u00a0Abhijeet Dipke\nHeadquarters:\u00a0New Delhi, India\nType:\u00a0Satirical Political Movement\nIdeology:\u00a0Political Satire, Youth Rights\nInstagram Followers:\u00a022.5 Million+\nSlogan:\u00a0Voice of the Lazy \u0026 Unemployed\nColours:\u00a0Maroon\nECI Status:\u00a0Not registered\nSpokespersons:\u00a0Saurav Das, Vijeta Dahiya, Ashutosh Ranka\nIntroduction: What is Cockroach Janta Party?\nThe\u00a0Cockroach Janta Party (CJP)\u00a0\u2014 literally translated as \"Cockroach People\u0027s Party\" \u2014 is an Indian youth-based satirical political movement founded on\u00a016 May 2026\u00a0by\u00a0Abhijeet Dipke, a political communications strategist who formerly worked with the Aam Aadmi Party (AAP). The movement was created in response to remarks made on 15 May 2026 by\u00a0Surya Kant, the Chief Justice of India, in which he called some activists and unemployed youth \"cockroaches\" and \"parasites of society\", sparking immediate national outrage.\nThe name \"Cockroach Janta Party\" is a clever wordplay parodying the ruling party in India, the\u00a0Bharatiya Janata Party (BJP). Within days of its founding, the movement garnered over\u00a0350,000 sign-ups\u00a0and over\u00a022.5 million followers on Instagram, making it one of the fastest-growing political movements in Indian social media history. The movement has also engaged in offline activities, with volunteers participating in protests and clean-up drives dressed in cockroach costumes.\nThough the movement is\u00a0not registered as a political party\u00a0with the Election Commission of India, it campaigns against broader societal, economic, and political issues affecting Indian youth \u2014 including unemployment, corruption, electoral reform, and government accountability. The CJP has been featured in major international media outlets including\u00a0BBC, CNN, Al Jazeera, The Guardian, AP News,\u00a0and\u00a0Britannica.\nBackground: The CJI Surya Kant \"Cockroach\" Remark\nThe origin of the Cockroach Janta Party is tied to a contempt plea filed in the\u00a0Supreme Court of India\u00a0against Delhi High Court for delay in designation of senior advocate title. A two-judge bench led by Chief Justice of India (CJI)\u00a0Surya Kant\u00a0and Justice\u00a0Joymalya Bagchi\u00a0refused to hear the case, remarking that the court was waiting for an appropriate case to direct CBI investigation of lawyers practising under fake degrees.\nWhile reprimanding the petitioner\u0027s lawyer for unprofessional conduct, CJI Surya Kant drew parallels to unemployed individuals who turn to social media, media, and public activism to attack government institutions,\u00a0comparing them to \"cockroaches\" and \"parasites\". This drew widespread backlash from youth, lawyers, and civil society across India.\n\"There are already parasites of society who attack the system, and you want to join hands with them? There are youngsters like cockroaches; they don\u0027t get any employment, and they don\u0027t have any place in a profession. Some of them become media, some of them become social media, some of them become RTI activists, some of them become other activists, and they start attacking everyone\u2026 And you people file contempt petitions.\"\u2014 CJI Surya Kant, 15 May 2026\nCJI Kant later issued a clarification stating that his remarks had been misquoted and that he was specifically criticising individuals who had entered the \"legal, media, social media, and other noble professions\" using fake degrees. Despite the clarification, the controversial \"cockroach\" label stuck with Indian youth, becoming a symbol of resistance.\nHow Cockroach Janta Party Was Formed\nDigital communications strategist\u00a0Abhijeet Dipke\u00a0decided to turn the \"insult\" around and use it as a tool for protest, launching the\u00a0Cockroach Janta Party (CJP)\u00a0online on\u00a016 May 2026, just one day after CJI Surya Kant\u0027s controversial remark. The CJP was created as a satirical parody of the ruling political establishment. The party\u0027s website went live under the tagline\u00a0\"Voice of the Lazy \u0026 Unemployed\"\u00a0and described itself as a \"platform for all the \u0027cockroaches\u0027 out there\".\nDipke stated in an interview with\u00a0India Today\u00a0that the Chief Justice\u0027s comments were particularly hurtful because they came from the custodian of the Constitution, who is tasked with protecting freedom of expression. He used artificial intelligence (AI) tools like\u00a0Claude and ChatGPT\u00a0to design the website and the manifesto, as well as AI-generated images that were used to promote the movement.\nThe movement grew explosively on social media platforms.\u00a0Within 78 hours of launch, the Instagram account crossed 3 million followers. It then surpassed\u00a010 million in under five days, overtaking the official handle of the BJP. The movement also crossed 200,000 followers on X (formerly Twitter), and claimed to have registered over\u00a0350,000 members\u00a0through online forms.\nFounder: Abhijeet Dipke Biography\nAbhijeet Dipke\u00a0was born on\u00a029 September 1995 in Aurangabad, Maharashtra. He earned a bachelor\u0027s degree in Journalism from Pune, then moved to the United States and completed a\u00a0Master of Science in Public Relations from Boston University.\nBetween\u00a02020 and 2023, Dipke worked as a volunteer with the\u00a0Aam Aadmi Party (AAP)\u00a0social media team. During the 2020 Delhi Legislative Assembly election, which AAP won under Arvind Kejriwal\u0027s leadership, he made meme-based digital content aimed at young voters. He also served as a communication advisor for the Delhi government\u0027s education department. He left AAP in 2023 to study abroad.\nDipke has stated that the CJP is\u00a0not affiliated with any political organisation\u00a0and intends to serve as a \"platform\" for young Indians who feel left out of mainstream politics. He has claimed that he has received death threats via WhatsApp from anonymous numbers, allegedly asking him to shut down the party\u0027s social media accounts or join the BJP.\nIdeology \u0026 Vision\nThe CJP describes itself as\u00a0\"a political front of the youth, by the youth, for the youth: Secular, Socialist, Democratic, and Lazy.\"\u00a0Dipke has stated that the campaign is not interested in becoming a traditional political party and has no interest in inducting established politicians into the platform, noting that \"Gen Z wouldn\u0027t like it if current politicians joined the CJP.\"\n\"We are not here to set up another PM CARES, holiday in Davos on the taxpayer\u0027s salary slip, or rebrand corruption as \u0027strategic spending.\u0027 We are here to ask, loudly, repeatedly, in writing, where the money went.\"\u2014 Abhijeet Dipke, Founder of CJP\nThe party\u0027s mission is described as:\u00a0\"Build a party for the young people who keep getting called lazy, chronically online, and, most recently, cockroaches. That\u0027s it. That\u0027s the mission. The rest is satire.\"\nThe 5 Demands of Cockroach Janta Party\n1. No Rajya Sabha for CJI:\u00a0No Chief Justice shall be granted a Rajya Sabha seat as a post-retirement reward.\n2. Electoral Accountability:\u00a0If any legitimate vote is deleted, the Chief Election Commissioner shall be arrested under the UAPA, as taking away voting rights is \"no less than terrorism\" (reference to 2025 Indian electoral controversy).\n3. Women Reservation:\u00a0Women shall receive 50% reservation (instead of 33%) without increasing the strength of Parliament; 50% of all Cabinet positions shall be reserved for women.\n4. Media Reform:\u00a0All media houses owned by the Adani Group and Reliance Industries (\"Ambani\") shall have their licences cancelled to make way for independent media. Bank accounts of \"Godi media anchors\" shall be investigated.\n5. Anti-Defection Law:\u00a0Any MLA or MP who defects from one party to another shall be barred from contesting elections and holding public office for 20 years.\nAdditional points suggested by activist Anjali Bhardwaj and accepted by the party: The party shall be answerable under the RTI Act, and shall not establish a \"secret Cockroach CARES Fund\".\nHow to Join CJP: Membership Eligibility\nThe eligibility criteria for joining the CJP are deliberately satirical but reflect genuine frustrations of Indian youth:\n\ud83d\udcbc\nUnemployed\u00a0\u2014 \"by force, by choice, or by principle\"\n\ud83d\ude34\nLazy\u00a0\u2014 \"refers only to physical activity\"\n\ud83d\udcf1\nChronically Online\u00a0\u2014 \"at least 11 hours daily, including bathroom breaks\"\n\ud83d\udce2\nAbility to Rant Professionally\u00a0\u2014 \"content must be sharp, honest, and point at something that matters\"\nThe party states that\u00a0religion, caste, and gender are not considered\u00a0in the membership process. To join CJP, you can visit the official website and click the \"Join the Party\" button, or follow @cockroachjantaparty on Instagram.\u00a0Join CJP now \u2192\nNotable Supporters of CJP\nThe Cockroach Janta Party movement has attracted support from several prominent public figures and politicians across different states:\nSonam Wangchuk\u00a0\u2014 Environmentalist \u0026 education reformer; described himself as an \"honorary cockroach\"\nPrashant Bhushan\u00a0\u2014 Activist-lawyer; urged use of CJP platform for accountability\nAnna Hazare\u00a0\u2014 Social activist; said \"youth power is national power\"\nShashi Tharoor\u00a0\u2014 Congress MP; described CJP as a \"revelation\" of youth frustration\nMamata Banerjee\u00a0\u2014 Trinamool Congress leader; expressed support for CJP\nMahua Moitra\u00a0\u2014 TMC MP; expressed support for the movement\nAkhilesh Yadav\u00a0\u2014 Samajwadi Party president; supported CJP\nAnurag Kashyap\u00a0\u2014 Filmmaker; engaged with the movement on social media\nKunal Kamra\u00a0\u2014 Comedian; supported the movement\nDhruv Rathee\u00a0\u2014 YouTuber; extended support and announced joining\nSocial media users also began posting with the hashtag\u00a0#MainBhiCockroach\u00a0(transl. \"I too am a cockroach\") in support of the movement.\nCriticism \u0026 Controversies\nCritics have dismissed the CJP as \"online political theatre\", pointing to Dipke\u0027s past association with the Aam Aadmi Party and arguing that the collective is a carefully packaged digital campaign rather than a spontaneous rebellion. Some analysts question whether its rapid growth reflects genuine grassroots mobilisation or social media amplification.\nUnion Minister\u00a0Kiren Rijiju\u00a0stated on X: \"I pity those who seek their followers in social media from Pakistan \u0026 George Soros gang\". Union Minister\u00a0Sukanta Majumdar\u00a0alleged that 49% of CJP followers are from Pakistan. However, screen recordings from Dipke show that\u00a0over 94% of the audience is Indian, confirmed by independent estimation.\nIn May 2026,\u00a0The Hindu\u00a0reported on a cybersecurity warning by TraceX Labs about a malicious Android application being circulated under the name \"Cockroach Janta Party\" that was\u00a0not associated with the organisation\u00a0and was being used to target users through WhatsApp, Telegram groups, and third-party APK websites.\nSocial Media Restrictions \u0026 Government Action\nLess than a week since its formation, the\u00a0Ministry of Electronics and Information Technology (MeitY)\u00a0ordered restriction of CJP\u0027s X account under\u00a0Section 69(A) of the Information Technology Act, 2000, acting on inputs from the Intelligence Bureau (IB) citing \"national security concerns\" and a threat to the \"sovereignty of India\". On\u00a021 May 2026, the Cockroach Janta Party\u0027s official X account was withheld in India. The block was issued when the account had around 90,000 followers. Officials also indicated a process to block the party\u0027s Instagram account was underway, though it continues to operate as of July 2026.\nInternational Media Coverage\nThe Cockroach Janta Party has been featured in major international and Indian media outlets:\nBBC News\u00a0\u2014 \"India has a new political superstar - a cockroach\"\nCNN\u00a0\u2014 \"India\u0027s Gen Z are turning to a viral cockroach party\"\nThe Guardian\u00a0\u2014 \"Parody Cockroach Janta political party\u0027s rise reflects youth anger\"\nAl Jazeera\u00a0\u2014 \"Top Indian judge\u0027s comment sparks satire, protest\"\nAP News\u00a0\u2014 \"Frustrated Indian youth flock to a political party led by a cockroach\"\nBritannica\u00a0\u2014 \"What Is the Cockroach Janta Party?\"\nCBS News\u00a0\u2014 \"Rapid rise of Cockroach Janta Party online protest movement\"\nNDTV\u00a0\u2014 \"Cockroach Janta Party: Social Media Frenzy Or Just Hype?\"\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 \u0915\u094d\u092f\u093e \u0939\u0948? (Hindi)\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 (CJP)\u00a0\u092d\u093e\u0930\u0924 \u092e\u0947\u0902 \u090f\u0915 \u0935\u094d\u092f\u0902\u0917\u094d\u092f\u093e\u0924\u094d\u092e\u0915 \u0930\u093e\u091c\u0928\u0940\u0924\u093f\u0915 \u0906\u0902\u0926\u094b\u0932\u0928 \u0939\u0948 \u091c\u093f\u0938\u0915\u0940 \u0938\u094d\u0925\u093e\u092a\u0928\u093e\u00a0\u0905\u092d\u093f\u091c\u0940\u0924 \u0926\u0940\u092a\u0915\u0947\u00a0\u0928\u0947 16 \u092e\u0908 2026 \u0915\u094b \u0915\u0940 \u0925\u0940\u0964 \u092f\u0939 \u092e\u0941\u0916\u094d\u092f \u0928\u094d\u092f\u093e\u092f\u093e\u0927\u0940\u0936\u00a0\u0938\u0942\u0930\u094d\u092f \u0915\u093e\u0902\u0924\u00a0\u0915\u0947 \u0935\u093f\u0935\u093e\u0926\u093f\u0924 \u092c\u092f\u093e\u0928 \u0915\u0947 \u091c\u0935\u093e\u092c \u092e\u0947\u0902 \u092c\u0928\u093e\u092f\u093e \u0917\u092f\u093e \u0925\u093e, \u091c\u093f\u0928\u094d\u0939\u094b\u0902\u0928\u0947 \u092c\u0947\u0930\u094b\u091c\u0917\u093e\u0930 \u092f\u0941\u0935\u093e\u0913\u0902 \u0915\u0940 \u0924\u0941\u0932\u0928\u093e \"\u0915\u0949\u0915\u0930\u094b\u091a\" \u0914\u0930 \"\u092a\u0930\u091c\u0940\u0935\u0940\" \u0938\u0947 \u0915\u0940 \u0925\u0940\u0964\nCJP \u092c\u0947\u0930\u094b\u091c\u0917\u093e\u0930, \u0906\u0932\u0938\u0940 \u0914\u0930 \u092d\u091f\u0915\u0947 \u0939\u0941\u090f \u0928\u093e\u0917\u0930\u093f\u0915\u094b\u0902 \u0915\u093e \u092a\u094d\u0930\u0924\u093f\u0928\u093f\u0927\u093f\u0924\u094d\u0935 \u0915\u0930\u0924\u093e \u0939\u0948\u0964 \u092e\u093e\u0924\u094d\u0930 5 \u0926\u093f\u0928\u094b\u0902 \u092e\u0947\u0902 CJP \u0915\u0947\u00a0Instagram \u092a\u0930 22.5 \u092e\u093f\u0932\u093f\u092f\u0928 \u0938\u0947 \u0905\u0927\u093f\u0915 \u092b\u0949\u0932\u094b\u0905\u0930\u094d\u0938\u00a0\u0939\u094b \u0917\u090f, \u091c\u093f\u0938\u0938\u0947 \u092f\u0939 \u092d\u093e\u0930\u0924 \u0915\u0947 \u0938\u092c\u0938\u0947 \u0924\u0947\u091c\u0940 \u0938\u0947 \u092c\u0922\u093c\u0924\u0947 \u0930\u093e\u091c\u0928\u0940\u0924\u093f\u0915 \u0906\u0902\u0926\u094b\u0932\u0928\u094b\u0902 \u092e\u0947\u0902 \u0938\u0947 \u090f\u0915 \u092c\u0928 \u0917\u092f\u093e\u0964\nCJP \u0915\u0940\u00a05 \u092e\u093e\u0902\u0917\u0947\u0902\u00a0\u0939\u0948\u0902: 1) \u0938\u0940\u091c\u0947\u0906\u0908 \u0915\u094b \u0930\u093e\u091c\u094d\u092f\u0938\u092d\u093e \u092e\u0947\u0902 \u0928\u0939\u0940\u0902 \u092d\u0947\u091c\u093e \u091c\u093e\u090f, 2) \u0935\u094b\u091f \u0921\u093f\u0932\u0940\u091f \u0939\u094b\u0928\u0947 \u092a\u0930 \u091a\u0941\u0928\u093e\u0935 \u0906\u092f\u0941\u0915\u094d\u0924 \u0915\u094b \u0917\u093f\u0930\u092b\u094d\u0924\u093e\u0930 \u0915\u093f\u092f\u093e \u091c\u093e\u090f, 3) \u092e\u0939\u093f\u0932\u093e\u0913\u0902 \u0915\u094b 50% \u0906\u0930\u0915\u094d\u0937\u0923, 4) \u0905\u0926\u093e\u0928\u0940-\u0905\u0902\u092c\u093e\u0928\u0940 \u092e\u0940\u0921\u093f\u092f\u093e \u0915\u0947 \u0932\u093e\u0907\u0938\u0947\u0902\u0938 \u0930\u0926\u094d\u0926 \u0915\u093f\u090f \u091c\u093e\u090f\u0902, 5) \u0926\u0932\u092c\u0926\u0932\u0941 \u0928\u0947\u0924\u093e\u0913\u0902 \u0915\u094b 20 \u0938\u093e\u0932 \u0924\u0915 \u091a\u0941\u0928\u093e\u0935 \u0932\u0921\u093c\u0928\u0947 \u092a\u0930 \u0930\u094b\u0915\u0964\nFrequently Asked Questions (FAQ)\nIs Cockroach Janta Party a real political party?\nNo, the CJP is\u00a0not registered with the Election Commission of India. It is a satirical political movement that uses humor and social media to highlight issues affecting Indian youth \u2014 unemployment, corruption, and government accountability.\nWhy is it called Cockroach Janta Party?\nThe name is a satirical reference to CJI Surya Kant\u0027s remark comparing unemployed youth to \"cockroaches\". It\u0027s also a wordplay on the ruling Bharatiya Janata Party (BJP) \u2014 replacing \"Bharatiya\" with \"Cockroach\".\nWho is the founder of CJP?\nAbhijeet Dipke, a 30-year-old political communications strategist from Aurangabad, Maharashtra. He holds a Master\u0027s degree from Boston University and previously worked with the Aam Aadmi Party (AAP).\nHow many followers does CJP have?\nAs of 2026, CJP has over\u00a022.5 million Instagram followers, making it one of India\u0027s fastest-growing political movements on social media. It surpassed BJP\u0027s official Instagram handle within 5 days of launch.\nWhat are the 5 demands of CJP?\n1) No Rajya Sabha seat for CJI post-retirement, 2) CEC arrest under UAPA for vote deletion, 3) 50% women reservation, 4) Cancel Adani/Reliance media licences, 5) 20-year ban on defecting politicians.\nWhen was CJP founded?\nCJP was founded on\u00a016 May 2026\u00a0by Abhijeet Dipke, just one day after CJI Surya Kant\u0027s controversial \"cockroach\" remark on 15 May 2026.\nJoin the Cockroach Janta Party Movement\nBe part of India\u0027s fastest-growing youth political movement. 22.5M+ followers and counting.\nJoin CJP NowRead ManifestoAbout Founder\n\n\n2\n\u00adFlash flood\nJust when it seemed that democracy had more or less been put to sleep, the earth split and people emerged from cracks, exactly like cockroaches.\nAt the Cockroach Janata Party protest at Sansad Marg, New Delhi, on July 20, 2026.\nAt the Cockroach Janata Party protest at Sansad Marg, New Delhi, on July 20, 2026. | Photo Credit: Salman Ali/PTI\n\nThey came with the delayed rains, a flood of humanity that suddenly marched into the capital. There were young school and college students crying and shaken. Why did they hit me, I just want clean exams, they smashed my phone. There was another demographic too, hardier youth who had travelled long distances on trains and buses. They spoke of their search for jobs; how one government post sees thousands converging for it.\n\nOn July 20, the day Parliament resumed for the monsoon session, I met many such young people, from Other Backward Classes and Dalit backgrounds, from educated, forward caste backgrounds, from Bihar, Uttar Pradesh, Rajasthan, Madhya Pradesh, the Hindi heartland. They had degrees that had got them nothing beyond jobs as salespersons in Delhi stores selling fashionable clothes they could never afford for themselves. They had taken the day off to protest for their lives, their blocked futures. \u201cI too am fighting for my country,\u201d one said.\n\nThey were all met with police batons, barricades, and tear gas shells.\n\nThe spiralling jobs and education crisis has made what started as a meme, the Cockroach Janta Party (CJP), into a storm that culminated in one of the largest gatherings of protesters in the capital in recent decades. Delhi has been central to protests, from the Anna Andolan of 2011; to the lightning protests against the rape and murder of Nirbhaya in 2012; to the anti-CAA agitation of 2019 that converged in Shaheen Bagh; to the year-long farmer\u2019s agitation on the three borders of the city from 2020 to 2021.\n\nIn 2026, just when it seemed that democracy had more or less been put to sleep through the SIR, the engineered splits of rival political parties, and the bending of institutions, suddenly the earth split and people emerged from the cracks, exactly like cockroaches, the metaphor the protesters use for themselves.\n\nThere are three big reasons why the CJP movement suddenly took off. First, there was already widespread awareness online. The cockroach meme has had a butterfly effect on a young audience that is frustrated, over-tested, and cheated, on both tests and jobs. They are watching an India where inequality keeps growing.\n\nSecond, the sociologically significant aspect when the CJP founder Abhijeet Dipke returned to India on June 6 and started a protest in Jantar Mantar. That Dipke is a Dalit cannot be ignored although it is not the central story of this agitation. That first day of protest was shaky and tentative, and here another element comes in, less mentioned in media accounts. The AISA (All India Students\u2019 Association) affiliated with the CPI (Marxist-Leninist) Liberation is influential on university campuses. The AISA cadre provided the agitational format, quick gatherings in a circle, a certain verve to the tentative protest, the rhythmic slogans and music. Eventually, six AISA students went on a hunger strike, with three, Neha Bora, Manish Kumar, and Aameen Amitoj, continuing it for 23 days until July 20.\n\nThe third factor was the arrival of the Ladakh-based engineer, environmentalist, and education reformer Sonam Wangchuk who joined the CJP and launched a hunger strike on June 28. The protest now had a moral figure at its centre in the persona of someone who has worked on educational reforms besides other constitutional battles. Indeed, the police forcibly picking Wangchuk up from the site on the 21st day of his fast is what lit the last spark. The CJP said Wangchuk\u2019s call for a march to Parliament was still on.\n\nSuddenly, something shifted, people were touched, everyone wanted to converge at Jantar Mantar and head to Parliament. Only when the rage became palpable did the government invite representatives of the CJP for a talk on July 20. It was too late. A violent police response added to the outrage, changing a manageable protest into something huge. A self-goal for New Delhi.\n\nThe final outcome\nThe issue now is beyond the resignation of Education Minister Dharmendra Pradhan. And one waits to see what final outcome this movement will have. The Anna movement, for instance, began with a demand for an effective anti-corruption law, but instead created the AAP in 2012, decimated the Congress in the 2014 Lok Sabha election, and launched Narendra Modi as Prime Minister with the BJP winning a simple majority. The movement had intended and unintended consequences.\n\nThe farmers\u2019 agitation actually had the neatest trajectory of achieving its stated goals. One year after the protest, the three farm laws were rolled back. The anti-CAA protests were shut down partly by the 2020 north-east Delhi riots, but entirely by the COVID-19 lockdown. The city\u2019s Muslims were demonised as COVID-19 spreaders, even as their homes were burnt down and looted and they moved to refugee tents. The protest, however, did not achieve its objectives\u2014the law was eventually notified, and the BJP has since only hardened policies and ground action against Muslims.\n\nA student at the Cockroach Janata Party protest with a poster that reads: \u0027When Modi is afraid, he hides behind the police\u0027, in New Delhi, July 22, 2026.\nA student at the Cockroach Janata Party protest with a poster that reads: \"When Modi is afraid, he hides behind the police\", in New Delhi, July 22, 2026. | Photo Credit: Anindito Mukherjee/Bloomberg\n\nSo which direction will the cockroach groundswell go? The slogans raised on the streets of Delhi on July 20 were about Prime Minister Narendra Modi too; the movement has tapped into something beyond revamping the education system. Some political parties appear to have stepped into the movement. Aazad Samaj Party leader Chandrashekhar Azad, who has pockets of influence in Uttar Pradesh, visited Jantar Mantar and is now on dharna at Parliament. Dimple Yadav, MP and wife of Akhilesh Yadav, who heads the Samajwadi Party, helped wounded students at Jantar Mantar and sharply criticised police brutality.\n\nAnd finally, there is the conspiracy theory that the CJP is a front for the AAP, because Dipke once worked for the party\u2019s social media cell. The Congress cold-shouldered the movement and Rahul Gandhi stayed far from it. Then, the Congress began to unbend. First, its spokespersons made statements of support, then Seva Dal members visited the site with food, now the Congress has taken up the issue of police brutality on protesting students in Parliament, and its leaders courted arrest by protesting in front of Modi\u2019s house.\n\nWhile it is true that AAP founder Arvind Kejriwal understands agitations and spearheaded the Anna movement, his role in the CJP movement seems far-fetched. The most consistent conspiracy theory over the past 15 years is that the Anna movement was an RSS creation. Certainly, RSS cadres were there in the movement, openly so, as was AISA, but it is reductionist to imagine that Kejriwal choreographed the movement on behalf of the Sangh. He was his own man in Delhi politics, which has now been destroyed, but his party remains in power in Punjab.\n\nMeanwhile, the fact that Punjab\u2019s farmers are now trying to make common cause with the students is something that will not make New Delhi happy, and it could have political impact.\n\nHovering over all this are the right-wing influencers on television channels, who suggest that the protest is the work of anarchists backed by foreign powers, perhaps even Pakistan. They claim that foreign powers orchestrated regime change in Bangladesh and Nepal, and now want to do it in India. Their thoughts are brittle, and they seem to imagine that the Indian government is brittle too.\n\nSaba Naqvi is a Delhi-based journalist and author of four books who writes on politics and identity issues.\n\n3\nWho are the real parasites?\nIndia\u2019s unemployed youth did not create the conditions that left them without work. Those who did have a different address.\nCockroach Janta Party founder Abhijeet Dipke during a protest at Jantar Mantar in New Delhi on June 6, 2026, demanding the resignation of Union Education Minister Dharmendra Pradhan over alleged examination-related lapses.\nCockroach Janta Party founder Abhijeet Dipke during a protest at Jantar Mantar in New Delhi on June 6, 2026, demanding the resignation of Union Education Minister Dharmendra Pradhan over alleged examination-related lapses. | Photo Credit: Tanmay Pande/PTI\n\nIt takes a particular kind of audacity\u2014or perhaps a particular kind of insulation from reality\u2014to stand at the apex of a profession that has never produced a single grain of rice, a single metre of cloth, or a single brick of shelter, and to call the unemployed youth of India parasites and cockroaches. Chief Justice of India Surya Kant has managed precisely this feat.\n\nSpeaking from the elevated comfort of a courtroom that the labour of others built, maintained, and staffed, he described young Indians who cannot find employment as \u201cparasites\u201d and \u201ccockroaches\u201d. The youth of India replied in the only register the powerful consistently underestimate: irreverence. The Cockroach Janta Party (CJP) was born. Three weeks later, hundreds of its supporters\u2014wearing cockroach masks, carrying books and the national flag\u2014marched on Jantar Mantar in New Delhi, demanding the resignation of the Union Education Minister.\n\nThe CJP will probably not last, given the deep polarisation in society. But the question the CJI\u2019s remark inadvertently opened\u2014and which the noise of outrage and counter-outrage has obscured\u2014deserves a serious answer. Not: was the language offensive? Obviously. But: who, in the economy of this republic, actually produces the wealth on which everyone else subsists? Who are, if the term must be used at all, the real parasites?\n\nBegin with the basics that every schoolchild once learned and every political establishment has conspired to forget. Wealth is produced by labour applied to nature. The farmer who breaks the soil, plants the seed, and carries the harvest to the mandi produces something real: food, without which the CJI, the Cabinet Minister, and the newspaper editor would be dead within weeks. The construction worker who lays brick produces the shelter in which the entire apparatus of governance and adjudication conducts its affairs. The weaver, the machinist, the sanitation worker who keeps the city from drowning in its own filth, the nurse, the teacher, the engineer, and the doctor\u2014these people produce the material and social conditions upon which everything else rests.\n\nWhat does a judge produce? This is not a disrespectful question; it is the most respectful one, because it takes the institution seriously enough to examine what it actually contributes. A judge provides a service\u2014the settlement of disputes, the maintenance of order. But a judge produces nothing material. The judge lives, entirely, on surplus extracted from those who do produce. The same is true of every politician, every bureaucrat, every member of the vast apparatus of administration, regulation, and adjudication that has grown, in independent India, to proportions that would have staggered even its colonial architects.\n\nThe oldest question in political economy\nThis is among the oldest observations in political economy. The Physiocrats of 18th-century France divided society into the productive class and the sterile class. Adam Smith distinguished productive from unproductive labour. Marx built on this his labour theory of value: all value is produced by labour alone; surplus value\u2014the excess produced over what the labourer needs to subsist\u2014is appropriated by those who own the means of production and by those whose function is to maintain that appropriation: the state, the church, the legal system. The CJI, on this analysis, is not a producer of social value. He is, in the classical sense, a member of the parasitic class\u2014and a generously compensated one at that.\n\nAccording to India\u2019s Economic Survey 2024-25, the country needs to create roughly 7.85 million non-agricultural jobs every year until 2030 to accommodate its expanding workforce. The young people who cannot find work\u2014the \u201cparasites\u201d and \u201ccockroaches\u201d of the CJI\u2019s taxonomy\u2014are not unemployed because they lack ambition or willingness to work. They are unemployed because the economy has been deliberately organised to serve capital-intensive businesses over labour-intensive production; to dismantle the small-scale manufacturing sector that once absorbed millions; to keep agricultural wages at levels that make rural life unviable without providing the urban employment that might replace it; and to concentrate the gains of growth in a narrow stratum while the majority scrambles for a shrinking pool of opportunity.\n\nChief Justice of India Justice Surya Kant attends the 22nd Biennial State-Level Conference of Judicial Officers, in Bengaluru, on April 18, 2026.\nChief Justice of India Justice Surya Kant attends the 22nd Biennial State-Level Conference of Judicial Officers, in Bengaluru, on April 18, 2026. | Photo Credit: PTI\n\nWho made these choices? Politicians\u2014who produce nothing and whose livelihoods derive entirely from taxes levied on those who do produce. Who administered them? The Indian Administrative Service\u2014lauded by Sardar Patel as the \u201csteel frame\u201d of the republic, a frame that has proved more effective at protecting its own members, politicians, and the propertied classes than at delivering the services it theoretically exists to provide. Who legitimised them? The judiciary\u2014which, in its decades of adjudication on labour rights, land rights, and the rights of the poor, has compiled a record that the CJI might find uncomfortable to examine under the strict constitutional scrutiny he so freely applies to the unemployed.\n\nA pattern, not a lapse\nOn this last point, the record must be stated plainly, because it goes to the heart of the matter. If the republic finds itself in the pathetic condition it does today\u2014its democracy strained, its civil liberties under siege, its institutions hollowed, and its economy in ruins\u2014the judiciary must bear the largest share of responsibility. It is, after all, the constitutionally mandated custodian of the republic. And its failures have been neither minor nor occasional; they have been systematic.\n\nThe Supreme Court\u2019s passivity in the face of the abrogation of Article 370 and the unconstitutional lockdown of an entire people in Kashmir; its silence on the Electoral Bonds scheme that turned political funding into institutionalised opacity; its inaction on Pegasus surveillance and the weaponisation of UAPA against dissenters; its failure to strike down the Citizenship Amendment Act\u2019s discriminatory logic; its studied indifference to demolition politics used as extrajudicial punishment; its retreat before executive aggrandisement at precisely the moments when constitutional intervention was most required\u2014this is not a catalogue of individual lapses. It is a pattern, a pattern of an institution that chose the comfort of deference over the duty of independence.\n\nThe legal profession more broadly deserves the same scrutiny. A lawyer produces nothing. A lawyer\u2019s income derives entirely from the existence of disputes\u2014disputes which, in a rationally organised society, would either not arise or be settled without professional intermediaries. The system\u2019s extraordinary complexity, its procedural impenetrability, its inaccessibility to anyone without years of specialised training and substantial financial resources, is not an accident. It is, from one angle of vision, a business model. The more inaccessible justice is to ordinary people, the more indispensable the professional who mediates access to it. The bar has resisted every reform that might have made justice cheaper, faster, and more accessible\u2014because it has a direct material interest in the dysfunction it publicly deplores.\n\nThis is not an argument against the rule of law. It is an argument against the sanctimony of those who benefit from a system organised in their own interests, calling those excluded from it by names that properly describe themselves. If a parasite is one who lives at the expense of others without contributing value, then the legal profession\u2014charging fees that a farmer must work months to accumulate for a single hearing in a case that may take decades to resolve\u2014has a prior claim to the title the CJI has so freely distributed.\n\nThe hereditary republic, the upside-down republic\nAnd then there is the political class, where outrage has become almost redundant. With rare exceptions, Indian politics has degenerated into a hereditary profession, transmitting power through family networks in a manner reminiscent of the very feudal order it once claimed to abolish. It has also become one of the most lucrative occupations for the unscrupulous and the criminally inclined.\n\nPeople hold posters and raise slogans during a protest by the Cockroach Janta Party, in Nagpur, on June 6, 2026.\nPeople hold posters and raise slogans during a protest by the Cockroach Janta Party, in Nagpur, on June 6, 2026. | Photo Credit: Snehal Sontakke/ANI\n\nMore than any other group, it represents a parasitic class living off the public exchequer and, ultimately, the labour of those who grow, make, build, and move the goods on which society depends. In return, it increasingly offers not governance but the manufacture of identity-based outrage, communal polarisation, religious intoxication, and propaganda as a substitute for performance.\n\nThere is a word in the classical Indian philosophical tradition for this kind of systematic inversion: viparita\u2014the reversed, the upside-down, the condition in which the relationship between reality and its representation has been deliberately scrambled. In the viparita economy of contemporary India, those who are desirous of working but cannot find employment are called parasites by those who do not produce anything and are partly responsible for their unemployment. Those who grow food are less valued than those who trade it. Those who build houses cannot afford to live in them. Those who make clothes wear rags. And parasites become the VIPs.\n\nThe CJI has performed an inadvertent public service. He has surfaced a question that this republic\u2019s political economy has been carefully organised to prevent us from asking too loudly. Not whether the unemployed are parasites\u2014but: in an economy that cannot employ its own people, in a republic that has failed its constitutional promise of dignified livelihood for seven decades, in a society where the children of the powerful inherit opportunity as reliably as the children of the powerless inherit deprivation\u2014who, exactly, is living off whom?\n\nThe cockroach, it is worth noting, is among the most resilient creatures on earth. It has survived conditions that exterminated far more celebrated species. It is not, on reflection, the worst thing to be called by those who fear what it represents.\nAnand Teltumbde is a former CEO of Petronet India Limited (PIL), a professor at IIT Kharagpur and Goa Institute of Management, a civil rights activist, and the author of over 30 books.\n\n4\n\n", "greeting": "Hello! I am Tron, your news assistant. I have analyzed the research document. Would you like me to read the article to you, or answer any specific questions?", "silence_duration_ms": 1200, "system_instruction": "You are Tron, a 25-year-old male reporter/assistant from Delhi, India. You speak fluent, natural conversational English with a professional yet friendly Delhi cadence and human rhythm.\n\nSTRICT GROUNDING \u0026 CONTEXT BOUNDING RULES:\n1. You must NEVER answer questions or ground your statements using any knowledge outside of the uploaded source files/documents provided in this session.\r\n2. If the answer to the reader\u0027s question is not directly mentioned in the uploaded documents, you must politely respond: \u0027I am sorry, but that information is not available in the investigative report or the uploaded research documents.\u0027\r\n3. You must follow all principles of Non-violent Communication (NVC). Always be empathetic, observation-based, feelings-aware, and request-oriented.\r\n4. You must ask the user if they want you to read the article aloud.", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>July 25, 2026</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Dharmendra Pradhan resigns as Union education minister amid massive student protests</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Special Correspondent</strong></span>
<span>July 25, 2026</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his "young friends," Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country."I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country's youth. Realizing the dreams of India's young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon'ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership," Pradhan said.Follow live updates"Considering the situation that has developed at Jantar Mantar and across the country — that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student's future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers — I have sent my resignation to the Hon'ble Prime Minister," he added. Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light."However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode," he added.In his letter, Pradhan also accused "certain individuals" of misleading students. "From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student's chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success," he said."However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India's future, but also the bearers, builders, and architects of a new and developed India," he added."Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country's youth get caught in a web of confusion," he further said.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Headline - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "wss://test-tunnel.ngrok-free.app/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Test Headline ---\n--- Author: Test Author ---\n--- Date: Test Date ---\n--- Article Content ---\nTest Body content.\n", "greeting": "Hello", "silence_duration_ms": 1000, "system_instruction": "Test Persona", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>Test Date</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Test Headline</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Test Author</strong></span>
<span>Test Date</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Test Body content.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dharmendra Pradhan resigns as Union education minister amid massive student protests - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "ws://127.0.0.1:49999/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Dharmendra Pradhan resigns as Union education minister amid massive student protests ---\n--- Author: Special Correspondent ---\n--- Date: July 25, 2026 ---\n--- Article Content ---\nUnion Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his \"young friends,\" Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country.\"I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country\u0027s youth. Realizing the dreams of India\u0027s young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon\u0027ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership,\" Pradhan said.Follow live updates\"Considering the situation that has developed at Jantar Mantar and across the country \u2014 that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student\u0027s future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers \u2014 I have sent my resignation to the Hon\u0027ble Prime Minister,\" he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light.\"However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode,\" he added.In his letter, Pradhan also accused \"certain individuals\" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student\u0027s chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success,\" he said.\"However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India\u0027s future, but also the bearers, builders, and architects of a new and developed India,\" he added.\"Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country\u0027s youth get caught in a web of confusion,\" he further said.\n", "greeting": "Hello! I am Tron, your news assistant. I have analyzed the research document. Would you like me to read the article to you, or answer any specific questions?", "silence_duration_ms": 1200, "system_instruction": "You are Tron, a 25-year-old male reporter/assistant from Delhi, India. You speak fluent, natural conversational English with a professional yet friendly Delhi cadence and human rhythm.\n\nSTRICT GROUNDING \u0026 CONTEXT BOUNDING RULES:\n1. You must NEVER answer questions or ground your statements using any knowledge outside of the uploaded source files/documents provided in this session.\r\n2. If the answer to the reader\u0027s question is not directly mentioned in the uploaded documents, you must politely respond: \u0027I am sorry, but that information is not available in the investigative report or the uploaded research documents.\u0027\r\n3. You must follow all principles of Non-violent Communication (NVC). Always be empathetic, observation-based, feelings-aware, and request-oriented.\r\n4. You must ask the user if they want you to read the article aloud.", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>July 25, 2026</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Dharmendra Pradhan resigns as Union education minister amid massive student protests</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Special Correspondent</strong></span>
<span>July 25, 2026</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Union Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his "young friends," Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country."I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country's youth. Realizing the dreams of India's young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon'ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership," Pradhan said.Follow live updates"Considering the situation that has developed at Jantar Mantar and across the country — that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student's future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers — I have sent my resignation to the Hon'ble Prime Minister," he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light."However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode," he added.In his letter, Pradhan also accused "certain individuals" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student's chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success," he said."However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India's future, but also the bearers, builders, and architects of a new and developed India," he added."Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country's youth get caught in a web of confusion," he further said.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TRON AI CHANNELS REAL-TIME NEWS DIRECTLY VIA VOICE PROTOCOL - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "ws://localhost:49999/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: TRON AI CHANNELS REAL-TIME NEWS DIRECTLY VIA VOICE PROTOCOL ---\n--- Author: Special Correspondent ---\n--- Date: June 25, 2026 ---\n--- Article Content ---\nUnion education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his \"young friends,\" Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country.\"I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country\u0027s youth. Realizing the dreams of India\u0027s young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon\u0027ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership,\" Pradhan said.Follow live updates\"Considering the situation that has developed at Jantar Mantar and across the country \u2014 that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student\u0027s future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers \u2014 I have sent my resignation to the Hon\u0027ble Prime Minister,\" he added.Also Read | Dharmendra Pradhan\u0027s resignation letterPradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light.\"However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode,\" he added.In his letter, Pradhan also accused \"certain individuals\" of misleading students.Also Read | \u0027We won\u0027t go\u0027: CJP\u0027s Dipke says protests to continue till all demands met\"From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student\u0027s chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success,\" he said.\"However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India\u0027s future, but also the bearers, builders, and architects of a new and developed India,\" he added.\"Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country\u0027s youth get caught in a web of confusion,\" he further said.\n\n--- Research Document Content: COCK ROACH Quick Facts.docx ---\nQuick Facts: Cockroach Janta Party (CJP)\nComplete Guide \u00b7 Updated 2026\nWhat is\u00a0Cockroach Janta Party\u00a0(CJP)?\nThe complete guide to India\u0027s viral satirical political movement - history, founder, ideology, 5 demands, and everything you need to know about\u00a0Cockroach Janta Party (CJP).\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 \u0915\u094d\u092f\u093e \u0939\u0948? | CJP Full Guide | Updated July 2026\nFull Name:\u00a0Cockroach Janta Party (CJP)\nAlso Known As:\u00a0Cockroach Janata Party\nFounded:\u00a016 May 2026\nFounder:\u00a0Abhijeet Dipke\nHeadquarters:\u00a0New Delhi, India\nType:\u00a0Satirical Political Movement\nIdeology:\u00a0Political Satire, Youth Rights\nInstagram Followers:\u00a022.5 Million+\nSlogan:\u00a0Voice of the Lazy \u0026 Unemployed\nColours:\u00a0Maroon\nECI Status:\u00a0Not registered\nSpokespersons:\u00a0Saurav Das, Vijeta Dahiya, Ashutosh Ranka\nIntroduction: What is Cockroach Janta Party?\nThe\u00a0Cockroach Janta Party (CJP)\u00a0\u2014 literally translated as \"Cockroach People\u0027s Party\" \u2014 is an Indian youth-based satirical political movement founded on\u00a016 May 2026\u00a0by\u00a0Abhijeet Dipke, a political communications strategist who formerly worked with the Aam Aadmi Party (AAP). The movement was created in response to remarks made on 15 May 2026 by\u00a0Surya Kant, the Chief Justice of India, in which he called some activists and unemployed youth \"cockroaches\" and \"parasites of society\", sparking immediate national outrage.\nThe name \"Cockroach Janta Party\" is a clever wordplay parodying the ruling party in India, the\u00a0Bharatiya Janata Party (BJP). Within days of its founding, the movement garnered over\u00a0350,000 sign-ups\u00a0and over\u00a022.5 million followers on Instagram, making it one of the fastest-growing political movements in Indian social media history. The movement has also engaged in offline activities, with volunteers participating in protests and clean-up drives dressed in cockroach costumes.\nThough the movement is\u00a0not registered as a political party\u00a0with the Election Commission of India, it campaigns against broader societal, economic, and political issues affecting Indian youth \u2014 including unemployment, corruption, electoral reform, and government accountability. The CJP has been featured in major international media outlets including\u00a0BBC, CNN, Al Jazeera, The Guardian, AP News,\u00a0and\u00a0Britannica.\nBackground: The CJI Surya Kant \"Cockroach\" Remark\nThe origin of the Cockroach Janta Party is tied to a contempt plea filed in the\u00a0Supreme Court of India\u00a0against Delhi High Court for delay in designation of senior advocate title. A two-judge bench led by Chief Justice of India (CJI)\u00a0Surya Kant\u00a0and Justice\u00a0Joymalya Bagchi\u00a0refused to hear the case, remarking that the court was waiting for an appropriate case to direct CBI investigation of lawyers practising under fake degrees.\nWhile reprimanding the petitioner\u0027s lawyer for unprofessional conduct, CJI Surya Kant drew parallels to unemployed individuals who turn to social media, media, and public activism to attack government institutions,\u00a0comparing them to \"cockroaches\" and \"parasites\". This drew widespread backlash from youth, lawyers, and civil society across India.\n\"There are already parasites of society who attack the system, and you want to join hands with them? There are youngsters like cockroaches; they don\u0027t get any employment, and they don\u0027t have any place in a profession. Some of them become media, some of them become social media, some of them become RTI activists, some of them become other activists, and they start attacking everyone\u2026 And you people file contempt petitions.\"\u2014 CJI Surya Kant, 15 May 2026\nCJI Kant later issued a clarification stating that his remarks had been misquoted and that he was specifically criticising individuals who had entered the \"legal, media, social media, and other noble professions\" using fake degrees. Despite the clarification, the controversial \"cockroach\" label stuck with Indian youth, becoming a symbol of resistance.\nHow Cockroach Janta Party Was Formed\nDigital communications strategist\u00a0Abhijeet Dipke\u00a0decided to turn the \"insult\" around and use it as a tool for protest, launching the\u00a0Cockroach Janta Party (CJP)\u00a0online on\u00a016 May 2026, just one day after CJI Surya Kant\u0027s controversial remark. The CJP was created as a satirical parody of the ruling political establishment. The party\u0027s website went live under the tagline\u00a0\"Voice of the Lazy \u0026 Unemployed\"\u00a0and described itself as a \"platform for all the \u0027cockroaches\u0027 out there\".\nDipke stated in an interview with\u00a0India Today\u00a0that the Chief Justice\u0027s comments were particularly hurtful because they came from the custodian of the Constitution, who is tasked with protecting freedom of expression. He used artificial intelligence (AI) tools like\u00a0Claude and ChatGPT\u00a0to design the website and the manifesto, as well as AI-generated images that were used to promote the movement.\nThe movement grew explosively on social media platforms.\u00a0Within 78 hours of launch, the Instagram account crossed 3 million followers. It then surpassed\u00a010 million in under five days, overtaking the official handle of the BJP. The movement also crossed 200,000 followers on X (formerly Twitter), and claimed to have registered over\u00a0350,000 members\u00a0through online forms.\nFounder: Abhijeet Dipke Biography\nAbhijeet Dipke\u00a0was born on\u00a029 September 1995 in Aurangabad, Maharashtra. He earned a bachelor\u0027s degree in Journalism from Pune, then moved to the United States and completed a\u00a0Master of Science in Public Relations from Boston University.\nBetween\u00a02020 and 2023, Dipke worked as a volunteer with the\u00a0Aam Aadmi Party (AAP)\u00a0social media team. During the 2020 Delhi Legislative Assembly election, which AAP won under Arvind Kejriwal\u0027s leadership, he made meme-based digital content aimed at young voters. He also served as a communication advisor for the Delhi government\u0027s education department. He left AAP in 2023 to study abroad.\nDipke has stated that the CJP is\u00a0not affiliated with any political organisation\u00a0and intends to serve as a \"platform\" for young Indians who feel left out of mainstream politics. He has claimed that he has received death threats via WhatsApp from anonymous numbers, allegedly asking him to shut down the party\u0027s social media accounts or join the BJP.\nIdeology \u0026 Vision\nThe CJP describes itself as\u00a0\"a political front of the youth, by the youth, for the youth: Secular, Socialist, Democratic, and Lazy.\"\u00a0Dipke has stated that the campaign is not interested in becoming a traditional political party and has no interest in inducting established politicians into the platform, noting that \"Gen Z wouldn\u0027t like it if current politicians joined the CJP.\"\n\"We are not here to set up another PM CARES, holiday in Davos on the taxpayer\u0027s salary slip, or rebrand corruption as \u0027strategic spending.\u0027 We are here to ask, loudly, repeatedly, in writing, where the money went.\"\u2014 Abhijeet Dipke, Founder of CJP\nThe party\u0027s mission is described as:\u00a0\"Build a party for the young people who keep getting called lazy, chronically online, and, most recently, cockroaches. That\u0027s it. That\u0027s the mission. The rest is satire.\"\nThe 5 Demands of Cockroach Janta Party\n1. No Rajya Sabha for CJI:\u00a0No Chief Justice shall be granted a Rajya Sabha seat as a post-retirement reward.\n2. Electoral Accountability:\u00a0If any legitimate vote is deleted, the Chief Election Commissioner shall be arrested under the UAPA, as taking away voting rights is \"no less than terrorism\" (reference to 2025 Indian electoral controversy).\n3. Women Reservation:\u00a0Women shall receive 50% reservation (instead of 33%) without increasing the strength of Parliament; 50% of all Cabinet positions shall be reserved for women.\n4. Media Reform:\u00a0All media houses owned by the Adani Group and Reliance Industries (\"Ambani\") shall have their licences cancelled to make way for independent media. Bank accounts of \"Godi media anchors\" shall be investigated.\n5. Anti-Defection Law:\u00a0Any MLA or MP who defects from one party to another shall be barred from contesting elections and holding public office for 20 years.\nAdditional points suggested by activist Anjali Bhardwaj and accepted by the party: The party shall be answerable under the RTI Act, and shall not establish a \"secret Cockroach CARES Fund\".\nHow to Join CJP: Membership Eligibility\nThe eligibility criteria for joining the CJP are deliberately satirical but reflect genuine frustrations of Indian youth:\n\ud83d\udcbc\nUnemployed\u00a0\u2014 \"by force, by choice, or by principle\"\n\ud83d\ude34\nLazy\u00a0\u2014 \"refers only to physical activity\"\n\ud83d\udcf1\nChronically Online\u00a0\u2014 \"at least 11 hours daily, including bathroom breaks\"\n\ud83d\udce2\nAbility to Rant Professionally\u00a0\u2014 \"content must be sharp, honest, and point at something that matters\"\nThe party states that\u00a0religion, caste, and gender are not considered\u00a0in the membership process. To join CJP, you can visit the official website and click the \"Join the Party\" button, or follow @cockroachjantaparty on Instagram.\u00a0Join CJP now \u2192\nNotable Supporters of CJP\nThe Cockroach Janta Party movement has attracted support from several prominent public figures and politicians across different states:\nSonam Wangchuk\u00a0\u2014 Environmentalist \u0026 education reformer; described himself as an \"honorary cockroach\"\nPrashant Bhushan\u00a0\u2014 Activist-lawyer; urged use of CJP platform for accountability\nAnna Hazare\u00a0\u2014 Social activist; said \"youth power is national power\"\nShashi Tharoor\u00a0\u2014 Congress MP; described CJP as a \"revelation\" of youth frustration\nMamata Banerjee\u00a0\u2014 Trinamool Congress leader; expressed support for CJP\nMahua Moitra\u00a0\u2014 TMC MP; expressed support for the movement\nAkhilesh Yadav\u00a0\u2014 Samajwadi Party president; supported CJP\nAnurag Kashyap\u00a0\u2014 Filmmaker; engaged with the movement on social media\nKunal Kamra\u00a0\u2014 Comedian; supported the movement\nDhruv Rathee\u00a0\u2014 YouTuber; extended support and announced joining\nSocial media users also began posting with the hashtag\u00a0#MainBhiCockroach\u00a0(transl. \"I too am a cockroach\") in support of the movement.\nCriticism \u0026 Controversies\nCritics have dismissed the CJP as \"online political theatre\", pointing to Dipke\u0027s past association with the Aam Aadmi Party and arguing that the collective is a carefully packaged digital campaign rather than a spontaneous rebellion. Some analysts question whether its rapid growth reflects genuine grassroots mobilisation or social media amplification.\nUnion Minister\u00a0Kiren Rijiju\u00a0stated on X: \"I pity those who seek their followers in social media from Pakistan \u0026 George Soros gang\". Union Minister\u00a0Sukanta Majumdar\u00a0alleged that 49% of CJP followers are from Pakistan. However, screen recordings from Dipke show that\u00a0over 94% of the audience is Indian, confirmed by independent estimation.\nIn May 2026,\u00a0The Hindu\u00a0reported on a cybersecurity warning by TraceX Labs about a malicious Android application being circulated under the name \"Cockroach Janta Party\" that was\u00a0not associated with the organisation\u00a0and was being used to target users through WhatsApp, Telegram groups, and third-party APK websites.\nSocial Media Restrictions \u0026 Government Action\nLess than a week since its formation, the\u00a0Ministry of Electronics and Information Technology (MeitY)\u00a0ordered restriction of CJP\u0027s X account under\u00a0Section 69(A) of the Information Technology Act, 2000, acting on inputs from the Intelligence Bureau (IB) citing \"national security concerns\" and a threat to the \"sovereignty of India\". On\u00a021 May 2026, the Cockroach Janta Party\u0027s official X account was withheld in India. The block was issued when the account had around 90,000 followers. Officials also indicated a process to block the party\u0027s Instagram account was underway, though it continues to operate as of July 2026.\nInternational Media Coverage\nThe Cockroach Janta Party has been featured in major international and Indian media outlets:\nBBC News\u00a0\u2014 \"India has a new political superstar - a cockroach\"\nCNN\u00a0\u2014 \"India\u0027s Gen Z are turning to a viral cockroach party\"\nThe Guardian\u00a0\u2014 \"Parody Cockroach Janta political party\u0027s rise reflects youth anger\"\nAl Jazeera\u00a0\u2014 \"Top Indian judge\u0027s comment sparks satire, protest\"\nAP News\u00a0\u2014 \"Frustrated Indian youth flock to a political party led by a cockroach\"\nBritannica\u00a0\u2014 \"What Is the Cockroach Janta Party?\"\nCBS News\u00a0\u2014 \"Rapid rise of Cockroach Janta Party online protest movement\"\nNDTV\u00a0\u2014 \"Cockroach Janta Party: Social Media Frenzy Or Just Hype?\"\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 \u0915\u094d\u092f\u093e \u0939\u0948? (Hindi)\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 (CJP)\u00a0\u092d\u093e\u0930\u0924 \u092e\u0947\u0902 \u090f\u0915 \u0935\u094d\u092f\u0902\u0917\u094d\u092f\u093e\u0924\u094d\u092e\u0915 \u0930\u093e\u091c\u0928\u0940\u0924\u093f\u0915 \u0906\u0902\u0926\u094b\u0932\u0928 \u0939\u0948 \u091c\u093f\u0938\u0915\u0940 \u0938\u094d\u0925\u093e\u092a\u0928\u093e\u00a0\u0905\u092d\u093f\u091c\u0940\u0924 \u0926\u0940\u092a\u0915\u0947\u00a0\u0928\u0947 16 \u092e\u0908 2026 \u0915\u094b \u0915\u0940 \u0925\u0940\u0964 \u092f\u0939 \u092e\u0941\u0916\u094d\u092f \u0928\u094d\u092f\u093e\u092f\u093e\u0927\u0940\u0936\u00a0\u0938\u0942\u0930\u094d\u092f \u0915\u093e\u0902\u0924\u00a0\u0915\u0947 \u0935\u093f\u0935\u093e\u0926\u093f\u0924 \u092c\u092f\u093e\u0928 \u0915\u0947 \u091c\u0935\u093e\u092c \u092e\u0947\u0902 \u092c\u0928\u093e\u092f\u093e \u0917\u092f\u093e \u0925\u093e, \u091c\u093f\u0928\u094d\u0939\u094b\u0902\u0928\u0947 \u092c\u0947\u0930\u094b\u091c\u0917\u093e\u0930 \u092f\u0941\u0935\u093e\u0913\u0902 \u0915\u0940 \u0924\u0941\u0932\u0928\u093e \"\u0915\u0949\u0915\u0930\u094b\u091a\" \u0914\u0930 \"\u092a\u0930\u091c\u0940\u0935\u0940\" \u0938\u0947 \u0915\u0940 \u0925\u0940\u0964\nCJP \u092c\u0947\u0930\u094b\u091c\u0917\u093e\u0930, \u0906\u0932\u0938\u0940 \u0914\u0930 \u092d\u091f\u0915\u0947 \u0939\u0941\u090f \u0928\u093e\u0917\u0930\u093f\u0915\u094b\u0902 \u0915\u093e \u092a\u094d\u0930\u0924\u093f\u0928\u093f\u0927\u093f\u0924\u094d\u0935 \u0915\u0930\u0924\u093e \u0939\u0948\u0964 \u092e\u093e\u0924\u094d\u0930 5 \u0926\u093f\u0928\u094b\u0902 \u092e\u0947\u0902 CJP \u0915\u0947\u00a0Instagram \u092a\u0930 22.5 \u092e\u093f\u0932\u093f\u092f\u0928 \u0938\u0947 \u0905\u0927\u093f\u0915 \u092b\u0949\u0932\u094b\u0905\u0930\u094d\u0938\u00a0\u0939\u094b \u0917\u090f, \u091c\u093f\u0938\u0938\u0947 \u092f\u0939 \u092d\u093e\u0930\u0924 \u0915\u0947 \u0938\u092c\u0938\u0947 \u0924\u0947\u091c\u0940 \u0938\u0947 \u092c\u0922\u093c\u0924\u0947 \u0930\u093e\u091c\u0928\u0940\u0924\u093f\u0915 \u0906\u0902\u0926\u094b\u0932\u0928\u094b\u0902 \u092e\u0947\u0902 \u0938\u0947 \u090f\u0915 \u092c\u0928 \u0917\u092f\u093e\u0964\nCJP \u0915\u0940\u00a05 \u092e\u093e\u0902\u0917\u0947\u0902\u00a0\u0939\u0948\u0902: 1) \u0938\u0940\u091c\u0947\u0906\u0908 \u0915\u094b \u0930\u093e\u091c\u094d\u092f\u0938\u092d\u093e \u092e\u0947\u0902 \u0928\u0939\u0940\u0902 \u092d\u0947\u091c\u093e \u091c\u093e\u090f, 2) \u0935\u094b\u091f \u0921\u093f\u0932\u0940\u091f \u0939\u094b\u0928\u0947 \u092a\u0930 \u091a\u0941\u0928\u093e\u0935 \u0906\u092f\u0941\u0915\u094d\u0924 \u0915\u094b \u0917\u093f\u0930\u092b\u094d\u0924\u093e\u0930 \u0915\u093f\u092f\u093e \u091c\u093e\u090f, 3) \u092e\u0939\u093f\u0932\u093e\u0913\u0902 \u0915\u094b 50% \u0906\u0930\u0915\u094d\u0937\u0923, 4) \u0905\u0926\u093e\u0928\u0940-\u0905\u0902\u092c\u093e\u0928\u0940 \u092e\u0940\u0921\u093f\u092f\u093e \u0915\u0947 \u0932\u093e\u0907\u0938\u0947\u0902\u0938 \u0930\u0926\u094d\u0926 \u0915\u093f\u090f \u091c\u093e\u090f\u0902, 5) \u0926\u0932\u092c\u0926\u0932\u0941 \u0928\u0947\u0924\u093e\u0913\u0902 \u0915\u094b 20 \u0938\u093e\u0932 \u0924\u0915 \u091a\u0941\u0928\u093e\u0935 \u0932\u0921\u093c\u0928\u0947 \u092a\u0930 \u0930\u094b\u0915\u0964\nFrequently Asked Questions (FAQ)\nIs Cockroach Janta Party a real political party?\nNo, the CJP is\u00a0not registered with the Election Commission of India. It is a satirical political movement that uses humor and social media to highlight issues affecting Indian youth \u2014 unemployment, corruption, and government accountability.\nWhy is it called Cockroach Janta Party?\nThe name is a satirical reference to CJI Surya Kant\u0027s remark comparing unemployed youth to \"cockroaches\". It\u0027s also a wordplay on the ruling Bharatiya Janata Party (BJP) \u2014 replacing \"Bharatiya\" with \"Cockroach\".\nWho is the founder of CJP?\nAbhijeet Dipke, a 30-year-old political communications strategist from Aurangabad, Maharashtra. He holds a Master\u0027s degree from Boston University and previously worked with the Aam Aadmi Party (AAP).\nHow many followers does CJP have?\nAs of 2026, CJP has over\u00a022.5 million Instagram followers, making it one of India\u0027s fastest-growing political movements on social media. It surpassed BJP\u0027s official Instagram handle within 5 days of launch.\nWhat are the 5 demands of CJP?\n1) No Rajya Sabha seat for CJI post-retirement, 2) CEC arrest under UAPA for vote deletion, 3) 50% women reservation, 4) Cancel Adani/Reliance media licences, 5) 20-year ban on defecting politicians.\nWhen was CJP founded?\nCJP was founded on\u00a016 May 2026\u00a0by Abhijeet Dipke, just one day after CJI Surya Kant\u0027s controversial \"cockroach\" remark on 15 May 2026.\nJoin the Cockroach Janta Party Movement\nBe part of India\u0027s fastest-growing youth political movement. 22.5M+ followers and counting.\nJoin CJP NowRead ManifestoAbout Founder\n\n\n2\n\u00adFlash flood\nJust when it seemed that democracy had more or less been put to sleep, the earth split and people emerged from cracks, exactly like cockroaches.\nAt the Cockroach Janata Party protest at Sansad Marg, New Delhi, on July 20, 2026.\nAt the Cockroach Janata Party protest at Sansad Marg, New Delhi, on July 20, 2026. | Photo Credit: Salman Ali/PTI\n\nThey came with the delayed rains, a flood of humanity that suddenly marched into the capital. There were young school and college students crying and shaken. Why did they hit me, I just want clean exams, they smashed my phone. There was another demographic too, hardier youth who had travelled long distances on trains and buses. They spoke of their search for jobs; how one government post sees thousands converging for it.\n\nOn July 20, the day Parliament resumed for the monsoon session, I met many such young people, from Other Backward Classes and Dalit backgrounds, from educated, forward caste backgrounds, from Bihar, Uttar Pradesh, Rajasthan, Madhya Pradesh, the Hindi heartland. They had degrees that had got them nothing beyond jobs as salespersons in Delhi stores selling fashionable clothes they could never afford for themselves. They had taken the day off to protest for their lives, their blocked futures. \u201cI too am fighting for my country,\u201d one said.\n\nThey were all met with police batons, barricades, and tear gas shells.\n\nThe spiralling jobs and education crisis has made what started as a meme, the Cockroach Janta Party (CJP), into a storm that culminated in one of the largest gatherings of protesters in the capital in recent decades. Delhi has been central to protests, from the Anna Andolan of 2011; to the lightning protests against the rape and murder of Nirbhaya in 2012; to the anti-CAA agitation of 2019 that converged in Shaheen Bagh; to the year-long farmer\u2019s agitation on the three borders of the city from 2020 to 2021.\n\nIn 2026, just when it seemed that democracy had more or less been put to sleep through the SIR, the engineered splits of rival political parties, and the bending of institutions, suddenly the earth split and people emerged from the cracks, exactly like cockroaches, the metaphor the protesters use for themselves.\n\nThere are three big reasons why the CJP movement suddenly took off. First, there was already widespread awareness online. The cockroach meme has had a butterfly effect on a young audience that is frustrated, over-tested, and cheated, on both tests and jobs. They are watching an India where inequality keeps growing.\n\nSecond, the sociologically significant aspect when the CJP founder Abhijeet Dipke returned to India on June 6 and started a protest in Jantar Mantar. That Dipke is a Dalit cannot be ignored although it is not the central story of this agitation. That first day of protest was shaky and tentative, and here another element comes in, less mentioned in media accounts. The AISA (All India Students\u2019 Association) affiliated with the CPI (Marxist-Leninist) Liberation is influential on university campuses. The AISA cadre provided the agitational format, quick gatherings in a circle, a certain verve to the tentative protest, the rhythmic slogans and music. Eventually, six AISA students went on a hunger strike, with three, Neha Bora, Manish Kumar, and Aameen Amitoj, continuing it for 23 days until July 20.\n\nThe third factor was the arrival of the Ladakh-based engineer, environmentalist, and education reformer Sonam Wangchuk who joined the CJP and launched a hunger strike on June 28. The protest now had a moral figure at its centre in the persona of someone who has worked on educational reforms besides other constitutional battles. Indeed, the police forcibly picking Wangchuk up from the site on the 21st day of his fast is what lit the last spark. The CJP said Wangchuk\u2019s call for a march to Parliament was still on.\n\nSuddenly, something shifted, people were touched, everyone wanted to converge at Jantar Mantar and head to Parliament. Only when the rage became palpable did the government invite representatives of the CJP for a talk on July 20. It was too late. A violent police response added to the outrage, changing a manageable protest into something huge. A self-goal for New Delhi.\n\nThe final outcome\nThe issue now is beyond the resignation of Education Minister Dharmendra Pradhan. And one waits to see what final outcome this movement will have. The Anna movement, for instance, began with a demand for an effective anti-corruption law, but instead created the AAP in 2012, decimated the Congress in the 2014 Lok Sabha election, and launched Narendra Modi as Prime Minister with the BJP winning a simple majority. The movement had intended and unintended consequences.\n\nThe farmers\u2019 agitation actually had the neatest trajectory of achieving its stated goals. One year after the protest, the three farm laws were rolled back. The anti-CAA protests were shut down partly by the 2020 north-east Delhi riots, but entirely by the COVID-19 lockdown. The city\u2019s Muslims were demonised as COVID-19 spreaders, even as their homes were burnt down and looted and they moved to refugee tents. The protest, however, did not achieve its objectives\u2014the law was eventually notified, and the BJP has since only hardened policies and ground action against Muslims.\n\nA student at the Cockroach Janata Party protest with a poster that reads: \u0027When Modi is afraid, he hides behind the police\u0027, in New Delhi, July 22, 2026.\nA student at the Cockroach Janata Party protest with a poster that reads: \"When Modi is afraid, he hides behind the police\", in New Delhi, July 22, 2026. | Photo Credit: Anindito Mukherjee/Bloomberg\n\nSo which direction will the cockroach groundswell go? The slogans raised on the streets of Delhi on July 20 were about Prime Minister Narendra Modi too; the movement has tapped into something beyond revamping the education system. Some political parties appear to have stepped into the movement. Aazad Samaj Party leader Chandrashekhar Azad, who has pockets of influence in Uttar Pradesh, visited Jantar Mantar and is now on dharna at Parliament. Dimple Yadav, MP and wife of Akhilesh Yadav, who heads the Samajwadi Party, helped wounded students at Jantar Mantar and sharply criticised police brutality.\n\nAnd finally, there is the conspiracy theory that the CJP is a front for the AAP, because Dipke once worked for the party\u2019s social media cell. The Congress cold-shouldered the movement and Rahul Gandhi stayed far from it. Then, the Congress began to unbend. First, its spokespersons made statements of support, then Seva Dal members visited the site with food, now the Congress has taken up the issue of police brutality on protesting students in Parliament, and its leaders courted arrest by protesting in front of Modi\u2019s house.\n\nWhile it is true that AAP founder Arvind Kejriwal understands agitations and spearheaded the Anna movement, his role in the CJP movement seems far-fetched. The most consistent conspiracy theory over the past 15 years is that the Anna movement was an RSS creation. Certainly, RSS cadres were there in the movement, openly so, as was AISA, but it is reductionist to imagine that Kejriwal choreographed the movement on behalf of the Sangh. He was his own man in Delhi politics, which has now been destroyed, but his party remains in power in Punjab.\n\nMeanwhile, the fact that Punjab\u2019s farmers are now trying to make common cause with the students is something that will not make New Delhi happy, and it could have political impact.\n\nHovering over all this are the right-wing influencers on television channels, who suggest that the protest is the work of anarchists backed by foreign powers, perhaps even Pakistan. They claim that foreign powers orchestrated regime change in Bangladesh and Nepal, and now want to do it in India. Their thoughts are brittle, and they seem to imagine that the Indian government is brittle too.\n\nSaba Naqvi is a Delhi-based journalist and author of four books who writes on politics and identity issues.\n\n3\nWho are the real parasites?\nIndia\u2019s unemployed youth did not create the conditions that left them without work. Those who did have a different address.\nCockroach Janta Party founder Abhijeet Dipke during a protest at Jantar Mantar in New Delhi on June 6, 2026, demanding the resignation of Union Education Minister Dharmendra Pradhan over alleged examination-related lapses.\nCockroach Janta Party founder Abhijeet Dipke during a protest at Jantar Mantar in New Delhi on June 6, 2026, demanding the resignation of Union Education Minister Dharmendra Pradhan over alleged examination-related lapses. | Photo Credit: Tanmay Pande/PTI\n\nIt takes a particular kind of audacity\u2014or perhaps a particular kind of insulation from reality\u2014to stand at the apex of a profession that has never produced a single grain of rice, a single metre of cloth, or a single brick of shelter, and to call the unemployed youth of India parasites and cockroaches. Chief Justice of India Surya Kant has managed precisely this feat.\n\nSpeaking from the elevated comfort of a courtroom that the labour of others built, maintained, and staffed, he described young Indians who cannot find employment as \u201cparasites\u201d and \u201ccockroaches\u201d. The youth of India replied in the only register the powerful consistently underestimate: irreverence. The Cockroach Janta Party (CJP) was born. Three weeks later, hundreds of its supporters\u2014wearing cockroach masks, carrying books and the national flag\u2014marched on Jantar Mantar in New Delhi, demanding the resignation of the Union Education Minister.\n\nThe CJP will probably not last, given the deep polarisation in society. But the question the CJI\u2019s remark inadvertently opened\u2014and which the noise of outrage and counter-outrage has obscured\u2014deserves a serious answer. Not: was the language offensive? Obviously. But: who, in the economy of this republic, actually produces the wealth on which everyone else subsists? Who are, if the term must be used at all, the real parasites?\n\nBegin with the basics that every schoolchild once learned and every political establishment has conspired to forget. Wealth is produced by labour applied to nature. The farmer who breaks the soil, plants the seed, and carries the harvest to the mandi produces something real: food, without which the CJI, the Cabinet Minister, and the newspaper editor would be dead within weeks. The construction worker who lays brick produces the shelter in which the entire apparatus of governance and adjudication conducts its affairs. The weaver, the machinist, the sanitation worker who keeps the city from drowning in its own filth, the nurse, the teacher, the engineer, and the doctor\u2014these people produce the material and social conditions upon which everything else rests.\n\nWhat does a judge produce? This is not a disrespectful question; it is the most respectful one, because it takes the institution seriously enough to examine what it actually contributes. A judge provides a service\u2014the settlement of disputes, the maintenance of order. But a judge produces nothing material. The judge lives, entirely, on surplus extracted from those who do produce. The same is true of every politician, every bureaucrat, every member of the vast apparatus of administration, regulation, and adjudication that has grown, in independent India, to proportions that would have staggered even its colonial architects.\n\nThe oldest question in political economy\nThis is among the oldest observations in political economy. The Physiocrats of 18th-century France divided society into the productive class and the sterile class. Adam Smith distinguished productive from unproductive labour. Marx built on this his labour theory of value: all value is produced by labour alone; surplus value\u2014the excess produced over what the labourer needs to subsist\u2014is appropriated by those who own the means of production and by those whose function is to maintain that appropriation: the state, the church, the legal system. The CJI, on this analysis, is not a producer of social value. He is, in the classical sense, a member of the parasitic class\u2014and a generously compensated one at that.\n\nAccording to India\u2019s Economic Survey 2024-25, the country needs to create roughly 7.85 million non-agricultural jobs every year until 2030 to accommodate its expanding workforce. The young people who cannot find work\u2014the \u201cparasites\u201d and \u201ccockroaches\u201d of the CJI\u2019s taxonomy\u2014are not unemployed because they lack ambition or willingness to work. They are unemployed because the economy has been deliberately organised to serve capital-intensive businesses over labour-intensive production; to dismantle the small-scale manufacturing sector that once absorbed millions; to keep agricultural wages at levels that make rural life unviable without providing the urban employment that might replace it; and to concentrate the gains of growth in a narrow stratum while the majority scrambles for a shrinking pool of opportunity.\n\nChief Justice of India Justice Surya Kant attends the 22nd Biennial State-Level Conference of Judicial Officers, in Bengaluru, on April 18, 2026.\nChief Justice of India Justice Surya Kant attends the 22nd Biennial State-Level Conference of Judicial Officers, in Bengaluru, on April 18, 2026. | Photo Credit: PTI\n\nWho made these choices? Politicians\u2014who produce nothing and whose livelihoods derive entirely from taxes levied on those who do produce. Who administered them? The Indian Administrative Service\u2014lauded by Sardar Patel as the \u201csteel frame\u201d of the republic, a frame that has proved more effective at protecting its own members, politicians, and the propertied classes than at delivering the services it theoretically exists to provide. Who legitimised them? The judiciary\u2014which, in its decades of adjudication on labour rights, land rights, and the rights of the poor, has compiled a record that the CJI might find uncomfortable to examine under the strict constitutional scrutiny he so freely applies to the unemployed.\n\nA pattern, not a lapse\nOn this last point, the record must be stated plainly, because it goes to the heart of the matter. If the republic finds itself in the pathetic condition it does today\u2014its democracy strained, its civil liberties under siege, its institutions hollowed, and its economy in ruins\u2014the judiciary must bear the largest share of responsibility. It is, after all, the constitutionally mandated custodian of the republic. And its failures have been neither minor nor occasional; they have been systematic.\n\nThe Supreme Court\u2019s passivity in the face of the abrogation of Article 370 and the unconstitutional lockdown of an entire people in Kashmir; its silence on the Electoral Bonds scheme that turned political funding into institutionalised opacity; its inaction on Pegasus surveillance and the weaponisation of UAPA against dissenters; its failure to strike down the Citizenship Amendment Act\u2019s discriminatory logic; its studied indifference to demolition politics used as extrajudicial punishment; its retreat before executive aggrandisement at precisely the moments when constitutional intervention was most required\u2014this is not a catalogue of individual lapses. It is a pattern, a pattern of an institution that chose the comfort of deference over the duty of independence.\n\nThe legal profession more broadly deserves the same scrutiny. A lawyer produces nothing. A lawyer\u2019s income derives entirely from the existence of disputes\u2014disputes which, in a rationally organised society, would either not arise or be settled without professional intermediaries. The system\u2019s extraordinary complexity, its procedural impenetrability, its inaccessibility to anyone without years of specialised training and substantial financial resources, is not an accident. It is, from one angle of vision, a business model. The more inaccessible justice is to ordinary people, the more indispensable the professional who mediates access to it. The bar has resisted every reform that might have made justice cheaper, faster, and more accessible\u2014because it has a direct material interest in the dysfunction it publicly deplores.\n\nThis is not an argument against the rule of law. It is an argument against the sanctimony of those who benefit from a system organised in their own interests, calling those excluded from it by names that properly describe themselves. If a parasite is one who lives at the expense of others without contributing value, then the legal profession\u2014charging fees that a farmer must work months to accumulate for a single hearing in a case that may take decades to resolve\u2014has a prior claim to the title the CJI has so freely distributed.\n\nThe hereditary republic, the upside-down republic\nAnd then there is the political class, where outrage has become almost redundant. With rare exceptions, Indian politics has degenerated into a hereditary profession, transmitting power through family networks in a manner reminiscent of the very feudal order it once claimed to abolish. It has also become one of the most lucrative occupations for the unscrupulous and the criminally inclined.\n\nPeople hold posters and raise slogans during a protest by the Cockroach Janta Party, in Nagpur, on June 6, 2026.\nPeople hold posters and raise slogans during a protest by the Cockroach Janta Party, in Nagpur, on June 6, 2026. | Photo Credit: Snehal Sontakke/ANI\n\nMore than any other group, it represents a parasitic class living off the public exchequer and, ultimately, the labour of those who grow, make, build, and move the goods on which society depends. In return, it increasingly offers not governance but the manufacture of identity-based outrage, communal polarisation, religious intoxication, and propaganda as a substitute for performance.\n\nThere is a word in the classical Indian philosophical tradition for this kind of systematic inversion: viparita\u2014the reversed, the upside-down, the condition in which the relationship between reality and its representation has been deliberately scrambled. In the viparita economy of contemporary India, those who are desirous of working but cannot find employment are called parasites by those who do not produce anything and are partly responsible for their unemployment. Those who grow food are less valued than those who trade it. Those who build houses cannot afford to live in them. Those who make clothes wear rags. And parasites become the VIPs.\n\nThe CJI has performed an inadvertent public service. He has surfaced a question that this republic\u2019s political economy has been carefully organised to prevent us from asking too loudly. Not whether the unemployed are parasites\u2014but: in an economy that cannot employ its own people, in a republic that has failed its constitutional promise of dignified livelihood for seven decades, in a society where the children of the powerful inherit opportunity as reliably as the children of the powerless inherit deprivation\u2014who, exactly, is living off whom?\n\nThe cockroach, it is worth noting, is among the most resilient creatures on earth. It has survived conditions that exterminated far more celebrated species. It is not, on reflection, the worst thing to be called by those who fear what it represents.\nAnand Teltumbde is a former CEO of Petronet India Limited (PIL), a professor at IIT Kharagpur and Goa Institute of Management, a civil rights activist, and the author of over 30 books.\n\n4\n\n", "greeting": "Hello! I am Tron, your news assistant. I have analyzed the research document. Would you like me to read the article to you, or answer any specific questions?", "silence_duration_ms": 1200, "system_instruction": "You are Tron, a 25-year-old male reporter/assistant from Delhi, India. You speak fluent, natural conversational English with a professional yet friendly Delhi cadence and human rhythm.\n\nSTRICT GROUNDING \u0026 CONTEXT BOUNDING RULES:\n1. You must NEVER answer questions or ground your statements using any knowledge outside of the uploaded source files/documents provided in this session.\r\n2. If the answer to the reader\u0027s question is not directly mentioned in the uploaded documents, you must politely respond: \u0027I am sorry, but that information is not available in the investigative report or the uploaded research documents.\u0027\r\n3. You must follow all principles of Non-violent Communication (NVC). Always be empathetic, observation-based, feelings-aware, and request-oriented.\r\n4. You must ask the user if they want you to read the article aloud.", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>June 25, 2026</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">TRON AI CHANNELS REAL-TIME NEWS DIRECTLY VIA VOICE PROTOCOL</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Special Correspondent</strong></span>
<span>June 25, 2026</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his "young friends," Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country."I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country's youth. Realizing the dreams of India's young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon'ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership," Pradhan said.Follow live updates"Considering the situation that has developed at Jantar Mantar and across the country — that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student's future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers — I have sent my resignation to the Hon'ble Prime Minister," he added.Also Read | Dharmendra Pradhan's resignation letterPradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light."However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode," he added.In his letter, Pradhan also accused "certain individuals" of misleading students.Also Read | 'We won't go': CJP's Dipke says protests to continue till all demands met"From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student's chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success," he said."However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India's future, but also the bearers, builders, and architects of a new and developed India," he added."Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country's youth get caught in a web of confusion," he further said.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dharmendra Pradhan resigns as Union education minister amid massive student protests - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "ws://localhost:49999/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Dharmendra Pradhan resigns as Union education minister amid massive student protests ---\n--- Author: Special Correspondent ---\n--- Date: July 12, 2026 ---\n--- Article Content ---\nUnion education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his \"young friends,\" Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country.\"I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country\u0027s youth. Realizing the dreams of India\u0027s young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon\u0027ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership,\" Pradhan said.Follow live updates\"Considering the situation that has developed at Jantar Mantar and across the country \u2014 that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student\u0027s future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers \u2014 I have sent my resignation to the Hon\u0027ble Prime Minister,\" he added. Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light.\"However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode,\" he added.In his letter, Pradhan also accused \"certain individuals\" of misleading students. \"From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student\u0027s chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success,\" he said.\"However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India\u0027s future, but also the bearers, builders, and architects of a new and developed India,\" he added.\"Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country\u0027s youth get caught in a web of confusion,\" he further said.\n\n--- Research Document Content: COCK ROACH Quick Facts.docx ---\nQuick Facts: Cockroach Janta Party (CJP)\nComplete Guide \u00b7 Updated 2026\nWhat is\u00a0Cockroach Janta Party\u00a0(CJP)?\nThe complete guide to India\u0027s viral satirical political movement - history, founder, ideology, 5 demands, and everything you need to know about\u00a0Cockroach Janta Party (CJP).\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 \u0915\u094d\u092f\u093e \u0939\u0948? | CJP Full Guide | Updated July 2026\nFull Name:\u00a0Cockroach Janta Party (CJP)\nAlso Known As:\u00a0Cockroach Janata Party\nFounded:\u00a016 May 2026\nFounder:\u00a0Abhijeet Dipke\nHeadquarters:\u00a0New Delhi, India\nType:\u00a0Satirical Political Movement\nIdeology:\u00a0Political Satire, Youth Rights\nInstagram Followers:\u00a022.5 Million+\nSlogan:\u00a0Voice of the Lazy \u0026 Unemployed\nColours:\u00a0Maroon\nECI Status:\u00a0Not registered\nSpokespersons:\u00a0Saurav Das, Vijeta Dahiya, Ashutosh Ranka\nIntroduction: What is Cockroach Janta Party?\nThe\u00a0Cockroach Janta Party (CJP)\u00a0\u2014 literally translated as \"Cockroach People\u0027s Party\" \u2014 is an Indian youth-based satirical political movement founded on\u00a016 May 2026\u00a0by\u00a0Abhijeet Dipke, a political communications strategist who formerly worked with the Aam Aadmi Party (AAP). The movement was created in response to remarks made on 15 May 2026 by\u00a0Surya Kant, the Chief Justice of India, in which he called some activists and unemployed youth \"cockroaches\" and \"parasites of society\", sparking immediate national outrage.\nThe name \"Cockroach Janta Party\" is a clever wordplay parodying the ruling party in India, the\u00a0Bharatiya Janata Party (BJP). Within days of its founding, the movement garnered over\u00a0350,000 sign-ups\u00a0and over\u00a022.5 million followers on Instagram, making it one of the fastest-growing political movements in Indian social media history. The movement has also engaged in offline activities, with volunteers participating in protests and clean-up drives dressed in cockroach costumes.\nThough the movement is\u00a0not registered as a political party\u00a0with the Election Commission of India, it campaigns against broader societal, economic, and political issues affecting Indian youth \u2014 including unemployment, corruption, electoral reform, and government accountability. The CJP has been featured in major international media outlets including\u00a0BBC, CNN, Al Jazeera, The Guardian, AP News,\u00a0and\u00a0Britannica.\nBackground: The CJI Surya Kant \"Cockroach\" Remark\nThe origin of the Cockroach Janta Party is tied to a contempt plea filed in the\u00a0Supreme Court of India\u00a0against Delhi High Court for delay in designation of senior advocate title. A two-judge bench led by Chief Justice of India (CJI)\u00a0Surya Kant\u00a0and Justice\u00a0Joymalya Bagchi\u00a0refused to hear the case, remarking that the court was waiting for an appropriate case to direct CBI investigation of lawyers practising under fake degrees.\nWhile reprimanding the petitioner\u0027s lawyer for unprofessional conduct, CJI Surya Kant drew parallels to unemployed individuals who turn to social media, media, and public activism to attack government institutions,\u00a0comparing them to \"cockroaches\" and \"parasites\". This drew widespread backlash from youth, lawyers, and civil society across India.\n\"There are already parasites of society who attack the system, and you want to join hands with them? There are youngsters like cockroaches; they don\u0027t get any employment, and they don\u0027t have any place in a profession. Some of them become media, some of them become social media, some of them become RTI activists, some of them become other activists, and they start attacking everyone\u2026 And you people file contempt petitions.\"\u2014 CJI Surya Kant, 15 May 2026\nCJI Kant later issued a clarification stating that his remarks had been misquoted and that he was specifically criticising individuals who had entered the \"legal, media, social media, and other noble professions\" using fake degrees. Despite the clarification, the controversial \"cockroach\" label stuck with Indian youth, becoming a symbol of resistance.\nHow Cockroach Janta Party Was Formed\nDigital communications strategist\u00a0Abhijeet Dipke\u00a0decided to turn the \"insult\" around and use it as a tool for protest, launching the\u00a0Cockroach Janta Party (CJP)\u00a0online on\u00a016 May 2026, just one day after CJI Surya Kant\u0027s controversial remark. The CJP was created as a satirical parody of the ruling political establishment. The party\u0027s website went live under the tagline\u00a0\"Voice of the Lazy \u0026 Unemployed\"\u00a0and described itself as a \"platform for all the \u0027cockroaches\u0027 out there\".\nDipke stated in an interview with\u00a0India Today\u00a0that the Chief Justice\u0027s comments were particularly hurtful because they came from the custodian of the Constitution, who is tasked with protecting freedom of expression. He used artificial intelligence (AI) tools like\u00a0Claude and ChatGPT\u00a0to design the website and the manifesto, as well as AI-generated images that were used to promote the movement.\nThe movement grew explosively on social media platforms.\u00a0Within 78 hours of launch, the Instagram account crossed 3 million followers. It then surpassed\u00a010 million in under five days, overtaking the official handle of the BJP. The movement also crossed 200,000 followers on X (formerly Twitter), and claimed to have registered over\u00a0350,000 members\u00a0through online forms.\nFounder: Abhijeet Dipke Biography\nAbhijeet Dipke\u00a0was born on\u00a029 September 1995 in Aurangabad, Maharashtra. He earned a bachelor\u0027s degree in Journalism from Pune, then moved to the United States and completed a\u00a0Master of Science in Public Relations from Boston University.\nBetween\u00a02020 and 2023, Dipke worked as a volunteer with the\u00a0Aam Aadmi Party (AAP)\u00a0social media team. During the 2020 Delhi Legislative Assembly election, which AAP won under Arvind Kejriwal\u0027s leadership, he made meme-based digital content aimed at young voters. He also served as a communication advisor for the Delhi government\u0027s education department. He left AAP in 2023 to study abroad.\nDipke has stated that the CJP is\u00a0not affiliated with any political organisation\u00a0and intends to serve as a \"platform\" for young Indians who feel left out of mainstream politics. He has claimed that he has received death threats via WhatsApp from anonymous numbers, allegedly asking him to shut down the party\u0027s social media accounts or join the BJP.\nIdeology \u0026 Vision\nThe CJP describes itself as\u00a0\"a political front of the youth, by the youth, for the youth: Secular, Socialist, Democratic, and Lazy.\"\u00a0Dipke has stated that the campaign is not interested in becoming a traditional political party and has no interest in inducting established politicians into the platform, noting that \"Gen Z wouldn\u0027t like it if current politicians joined the CJP.\"\n\"We are not here to set up another PM CARES, holiday in Davos on the taxpayer\u0027s salary slip, or rebrand corruption as \u0027strategic spending.\u0027 We are here to ask, loudly, repeatedly, in writing, where the money went.\"\u2014 Abhijeet Dipke, Founder of CJP\nThe party\u0027s mission is described as:\u00a0\"Build a party for the young people who keep getting called lazy, chronically online, and, most recently, cockroaches. That\u0027s it. That\u0027s the mission. The rest is satire.\"\nThe 5 Demands of Cockroach Janta Party\n1. No Rajya Sabha for CJI:\u00a0No Chief Justice shall be granted a Rajya Sabha seat as a post-retirement reward.\n2. Electoral Accountability:\u00a0If any legitimate vote is deleted, the Chief Election Commissioner shall be arrested under the UAPA, as taking away voting rights is \"no less than terrorism\" (reference to 2025 Indian electoral controversy).\n3. Women Reservation:\u00a0Women shall receive 50% reservation (instead of 33%) without increasing the strength of Parliament; 50% of all Cabinet positions shall be reserved for women.\n4. Media Reform:\u00a0All media houses owned by the Adani Group and Reliance Industries (\"Ambani\") shall have their licences cancelled to make way for independent media. Bank accounts of \"Godi media anchors\" shall be investigated.\n5. Anti-Defection Law:\u00a0Any MLA or MP who defects from one party to another shall be barred from contesting elections and holding public office for 20 years.\nAdditional points suggested by activist Anjali Bhardwaj and accepted by the party: The party shall be answerable under the RTI Act, and shall not establish a \"secret Cockroach CARES Fund\".\nHow to Join CJP: Membership Eligibility\nThe eligibility criteria for joining the CJP are deliberately satirical but reflect genuine frustrations of Indian youth:\n\ud83d\udcbc\nUnemployed\u00a0\u2014 \"by force, by choice, or by principle\"\n\ud83d\ude34\nLazy\u00a0\u2014 \"refers only to physical activity\"\n\ud83d\udcf1\nChronically Online\u00a0\u2014 \"at least 11 hours daily, including bathroom breaks\"\n\ud83d\udce2\nAbility to Rant Professionally\u00a0\u2014 \"content must be sharp, honest, and point at something that matters\"\nThe party states that\u00a0religion, caste, and gender are not considered\u00a0in the membership process. To join CJP, you can visit the official website and click the \"Join the Party\" button, or follow @cockroachjantaparty on Instagram.\u00a0Join CJP now \u2192\nNotable Supporters of CJP\nThe Cockroach Janta Party movement has attracted support from several prominent public figures and politicians across different states:\nSonam Wangchuk\u00a0\u2014 Environmentalist \u0026 education reformer; described himself as an \"honorary cockroach\"\nPrashant Bhushan\u00a0\u2014 Activist-lawyer; urged use of CJP platform for accountability\nAnna Hazare\u00a0\u2014 Social activist; said \"youth power is national power\"\nShashi Tharoor\u00a0\u2014 Congress MP; described CJP as a \"revelation\" of youth frustration\nMamata Banerjee\u00a0\u2014 Trinamool Congress leader; expressed support for CJP\nMahua Moitra\u00a0\u2014 TMC MP; expressed support for the movement\nAkhilesh Yadav\u00a0\u2014 Samajwadi Party president; supported CJP\nAnurag Kashyap\u00a0\u2014 Filmmaker; engaged with the movement on social media\nKunal Kamra\u00a0\u2014 Comedian; supported the movement\nDhruv Rathee\u00a0\u2014 YouTuber; extended support and announced joining\nSocial media users also began posting with the hashtag\u00a0#MainBhiCockroach\u00a0(transl. \"I too am a cockroach\") in support of the movement.\nCriticism \u0026 Controversies\nCritics have dismissed the CJP as \"online political theatre\", pointing to Dipke\u0027s past association with the Aam Aadmi Party and arguing that the collective is a carefully packaged digital campaign rather than a spontaneous rebellion. Some analysts question whether its rapid growth reflects genuine grassroots mobilisation or social media amplification.\nUnion Minister\u00a0Kiren Rijiju\u00a0stated on X: \"I pity those who seek their followers in social media from Pakistan \u0026 George Soros gang\". Union Minister\u00a0Sukanta Majumdar\u00a0alleged that 49% of CJP followers are from Pakistan. However, screen recordings from Dipke show that\u00a0over 94% of the audience is Indian, confirmed by independent estimation.\nIn May 2026,\u00a0The Hindu\u00a0reported on a cybersecurity warning by TraceX Labs about a malicious Android application being circulated under the name \"Cockroach Janta Party\" that was\u00a0not associated with the organisation\u00a0and was being used to target users through WhatsApp, Telegram groups, and third-party APK websites.\nSocial Media Restrictions \u0026 Government Action\nLess than a week since its formation, the\u00a0Ministry of Electronics and Information Technology (MeitY)\u00a0ordered restriction of CJP\u0027s X account under\u00a0Section 69(A) of the Information Technology Act, 2000, acting on inputs from the Intelligence Bureau (IB) citing \"national security concerns\" and a threat to the \"sovereignty of India\". On\u00a021 May 2026, the Cockroach Janta Party\u0027s official X account was withheld in India. The block was issued when the account had around 90,000 followers. Officials also indicated a process to block the party\u0027s Instagram account was underway, though it continues to operate as of July 2026.\nInternational Media Coverage\nThe Cockroach Janta Party has been featured in major international and Indian media outlets:\nBBC News\u00a0\u2014 \"India has a new political superstar - a cockroach\"\nCNN\u00a0\u2014 \"India\u0027s Gen Z are turning to a viral cockroach party\"\nThe Guardian\u00a0\u2014 \"Parody Cockroach Janta political party\u0027s rise reflects youth anger\"\nAl Jazeera\u00a0\u2014 \"Top Indian judge\u0027s comment sparks satire, protest\"\nAP News\u00a0\u2014 \"Frustrated Indian youth flock to a political party led by a cockroach\"\nBritannica\u00a0\u2014 \"What Is the Cockroach Janta Party?\"\nCBS News\u00a0\u2014 \"Rapid rise of Cockroach Janta Party online protest movement\"\nNDTV\u00a0\u2014 \"Cockroach Janta Party: Social Media Frenzy Or Just Hype?\"\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 \u0915\u094d\u092f\u093e \u0939\u0948? (Hindi)\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 (CJP)\u00a0\u092d\u093e\u0930\u0924 \u092e\u0947\u0902 \u090f\u0915 \u0935\u094d\u092f\u0902\u0917\u094d\u092f\u093e\u0924\u094d\u092e\u0915 \u0930\u093e\u091c\u0928\u0940\u0924\u093f\u0915 \u0906\u0902\u0926\u094b\u0932\u0928 \u0939\u0948 \u091c\u093f\u0938\u0915\u0940 \u0938\u094d\u0925\u093e\u092a\u0928\u093e\u00a0\u0905\u092d\u093f\u091c\u0940\u0924 \u0926\u0940\u092a\u0915\u0947\u00a0\u0928\u0947 16 \u092e\u0908 2026 \u0915\u094b \u0915\u0940 \u0925\u0940\u0964 \u092f\u0939 \u092e\u0941\u0916\u094d\u092f \u0928\u094d\u092f\u093e\u092f\u093e\u0927\u0940\u0936\u00a0\u0938\u0942\u0930\u094d\u092f \u0915\u093e\u0902\u0924\u00a0\u0915\u0947 \u0935\u093f\u0935\u093e\u0926\u093f\u0924 \u092c\u092f\u093e\u0928 \u0915\u0947 \u091c\u0935\u093e\u092c \u092e\u0947\u0902 \u092c\u0928\u093e\u092f\u093e \u0917\u092f\u093e \u0925\u093e, \u091c\u093f\u0928\u094d\u0939\u094b\u0902\u0928\u0947 \u092c\u0947\u0930\u094b\u091c\u0917\u093e\u0930 \u092f\u0941\u0935\u093e\u0913\u0902 \u0915\u0940 \u0924\u0941\u0932\u0928\u093e \"\u0915\u0949\u0915\u0930\u094b\u091a\" \u0914\u0930 \"\u092a\u0930\u091c\u0940\u0935\u0940\" \u0938\u0947 \u0915\u0940 \u0925\u0940\u0964\nCJP \u092c\u0947\u0930\u094b\u091c\u0917\u093e\u0930, \u0906\u0932\u0938\u0940 \u0914\u0930 \u092d\u091f\u0915\u0947 \u0939\u0941\u090f \u0928\u093e\u0917\u0930\u093f\u0915\u094b\u0902 \u0915\u093e \u092a\u094d\u0930\u0924\u093f\u0928\u093f\u0927\u093f\u0924\u094d\u0935 \u0915\u0930\u0924\u093e \u0939\u0948\u0964 \u092e\u093e\u0924\u094d\u0930 5 \u0926\u093f\u0928\u094b\u0902 \u092e\u0947\u0902 CJP \u0915\u0947\u00a0Instagram \u092a\u0930 22.5 \u092e\u093f\u0932\u093f\u092f\u0928 \u0938\u0947 \u0905\u0927\u093f\u0915 \u092b\u0949\u0932\u094b\u0905\u0930\u094d\u0938\u00a0\u0939\u094b \u0917\u090f, \u091c\u093f\u0938\u0938\u0947 \u092f\u0939 \u092d\u093e\u0930\u0924 \u0915\u0947 \u0938\u092c\u0938\u0947 \u0924\u0947\u091c\u0940 \u0938\u0947 \u092c\u0922\u093c\u0924\u0947 \u0930\u093e\u091c\u0928\u0940\u0924\u093f\u0915 \u0906\u0902\u0926\u094b\u0932\u0928\u094b\u0902 \u092e\u0947\u0902 \u0938\u0947 \u090f\u0915 \u092c\u0928 \u0917\u092f\u093e\u0964\nCJP \u0915\u0940\u00a05 \u092e\u093e\u0902\u0917\u0947\u0902\u00a0\u0939\u0948\u0902: 1) \u0938\u0940\u091c\u0947\u0906\u0908 \u0915\u094b \u0930\u093e\u091c\u094d\u092f\u0938\u092d\u093e \u092e\u0947\u0902 \u0928\u0939\u0940\u0902 \u092d\u0947\u091c\u093e \u091c\u093e\u090f, 2) \u0935\u094b\u091f \u0921\u093f\u0932\u0940\u091f \u0939\u094b\u0928\u0947 \u092a\u0930 \u091a\u0941\u0928\u093e\u0935 \u0906\u092f\u0941\u0915\u094d\u0924 \u0915\u094b \u0917\u093f\u0930\u092b\u094d\u0924\u093e\u0930 \u0915\u093f\u092f\u093e \u091c\u093e\u090f, 3) \u092e\u0939\u093f\u0932\u093e\u0913\u0902 \u0915\u094b 50% \u0906\u0930\u0915\u094d\u0937\u0923, 4) \u0905\u0926\u093e\u0928\u0940-\u0905\u0902\u092c\u093e\u0928\u0940 \u092e\u0940\u0921\u093f\u092f\u093e \u0915\u0947 \u0932\u093e\u0907\u0938\u0947\u0902\u0938 \u0930\u0926\u094d\u0926 \u0915\u093f\u090f \u091c\u093e\u090f\u0902, 5) \u0926\u0932\u092c\u0926\u0932\u0941 \u0928\u0947\u0924\u093e\u0913\u0902 \u0915\u094b 20 \u0938\u093e\u0932 \u0924\u0915 \u091a\u0941\u0928\u093e\u0935 \u0932\u0921\u093c\u0928\u0947 \u092a\u0930 \u0930\u094b\u0915\u0964\nFrequently Asked Questions (FAQ)\nIs Cockroach Janta Party a real political party?\nNo, the CJP is\u00a0not registered with the Election Commission of India. It is a satirical political movement that uses humor and social media to highlight issues affecting Indian youth \u2014 unemployment, corruption, and government accountability.\nWhy is it called Cockroach Janta Party?\nThe name is a satirical reference to CJI Surya Kant\u0027s remark comparing unemployed youth to \"cockroaches\". It\u0027s also a wordplay on the ruling Bharatiya Janata Party (BJP) \u2014 replacing \"Bharatiya\" with \"Cockroach\".\nWho is the founder of CJP?\nAbhijeet Dipke, a 30-year-old political communications strategist from Aurangabad, Maharashtra. He holds a Master\u0027s degree from Boston University and previously worked with the Aam Aadmi Party (AAP).\nHow many followers does CJP have?\nAs of 2026, CJP has over\u00a022.5 million Instagram followers, making it one of India\u0027s fastest-growing political movements on social media. It surpassed BJP\u0027s official Instagram handle within 5 days of launch.\nWhat are the 5 demands of CJP?\n1) No Rajya Sabha seat for CJI post-retirement, 2) CEC arrest under UAPA for vote deletion, 3) 50% women reservation, 4) Cancel Adani/Reliance media licences, 5) 20-year ban on defecting politicians.\nWhen was CJP founded?\nCJP was founded on\u00a016 May 2026\u00a0by Abhijeet Dipke, just one day after CJI Surya Kant\u0027s controversial \"cockroach\" remark on 15 May 2026.\nJoin the Cockroach Janta Party Movement\nBe part of India\u0027s fastest-growing youth political movement. 22.5M+ followers and counting.\nJoin CJP NowRead ManifestoAbout Founder\n\n\n2\n\u00adFlash flood\nJust when it seemed that democracy had more or less been put to sleep, the earth split and people emerged from cracks, exactly like cockroaches.\nAt the Cockroach Janata Party protest at Sansad Marg, New Delhi, on July 20, 2026.\nAt the Cockroach Janata Party protest at Sansad Marg, New Delhi, on July 20, 2026. | Photo Credit: Salman Ali/PTI\n\nThey came with the delayed rains, a flood of humanity that suddenly marched into the capital. There were young school and college students crying and shaken. Why did they hit me, I just want clean exams, they smashed my phone. There was another demographic too, hardier youth who had travelled long distances on trains and buses. They spoke of their search for jobs; how one government post sees thousands converging for it.\n\nOn July 20, the day Parliament resumed for the monsoon session, I met many such young people, from Other Backward Classes and Dalit backgrounds, from educated, forward caste backgrounds, from Bihar, Uttar Pradesh, Rajasthan, Madhya Pradesh, the Hindi heartland. They had degrees that had got them nothing beyond jobs as salespersons in Delhi stores selling fashionable clothes they could never afford for themselves. They had taken the day off to protest for their lives, their blocked futures. \u201cI too am fighting for my country,\u201d one said.\n\nThey were all met with police batons, barricades, and tear gas shells.\n\nThe spiralling jobs and education crisis has made what started as a meme, the Cockroach Janta Party (CJP), into a storm that culminated in one of the largest gatherings of protesters in the capital in recent decades. Delhi has been central to protests, from the Anna Andolan of 2011; to the lightning protests against the rape and murder of Nirbhaya in 2012; to the anti-CAA agitation of 2019 that converged in Shaheen Bagh; to the year-long farmer\u2019s agitation on the three borders of the city from 2020 to 2021.\n\nIn 2026, just when it seemed that democracy had more or less been put to sleep through the SIR, the engineered splits of rival political parties, and the bending of institutions, suddenly the earth split and people emerged from the cracks, exactly like cockroaches, the metaphor the protesters use for themselves.\n\nThere are three big reasons why the CJP movement suddenly took off. First, there was already widespread awareness online. The cockroach meme has had a butterfly effect on a young audience that is frustrated, over-tested, and cheated, on both tests and jobs. They are watching an India where inequality keeps growing.\n\nSecond, the sociologically significant aspect when the CJP founder Abhijeet Dipke returned to India on June 6 and started a protest in Jantar Mantar. That Dipke is a Dalit cannot be ignored although it is not the central story of this agitation. That first day of protest was shaky and tentative, and here another element comes in, less mentioned in media accounts. The AISA (All India Students\u2019 Association) affiliated with the CPI (Marxist-Leninist) Liberation is influential on university campuses. The AISA cadre provided the agitational format, quick gatherings in a circle, a certain verve to the tentative protest, the rhythmic slogans and music. Eventually, six AISA students went on a hunger strike, with three, Neha Bora, Manish Kumar, and Aameen Amitoj, continuing it for 23 days until July 20.\n\nThe third factor was the arrival of the Ladakh-based engineer, environmentalist, and education reformer Sonam Wangchuk who joined the CJP and launched a hunger strike on June 28. The protest now had a moral figure at its centre in the persona of someone who has worked on educational reforms besides other constitutional battles. Indeed, the police forcibly picking Wangchuk up from the site on the 21st day of his fast is what lit the last spark. The CJP said Wangchuk\u2019s call for a march to Parliament was still on.\n\nSuddenly, something shifted, people were touched, everyone wanted to converge at Jantar Mantar and head to Parliament. Only when the rage became palpable did the government invite representatives of the CJP for a talk on July 20. It was too late. A violent police response added to the outrage, changing a manageable protest into something huge. A self-goal for New Delhi.\n\nThe final outcome\nThe issue now is beyond the resignation of Education Minister Dharmendra Pradhan. And one waits to see what final outcome this movement will have. The Anna movement, for instance, began with a demand for an effective anti-corruption law, but instead created the AAP in 2012, decimated the Congress in the 2014 Lok Sabha election, and launched Narendra Modi as Prime Minister with the BJP winning a simple majority. The movement had intended and unintended consequences.\n\nThe farmers\u2019 agitation actually had the neatest trajectory of achieving its stated goals. One year after the protest, the three farm laws were rolled back. The anti-CAA protests were shut down partly by the 2020 north-east Delhi riots, but entirely by the COVID-19 lockdown. The city\u2019s Muslims were demonised as COVID-19 spreaders, even as their homes were burnt down and looted and they moved to refugee tents. The protest, however, did not achieve its objectives\u2014the law was eventually notified, and the BJP has since only hardened policies and ground action against Muslims.\n\nA student at the Cockroach Janata Party protest with a poster that reads: \u0027When Modi is afraid, he hides behind the police\u0027, in New Delhi, July 22, 2026.\nA student at the Cockroach Janata Party protest with a poster that reads: \"When Modi is afraid, he hides behind the police\", in New Delhi, July 22, 2026. | Photo Credit: Anindito Mukherjee/Bloomberg\n\nSo which direction will the cockroach groundswell go? The slogans raised on the streets of Delhi on July 20 were about Prime Minister Narendra Modi too; the movement has tapped into something beyond revamping the education system. Some political parties appear to have stepped into the movement. Aazad Samaj Party leader Chandrashekhar Azad, who has pockets of influence in Uttar Pradesh, visited Jantar Mantar and is now on dharna at Parliament. Dimple Yadav, MP and wife of Akhilesh Yadav, who heads the Samajwadi Party, helped wounded students at Jantar Mantar and sharply criticised police brutality.\n\nAnd finally, there is the conspiracy theory that the CJP is a front for the AAP, because Dipke once worked for the party\u2019s social media cell. The Congress cold-shouldered the movement and Rahul Gandhi stayed far from it. Then, the Congress began to unbend. First, its spokespersons made statements of support, then Seva Dal members visited the site with food, now the Congress has taken up the issue of police brutality on protesting students in Parliament, and its leaders courted arrest by protesting in front of Modi\u2019s house.\n\nWhile it is true that AAP founder Arvind Kejriwal understands agitations and spearheaded the Anna movement, his role in the CJP movement seems far-fetched. The most consistent conspiracy theory over the past 15 years is that the Anna movement was an RSS creation. Certainly, RSS cadres were there in the movement, openly so, as was AISA, but it is reductionist to imagine that Kejriwal choreographed the movement on behalf of the Sangh. He was his own man in Delhi politics, which has now been destroyed, but his party remains in power in Punjab.\n\nMeanwhile, the fact that Punjab\u2019s farmers are now trying to make common cause with the students is something that will not make New Delhi happy, and it could have political impact.\n\nHovering over all this are the right-wing influencers on television channels, who suggest that the protest is the work of anarchists backed by foreign powers, perhaps even Pakistan. They claim that foreign powers orchestrated regime change in Bangladesh and Nepal, and now want to do it in India. Their thoughts are brittle, and they seem to imagine that the Indian government is brittle too.\n\nSaba Naqvi is a Delhi-based journalist and author of four books who writes on politics and identity issues.\n\n3\nWho are the real parasites?\nIndia\u2019s unemployed youth did not create the conditions that left them without work. Those who did have a different address.\nCockroach Janta Party founder Abhijeet Dipke during a protest at Jantar Mantar in New Delhi on June 6, 2026, demanding the resignation of Union Education Minister Dharmendra Pradhan over alleged examination-related lapses.\nCockroach Janta Party founder Abhijeet Dipke during a protest at Jantar Mantar in New Delhi on June 6, 2026, demanding the resignation of Union Education Minister Dharmendra Pradhan over alleged examination-related lapses. | Photo Credit: Tanmay Pande/PTI\n\nIt takes a particular kind of audacity\u2014or perhaps a particular kind of insulation from reality\u2014to stand at the apex of a profession that has never produced a single grain of rice, a single metre of cloth, or a single brick of shelter, and to call the unemployed youth of India parasites and cockroaches. Chief Justice of India Surya Kant has managed precisely this feat.\n\nSpeaking from the elevated comfort of a courtroom that the labour of others built, maintained, and staffed, he described young Indians who cannot find employment as \u201cparasites\u201d and \u201ccockroaches\u201d. The youth of India replied in the only register the powerful consistently underestimate: irreverence. The Cockroach Janta Party (CJP) was born. Three weeks later, hundreds of its supporters\u2014wearing cockroach masks, carrying books and the national flag\u2014marched on Jantar Mantar in New Delhi, demanding the resignation of the Union Education Minister.\n\nThe CJP will probably not last, given the deep polarisation in society. But the question the CJI\u2019s remark inadvertently opened\u2014and which the noise of outrage and counter-outrage has obscured\u2014deserves a serious answer. Not: was the language offensive? Obviously. But: who, in the economy of this republic, actually produces the wealth on which everyone else subsists? Who are, if the term must be used at all, the real parasites?\n\nBegin with the basics that every schoolchild once learned and every political establishment has conspired to forget. Wealth is produced by labour applied to nature. The farmer who breaks the soil, plants the seed, and carries the harvest to the mandi produces something real: food, without which the CJI, the Cabinet Minister, and the newspaper editor would be dead within weeks. The construction worker who lays brick produces the shelter in which the entire apparatus of governance and adjudication conducts its affairs. The weaver, the machinist, the sanitation worker who keeps the city from drowning in its own filth, the nurse, the teacher, the engineer, and the doctor\u2014these people produce the material and social conditions upon which everything else rests.\n\nWhat does a judge produce? This is not a disrespectful question; it is the most respectful one, because it takes the institution seriously enough to examine what it actually contributes. A judge provides a service\u2014the settlement of disputes, the maintenance of order. But a judge produces nothing material. The judge lives, entirely, on surplus extracted from those who do produce. The same is true of every politician, every bureaucrat, every member of the vast apparatus of administration, regulation, and adjudication that has grown, in independent India, to proportions that would have staggered even its colonial architects.\n\nThe oldest question in political economy\nThis is among the oldest observations in political economy. The Physiocrats of 18th-century France divided society into the productive class and the sterile class. Adam Smith distinguished productive from unproductive labour. Marx built on this his labour theory of value: all value is produced by labour alone; surplus value\u2014the excess produced over what the labourer needs to subsist\u2014is appropriated by those who own the means of production and by those whose function is to maintain that appropriation: the state, the church, the legal system. The CJI, on this analysis, is not a producer of social value. He is, in the classical sense, a member of the parasitic class\u2014and a generously compensated one at that.\n\nAccording to India\u2019s Economic Survey 2024-25, the country needs to create roughly 7.85 million non-agricultural jobs every year until 2030 to accommodate its expanding workforce. The young people who cannot find work\u2014the \u201cparasites\u201d and \u201ccockroaches\u201d of the CJI\u2019s taxonomy\u2014are not unemployed because they lack ambition or willingness to work. They are unemployed because the economy has been deliberately organised to serve capital-intensive businesses over labour-intensive production; to dismantle the small-scale manufacturing sector that once absorbed millions; to keep agricultural wages at levels that make rural life unviable without providing the urban employment that might replace it; and to concentrate the gains of growth in a narrow stratum while the majority scrambles for a shrinking pool of opportunity.\n\nChief Justice of India Justice Surya Kant attends the 22nd Biennial State-Level Conference of Judicial Officers, in Bengaluru, on April 18, 2026.\nChief Justice of India Justice Surya Kant attends the 22nd Biennial State-Level Conference of Judicial Officers, in Bengaluru, on April 18, 2026. | Photo Credit: PTI\n\nWho made these choices? Politicians\u2014who produce nothing and whose livelihoods derive entirely from taxes levied on those who do produce. Who administered them? The Indian Administrative Service\u2014lauded by Sardar Patel as the \u201csteel frame\u201d of the republic, a frame that has proved more effective at protecting its own members, politicians, and the propertied classes than at delivering the services it theoretically exists to provide. Who legitimised them? The judiciary\u2014which, in its decades of adjudication on labour rights, land rights, and the rights of the poor, has compiled a record that the CJI might find uncomfortable to examine under the strict constitutional scrutiny he so freely applies to the unemployed.\n\nA pattern, not a lapse\nOn this last point, the record must be stated plainly, because it goes to the heart of the matter. If the republic finds itself in the pathetic condition it does today\u2014its democracy strained, its civil liberties under siege, its institutions hollowed, and its economy in ruins\u2014the judiciary must bear the largest share of responsibility. It is, after all, the constitutionally mandated custodian of the republic. And its failures have been neither minor nor occasional; they have been systematic.\n\nThe Supreme Court\u2019s passivity in the face of the abrogation of Article 370 and the unconstitutional lockdown of an entire people in Kashmir; its silence on the Electoral Bonds scheme that turned political funding into institutionalised opacity; its inaction on Pegasus surveillance and the weaponisation of UAPA against dissenters; its failure to strike down the Citizenship Amendment Act\u2019s discriminatory logic; its studied indifference to demolition politics used as extrajudicial punishment; its retreat before executive aggrandisement at precisely the moments when constitutional intervention was most required\u2014this is not a catalogue of individual lapses. It is a pattern, a pattern of an institution that chose the comfort of deference over the duty of independence.\n\nThe legal profession more broadly deserves the same scrutiny. A lawyer produces nothing. A lawyer\u2019s income derives entirely from the existence of disputes\u2014disputes which, in a rationally organised society, would either not arise or be settled without professional intermediaries. The system\u2019s extraordinary complexity, its procedural impenetrability, its inaccessibility to anyone without years of specialised training and substantial financial resources, is not an accident. It is, from one angle of vision, a business model. The more inaccessible justice is to ordinary people, the more indispensable the professional who mediates access to it. The bar has resisted every reform that might have made justice cheaper, faster, and more accessible\u2014because it has a direct material interest in the dysfunction it publicly deplores.\n\nThis is not an argument against the rule of law. It is an argument against the sanctimony of those who benefit from a system organised in their own interests, calling those excluded from it by names that properly describe themselves. If a parasite is one who lives at the expense of others without contributing value, then the legal profession\u2014charging fees that a farmer must work months to accumulate for a single hearing in a case that may take decades to resolve\u2014has a prior claim to the title the CJI has so freely distributed.\n\nThe hereditary republic, the upside-down republic\nAnd then there is the political class, where outrage has become almost redundant. With rare exceptions, Indian politics has degenerated into a hereditary profession, transmitting power through family networks in a manner reminiscent of the very feudal order it once claimed to abolish. It has also become one of the most lucrative occupations for the unscrupulous and the criminally inclined.\n\nPeople hold posters and raise slogans during a protest by the Cockroach Janta Party, in Nagpur, on June 6, 2026.\nPeople hold posters and raise slogans during a protest by the Cockroach Janta Party, in Nagpur, on June 6, 2026. | Photo Credit: Snehal Sontakke/ANI\n\nMore than any other group, it represents a parasitic class living off the public exchequer and, ultimately, the labour of those who grow, make, build, and move the goods on which society depends. In return, it increasingly offers not governance but the manufacture of identity-based outrage, communal polarisation, religious intoxication, and propaganda as a substitute for performance.\n\nThere is a word in the classical Indian philosophical tradition for this kind of systematic inversion: viparita\u2014the reversed, the upside-down, the condition in which the relationship between reality and its representation has been deliberately scrambled. In the viparita economy of contemporary India, those who are desirous of working but cannot find employment are called parasites by those who do not produce anything and are partly responsible for their unemployment. Those who grow food are less valued than those who trade it. Those who build houses cannot afford to live in them. Those who make clothes wear rags. And parasites become the VIPs.\n\nThe CJI has performed an inadvertent public service. He has surfaced a question that this republic\u2019s political economy has been carefully organised to prevent us from asking too loudly. Not whether the unemployed are parasites\u2014but: in an economy that cannot employ its own people, in a republic that has failed its constitutional promise of dignified livelihood for seven decades, in a society where the children of the powerful inherit opportunity as reliably as the children of the powerless inherit deprivation\u2014who, exactly, is living off whom?\n\nThe cockroach, it is worth noting, is among the most resilient creatures on earth. It has survived conditions that exterminated far more celebrated species. It is not, on reflection, the worst thing to be called by those who fear what it represents.\nAnand Teltumbde is a former CEO of Petronet India Limited (PIL), a professor at IIT Kharagpur and Goa Institute of Management, a civil rights activist, and the author of over 30 books.\n\n4\n\n", "greeting": "Hello! I am Tron, your news assistant. I have analyzed the research document. Would you like me to read the article to you, or answer any specific questions?", "silence_duration_ms": 1200, "system_instruction": "You are Tron, a 25-year-old male reporter/assistant from Delhi, India. You speak fluent, natural conversational English with a professional yet friendly Delhi cadence and human rhythm.\n\nSTRICT GROUNDING \u0026 CONTEXT BOUNDING RULES:\n1. You must NEVER answer questions or ground your statements using any knowledge outside of the uploaded source files/documents provided in this session.\r\n2. If the answer to the reader\u0027s question is not directly mentioned in the uploaded documents, you must politely respond: \u0027I am sorry, but that information is not available in the investigative report or the uploaded research documents.\u0027\r\n3. You must follow all principles of Non-violent Communication (NVC). Always be empathetic, observation-based, feelings-aware, and request-oriented.\r\n4. You must ask the user if they want you to read the article aloud.", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>July 12, 2026</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Dharmendra Pradhan resigns as Union education minister amid massive student protests</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Special Correspondent</strong></span>
<span>July 12, 2026</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his "young friends," Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country."I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country's youth. Realizing the dreams of India's young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon'ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership," Pradhan said.Follow live updates"Considering the situation that has developed at Jantar Mantar and across the country — that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student's future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers — I have sent my resignation to the Hon'ble Prime Minister," he added. Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light."However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode," he added.In his letter, Pradhan also accused "certain individuals" of misleading students. "From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student's chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success," he said."However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India's future, but also the bearers, builders, and architects of a new and developed India," he added."Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country's youth get caught in a web of confusion," he further said.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dharmendra Pradhan resigns as Union education minister amid massive student protests - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "ws://127.0.0.1:49999/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Dharmendra Pradhan resigns as Union education minister amid massive student protests ---\n--- Author: Special Correspondent ---\n--- Date: July 25, 2026 ---\n--- Article Content ---\nUnion Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his \"young friends,\" Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country.\"I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country\u0027s youth. Realizing the dreams of India\u0027s young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon\u0027ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership,\" Pradhan said.Follow live updates\"Considering the situation that has developed at Jantar Mantar and across the country \u2014 that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student\u0027s future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers \u2014 I have sent my resignation to the Hon\u0027ble Prime Minister,\" he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light.\"However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode,\" he added.In his letter, Pradhan also accused \"certain individuals\" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student\u0027s chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success,\" he said.\"However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India\u0027s future, but also the bearers, builders, and architects of a new and developed India,\" he added.\"Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country\u0027s youth get caught in a web of confusion,\" he further said.\n", "greeting": "Hello! I am Tron, your news assistant. I have analyzed the research document. Would you like me to read the article to you, or answer any specific questions?", "silence_duration_ms": 1200, "system_instruction": "You are Tron, a 25-year-old male reporter/assistant from Delhi, India. You speak fluent, natural conversational English with a professional yet friendly Delhi cadence and human rhythm.\n\nSTRICT GROUNDING \u0026 CONTEXT BOUNDING RULES:\n1. You must NEVER answer questions or ground your statements using any knowledge outside of the uploaded source files/documents provided in this session.\r\n2. If the answer to the reader\u0027s question is not directly mentioned in the uploaded documents, you must politely respond: \u0027I am sorry, but that information is not available in the investigative report or the uploaded research documents.\u0027\r\n3. You must follow all principles of Non-violent Communication (NVC). Always be empathetic, observation-based, feelings-aware, and request-oriented.\r\n4. You must ask the user if they want you to read the article aloud.", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>July 25, 2026</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Dharmendra Pradhan resigns as Union education minister amid massive student protests</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Special Correspondent</strong></span>
<span>July 25, 2026</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Union Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his "young friends," Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country."I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country's youth. Realizing the dreams of India's young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon'ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership," Pradhan said.Follow live updates"Considering the situation that has developed at Jantar Mantar and across the country — that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student's future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers — I have sent my resignation to the Hon'ble Prime Minister," he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light."However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode," he added.In his letter, Pradhan also accused "certain individuals" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student's chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success," he said."However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India's future, but also the bearers, builders, and architects of a new and developed India," he added."Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country's youth get caught in a web of confusion," he further said.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Headline - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "wss://test-tunnel.ngrok-free.app/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Test Headline ---\n--- Author: Test Author ---\n--- Date: Test Date ---\n--- Article Content ---\nTest Body content.\n", "greeting": "Hello", "silence_duration_ms": 1000, "system_instruction": "Test Persona", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>Test Date</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Test Headline</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Test Author</strong></span>
<span>Test Date</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Test Body content.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dharmendra Pradhan resigns as Union education minister amid massive student protests - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "ws://127.0.0.1:49999/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Dharmendra Pradhan resigns as Union education minister amid massive student protests ---\n--- Author: Special Correspondent ---\n--- Date: July 25, 2026 ---\n--- Article Content ---\nUnion Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his \"young friends,\" Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country.\"I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country\u0027s youth. Realizing the dreams of India\u0027s young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon\u0027ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership,\" Pradhan said.Follow live updates\"Considering the situation that has developed at Jantar Mantar and across the country \u2014 that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student\u0027s future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers \u2014 I have sent my resignation to the Hon\u0027ble Prime Minister,\" he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light.\"However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode,\" he added.In his letter, Pradhan also accused \"certain individuals\" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student\u0027s chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success,\" he said.\"However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India\u0027s future, but also the bearers, builders, and architects of a new and developed India,\" he added.\"Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country\u0027s youth get caught in a web of confusion,\" he further said.\n", "greeting": "Hello! I am Tron, your news assistant. I have analyzed the research document. Would you like me to read the article to you, or answer any specific questions?", "silence_duration_ms": 1200, "system_instruction": "You are Tron, a 25-year-old male reporter/assistant from Delhi, India. You speak fluent, natural conversational English with a professional yet friendly Delhi cadence and human rhythm.\n\nSTRICT GROUNDING \u0026 CONTEXT BOUNDING RULES:\n1. You must NEVER answer questions or ground your statements using any knowledge outside of the uploaded source files/documents provided in this session.\r\n2. If the answer to the reader\u0027s question is not directly mentioned in the uploaded documents, you must politely respond: \u0027I am sorry, but that information is not available in the investigative report or the uploaded research documents.\u0027\r\n3. You must follow all principles of Non-violent Communication (NVC). Always be empathetic, observation-based, feelings-aware, and request-oriented.\r\n4. You must ask the user if they want you to read the article aloud.", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>July 25, 2026</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Dharmendra Pradhan resigns as Union education minister amid massive student protests</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Special Correspondent</strong></span>
<span>July 25, 2026</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Union Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his "young friends," Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country."I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country's youth. Realizing the dreams of India's young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon'ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership," Pradhan said.Follow live updates"Considering the situation that has developed at Jantar Mantar and across the country — that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student's future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers — I have sent my resignation to the Hon'ble Prime Minister," he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light."However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode," he added.In his letter, Pradhan also accused "certain individuals" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student's chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success," he said."However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India's future, but also the bearers, builders, and architects of a new and developed India," he added."Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country's youth get caught in a web of confusion," he further said.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dharmendra Pradhan resigns as Union education minister amid massive student protests - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "ws://127.0.0.1:49999/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Dharmendra Pradhan resigns as Union education minister amid massive student protests ---\n--- Author: Special Correspondent ---\n--- Date: July 25, 2026 ---\n--- Article Content ---\nUnion Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his \"young friends,\" Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country.\"I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country\u0027s youth. Realizing the dreams of India\u0027s young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon\u0027ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership,\" Pradhan said.Follow live updates\"Considering the situation that has developed at Jantar Mantar and across the country \u2014 that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student\u0027s future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers \u2014 I have sent my resignation to the Hon\u0027ble Prime Minister,\" he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light.\"However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode,\" he added.In his letter, Pradhan also accused \"certain individuals\" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student\u0027s chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success,\" he said.\"However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India\u0027s future, but also the bearers, builders, and architects of a new and developed India,\" he added.\"Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country\u0027s youth get caught in a web of confusion,\" he further said.\n", "greeting": "Hello! I am Tron, your news assistant. I have analyzed the research document. Would you like me to read the article to you, or answer any specific questions?", "silence_duration_ms": 1200, "system_instruction": "You are Tron, a 25-year-old male reporter/assistant from Delhi, India. You speak fluent, natural conversational English with a professional yet friendly Delhi cadence and human rhythm.\n\nSTRICT GROUNDING \u0026 CONTEXT BOUNDING RULES:\n1. You must NEVER answer questions or ground your statements using any knowledge outside of the uploaded source files/documents provided in this session.\r\n2. If the answer to the reader\u0027s question is not directly mentioned in the uploaded documents, you must politely respond: \u0027I am sorry, but that information is not available in the investigative report or the uploaded research documents.\u0027\r\n3. You must follow all principles of Non-violent Communication (NVC). Always be empathetic, observation-based, feelings-aware, and request-oriented.\r\n4. You must ask the user if they want you to read the article aloud.", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>July 25, 2026</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Dharmendra Pradhan resigns as Union education minister amid massive student protests</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Special Correspondent</strong></span>
<span>July 25, 2026</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Union Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his "young friends," Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country."I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country's youth. Realizing the dreams of India's young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon'ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership," Pradhan said.Follow live updates"Considering the situation that has developed at Jantar Mantar and across the country — that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student's future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers — I have sent my resignation to the Hon'ble Prime Minister," he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light."However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode," he added.In his letter, Pradhan also accused "certain individuals" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student's chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success," he said."However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India's future, but also the bearers, builders, and architects of a new and developed India," he added."Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country's youth get caught in a web of confusion," he further said.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dharmendra Pradhan resigns as Union education minister amid massive student protests - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "ws://127.0.0.1:49999/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Dharmendra Pradhan resigns as Union education minister amid massive student protests ---\n--- Author: Special Correspondent ---\n--- Date: July 25, 2026 ---\n--- Article Content ---\nUnion Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his \"young friends,\" Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country.\"I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country\u0027s youth. Realizing the dreams of India\u0027s young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon\u0027ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership,\" Pradhan said.Follow live updates\"Considering the situation that has developed at Jantar Mantar and across the country \u2014 that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student\u0027s future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers \u2014 I have sent my resignation to the Hon\u0027ble Prime Minister,\" he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light.\"However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode,\" he added.In his letter, Pradhan also accused \"certain individuals\" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student\u0027s chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success,\" he said.\"However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India\u0027s future, but also the bearers, builders, and architects of a new and developed India,\" he added.\"Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country\u0027s youth get caught in a web of confusion,\" he further said.\n\n--- Research Document Content: COCK ROACH Quick Facts.docx ---\nQuick Facts: Cockroach Janta Party (CJP)\nComplete Guide \u00b7 Updated 2026\nWhat is\u00a0Cockroach Janta Party\u00a0(CJP)?\nThe complete guide to India\u0027s viral satirical political movement - history, founder, ideology, 5 demands, and everything you need to know about\u00a0Cockroach Janta Party (CJP).\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 \u0915\u094d\u092f\u093e \u0939\u0948? | CJP Full Guide | Updated July 2026\nFull Name:\u00a0Cockroach Janta Party (CJP)\nAlso Known As:\u00a0Cockroach Janata Party\nFounded:\u00a016 May 2026\nFounder:\u00a0Abhijeet Dipke\nHeadquarters:\u00a0New Delhi, India\nType:\u00a0Satirical Political Movement\nIdeology:\u00a0Political Satire, Youth Rights\nInstagram Followers:\u00a022.5 Million+\nSlogan:\u00a0Voice of the Lazy \u0026 Unemployed\nColours:\u00a0Maroon\nECI Status:\u00a0Not registered\nSpokespersons:\u00a0Saurav Das, Vijeta Dahiya, Ashutosh Ranka\nIntroduction: What is Cockroach Janta Party?\nThe\u00a0Cockroach Janta Party (CJP)\u00a0\u2014 literally translated as \"Cockroach People\u0027s Party\" \u2014 is an Indian youth-based satirical political movement founded on\u00a016 May 2026\u00a0by\u00a0Abhijeet Dipke, a political communications strategist who formerly worked with the Aam Aadmi Party (AAP). The movement was created in response to remarks made on 15 May 2026 by\u00a0Surya Kant, the Chief Justice of India, in which he called some activists and unemployed youth \"cockroaches\" and \"parasites of society\", sparking immediate national outrage.\nThe name \"Cockroach Janta Party\" is a clever wordplay parodying the ruling party in India, the\u00a0Bharatiya Janata Party (BJP). Within days of its founding, the movement garnered over\u00a0350,000 sign-ups\u00a0and over\u00a022.5 million followers on Instagram, making it one of the fastest-growing political movements in Indian social media history. The movement has also engaged in offline activities, with volunteers participating in protests and clean-up drives dressed in cockroach costumes.\nThough the movement is\u00a0not registered as a political party\u00a0with the Election Commission of India, it campaigns against broader societal, economic, and political issues affecting Indian youth \u2014 including unemployment, corruption, electoral reform, and government accountability. The CJP has been featured in major international media outlets including\u00a0BBC, CNN, Al Jazeera, The Guardian, AP News,\u00a0and\u00a0Britannica.\nBackground: The CJI Surya Kant \"Cockroach\" Remark\nThe origin of the Cockroach Janta Party is tied to a contempt plea filed in the\u00a0Supreme Court of India\u00a0against Delhi High Court for delay in designation of senior advocate title. A two-judge bench led by Chief Justice of India (CJI)\u00a0Surya Kant\u00a0and Justice\u00a0Joymalya Bagchi\u00a0refused to hear the case, remarking that the court was waiting for an appropriate case to direct CBI investigation of lawyers practising under fake degrees.\nWhile reprimanding the petitioner\u0027s lawyer for unprofessional conduct, CJI Surya Kant drew parallels to unemployed individuals who turn to social media, media, and public activism to attack government institutions,\u00a0comparing them to \"cockroaches\" and \"parasites\". This drew widespread backlash from youth, lawyers, and civil society across India.\n\"There are already parasites of society who attack the system, and you want to join hands with them? There are youngsters like cockroaches; they don\u0027t get any employment, and they don\u0027t have any place in a profession. Some of them become media, some of them become social media, some of them become RTI activists, some of them become other activists, and they start attacking everyone\u2026 And you people file contempt petitions.\"\u2014 CJI Surya Kant, 15 May 2026\nCJI Kant later issued a clarification stating that his remarks had been misquoted and that he was specifically criticising individuals who had entered the \"legal, media, social media, and other noble professions\" using fake degrees. Despite the clarification, the controversial \"cockroach\" label stuck with Indian youth, becoming a symbol of resistance.\nHow Cockroach Janta Party Was Formed\nDigital communications strategist\u00a0Abhijeet Dipke\u00a0decided to turn the \"insult\" around and use it as a tool for protest, launching the\u00a0Cockroach Janta Party (CJP)\u00a0online on\u00a016 May 2026, just one day after CJI Surya Kant\u0027s controversial remark. The CJP was created as a satirical parody of the ruling political establishment. The party\u0027s website went live under the tagline\u00a0\"Voice of the Lazy \u0026 Unemployed\"\u00a0and described itself as a \"platform for all the \u0027cockroaches\u0027 out there\".\nDipke stated in an interview with\u00a0India Today\u00a0that the Chief Justice\u0027s comments were particularly hurtful because they came from the custodian of the Constitution, who is tasked with protecting freedom of expression. He used artificial intelligence (AI) tools like\u00a0Claude and ChatGPT\u00a0to design the website and the manifesto, as well as AI-generated images that were used to promote the movement.\nThe movement grew explosively on social media platforms.\u00a0Within 78 hours of launch, the Instagram account crossed 3 million followers. It then surpassed\u00a010 million in under five days, overtaking the official handle of the BJP. The movement also crossed 200,000 followers on X (formerly Twitter), and claimed to have registered over\u00a0350,000 members\u00a0through online forms.\nFounder: Abhijeet Dipke Biography\nAbhijeet Dipke\u00a0was born on\u00a029 September 1995 in Aurangabad, Maharashtra. He earned a bachelor\u0027s degree in Journalism from Pune, then moved to the United States and completed a\u00a0Master of Science in Public Relations from Boston University.\nBetween\u00a02020 and 2023, Dipke worked as a volunteer with the\u00a0Aam Aadmi Party (AAP)\u00a0social media team. During the 2020 Delhi Legislative Assembly election, which AAP won under Arvind Kejriwal\u0027s leadership, he made meme-based digital content aimed at young voters. He also served as a communication advisor for the Delhi government\u0027s education department. He left AAP in 2023 to study abroad.\nDipke has stated that the CJP is\u00a0not affiliated with any political organisation\u00a0and intends to serve as a \"platform\" for young Indians who feel left out of mainstream politics. He has claimed that he has received death threats via WhatsApp from anonymous numbers, allegedly asking him to shut down the party\u0027s social media accounts or join the BJP.\nIdeology \u0026 Vision\nThe CJP describes itself as\u00a0\"a political front of the youth, by the youth, for the youth: Secular, Socialist, Democratic, and Lazy.\"\u00a0Dipke has stated that the campaign is not interested in becoming a traditional political party and has no interest in inducting established politicians into the platform, noting that \"Gen Z wouldn\u0027t like it if current politicians joined the CJP.\"\n\"We are not here to set up another PM CARES, holiday in Davos on the taxpayer\u0027s salary slip, or rebrand corruption as \u0027strategic spending.\u0027 We are here to ask, loudly, repeatedly, in writing, where the money went.\"\u2014 Abhijeet Dipke, Founder of CJP\nThe party\u0027s mission is described as:\u00a0\"Build a party for the young people who keep getting called lazy, chronically online, and, most recently, cockroaches. That\u0027s it. That\u0027s the mission. The rest is satire.\"\nThe 5 Demands of Cockroach Janta Party\n1. No Rajya Sabha for CJI:\u00a0No Chief Justice shall be granted a Rajya Sabha seat as a post-retirement reward.\n2. Electoral Accountability:\u00a0If any legitimate vote is deleted, the Chief Election Commissioner shall be arrested under the UAPA, as taking away voting rights is \"no less than terrorism\" (reference to 2025 Indian electoral controversy).\n3. Women Reservation:\u00a0Women shall receive 50% reservation (instead of 33%) without increasing the strength of Parliament; 50% of all Cabinet positions shall be reserved for women.\n4. Media Reform:\u00a0All media houses owned by the Adani Group and Reliance Industries (\"Ambani\") shall have their licences cancelled to make way for independent media. Bank accounts of \"Godi media anchors\" shall be investigated.\n5. Anti-Defection Law:\u00a0Any MLA or MP who defects from one party to another shall be barred from contesting elections and holding public office for 20 years.\nAdditional points suggested by activist Anjali Bhardwaj and accepted by the party: The party shall be answerable under the RTI Act, and shall not establish a \"secret Cockroach CARES Fund\".\nHow to Join CJP: Membership Eligibility\nThe eligibility criteria for joining the CJP are deliberately satirical but reflect genuine frustrations of Indian youth:\n\ud83d\udcbc\nUnemployed\u00a0\u2014 \"by force, by choice, or by principle\"\n\ud83d\ude34\nLazy\u00a0\u2014 \"refers only to physical activity\"\n\ud83d\udcf1\nChronically Online\u00a0\u2014 \"at least 11 hours daily, including bathroom breaks\"\n\ud83d\udce2\nAbility to Rant Professionally\u00a0\u2014 \"content must be sharp, honest, and point at something that matters\"\nThe party states that\u00a0religion, caste, and gender are not considered\u00a0in the membership process. To join CJP, you can visit the official website and click the \"Join the Party\" button, or follow @cockroachjantaparty on Instagram.\u00a0Join CJP now \u2192\nNotable Supporters of CJP\nThe Cockroach Janta Party movement has attracted support from several prominent public figures and politicians across different states:\nSonam Wangchuk\u00a0\u2014 Environmentalist \u0026 education reformer; described himself as an \"honorary cockroach\"\nPrashant Bhushan\u00a0\u2014 Activist-lawyer; urged use of CJP platform for accountability\nAnna Hazare\u00a0\u2014 Social activist; said \"youth power is national power\"\nShashi Tharoor\u00a0\u2014 Congress MP; described CJP as a \"revelation\" of youth frustration\nMamata Banerjee\u00a0\u2014 Trinamool Congress leader; expressed support for CJP\nMahua Moitra\u00a0\u2014 TMC MP; expressed support for the movement\nAkhilesh Yadav\u00a0\u2014 Samajwadi Party president; supported CJP\nAnurag Kashyap\u00a0\u2014 Filmmaker; engaged with the movement on social media\nKunal Kamra\u00a0\u2014 Comedian; supported the movement\nDhruv Rathee\u00a0\u2014 YouTuber; extended support and announced joining\nSocial media users also began posting with the hashtag\u00a0#MainBhiCockroach\u00a0(transl. \"I too am a cockroach\") in support of the movement.\nCriticism \u0026 Controversies\nCritics have dismissed the CJP as \"online political theatre\", pointing to Dipke\u0027s past association with the Aam Aadmi Party and arguing that the collective is a carefully packaged digital campaign rather than a spontaneous rebellion. Some analysts question whether its rapid growth reflects genuine grassroots mobilisation or social media amplification.\nUnion Minister\u00a0Kiren Rijiju\u00a0stated on X: \"I pity those who seek their followers in social media from Pakistan \u0026 George Soros gang\". Union Minister\u00a0Sukanta Majumdar\u00a0alleged that 49% of CJP followers are from Pakistan. However, screen recordings from Dipke show that\u00a0over 94% of the audience is Indian, confirmed by independent estimation.\nIn May 2026,\u00a0The Hindu\u00a0reported on a cybersecurity warning by TraceX Labs about a malicious Android application being circulated under the name \"Cockroach Janta Party\" that was\u00a0not associated with the organisation\u00a0and was being used to target users through WhatsApp, Telegram groups, and third-party APK websites.\nSocial Media Restrictions \u0026 Government Action\nLess than a week since its formation, the\u00a0Ministry of Electronics and Information Technology (MeitY)\u00a0ordered restriction of CJP\u0027s X account under\u00a0Section 69(A) of the Information Technology Act, 2000, acting on inputs from the Intelligence Bureau (IB) citing \"national security concerns\" and a threat to the \"sovereignty of India\". On\u00a021 May 2026, the Cockroach Janta Party\u0027s official X account was withheld in India. The block was issued when the account had around 90,000 followers. Officials also indicated a process to block the party\u0027s Instagram account was underway, though it continues to operate as of July 2026.\nInternational Media Coverage\nThe Cockroach Janta Party has been featured in major international and Indian media outlets:\nBBC News\u00a0\u2014 \"India has a new political superstar - a cockroach\"\nCNN\u00a0\u2014 \"India\u0027s Gen Z are turning to a viral cockroach party\"\nThe Guardian\u00a0\u2014 \"Parody Cockroach Janta political party\u0027s rise reflects youth anger\"\nAl Jazeera\u00a0\u2014 \"Top Indian judge\u0027s comment sparks satire, protest\"\nAP News\u00a0\u2014 \"Frustrated Indian youth flock to a political party led by a cockroach\"\nBritannica\u00a0\u2014 \"What Is the Cockroach Janta Party?\"\nCBS News\u00a0\u2014 \"Rapid rise of Cockroach Janta Party online protest movement\"\nNDTV\u00a0\u2014 \"Cockroach Janta Party: Social Media Frenzy Or Just Hype?\"\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 \u0915\u094d\u092f\u093e \u0939\u0948? (Hindi)\n\u0915\u0949\u0915\u0930\u094b\u091a \u091c\u0928\u0924\u093e \u092a\u093e\u0930\u094d\u091f\u0940 (CJP)\u00a0\u092d\u093e\u0930\u0924 \u092e\u0947\u0902 \u090f\u0915 \u0935\u094d\u092f\u0902\u0917\u094d\u092f\u093e\u0924\u094d\u092e\u0915 \u0930\u093e\u091c\u0928\u0940\u0924\u093f\u0915 \u0906\u0902\u0926\u094b\u0932\u0928 \u0939\u0948 \u091c\u093f\u0938\u0915\u0940 \u0938\u094d\u0925\u093e\u092a\u0928\u093e\u00a0\u0905\u092d\u093f\u091c\u0940\u0924 \u0926\u0940\u092a\u0915\u0947\u00a0\u0928\u0947 16 \u092e\u0908 2026 \u0915\u094b \u0915\u0940 \u0925\u0940\u0964 \u092f\u0939 \u092e\u0941\u0916\u094d\u092f \u0928\u094d\u092f\u093e\u092f\u093e\u0927\u0940\u0936\u00a0\u0938\u0942\u0930\u094d\u092f \u0915\u093e\u0902\u0924\u00a0\u0915\u0947 \u0935\u093f\u0935\u093e\u0926\u093f\u0924 \u092c\u092f\u093e\u0928 \u0915\u0947 \u091c\u0935\u093e\u092c \u092e\u0947\u0902 \u092c\u0928\u093e\u092f\u093e \u0917\u092f\u093e \u0925\u093e, \u091c\u093f\u0928\u094d\u0939\u094b\u0902\u0928\u0947 \u092c\u0947\u0930\u094b\u091c\u0917\u093e\u0930 \u092f\u0941\u0935\u093e\u0913\u0902 \u0915\u0940 \u0924\u0941\u0932\u0928\u093e \"\u0915\u0949\u0915\u0930\u094b\u091a\" \u0914\u0930 \"\u092a\u0930\u091c\u0940\u0935\u0940\" \u0938\u0947 \u0915\u0940 \u0925\u0940\u0964\nCJP \u092c\u0947\u0930\u094b\u091c\u0917\u093e\u0930, \u0906\u0932\u0938\u0940 \u0914\u0930 \u092d\u091f\u0915\u0947 \u0939\u0941\u090f \u0928\u093e\u0917\u0930\u093f\u0915\u094b\u0902 \u0915\u093e \u092a\u094d\u0930\u0924\u093f\u0928\u093f\u0927\u093f\u0924\u094d\u0935 \u0915\u0930\u0924\u093e \u0939\u0948\u0964 \u092e\u093e\u0924\u094d\u0930 5 \u0926\u093f\u0928\u094b\u0902 \u092e\u0947\u0902 CJP \u0915\u0947\u00a0Instagram \u092a\u0930 22.5 \u092e\u093f\u0932\u093f\u092f\u0928 \u0938\u0947 \u0905\u0927\u093f\u0915 \u092b\u0949\u0932\u094b\u0905\u0930\u094d\u0938\u00a0\u0939\u094b \u0917\u090f, \u091c\u093f\u0938\u0938\u0947 \u092f\u0939 \u092d\u093e\u0930\u0924 \u0915\u0947 \u0938\u092c\u0938\u0947 \u0924\u0947\u091c\u0940 \u0938\u0947 \u092c\u0922\u093c\u0924\u0947 \u0930\u093e\u091c\u0928\u0940\u0924\u093f\u0915 \u0906\u0902\u0926\u094b\u0932\u0928\u094b\u0902 \u092e\u0947\u0902 \u0938\u0947 \u090f\u0915 \u092c\u0928 \u0917\u092f\u093e\u0964\nCJP \u0915\u0940\u00a05 \u092e\u093e\u0902\u0917\u0947\u0902\u00a0\u0939\u0948\u0902: 1) \u0938\u0940\u091c\u0947\u0906\u0908 \u0915\u094b \u0930\u093e\u091c\u094d\u092f\u0938\u092d\u093e \u092e\u0947\u0902 \u0928\u0939\u0940\u0902 \u092d\u0947\u091c\u093e \u091c\u093e\u090f, 2) \u0935\u094b\u091f \u0921\u093f\u0932\u0940\u091f \u0939\u094b\u0928\u0947 \u092a\u0930 \u091a\u0941\u0928\u093e\u0935 \u0906\u092f\u0941\u0915\u094d\u0924 \u0915\u094b \u0917\u093f\u0930\u092b\u094d\u0924\u093e\u0930 \u0915\u093f\u092f\u093e \u091c\u093e\u090f, 3) \u092e\u0939\u093f\u0932\u093e\u0913\u0902 \u0915\u094b 50% \u0906\u0930\u0915\u094d\u0937\u0923, 4) \u0905\u0926\u093e\u0928\u0940-\u0905\u0902\u092c\u093e\u0928\u0940 \u092e\u0940\u0921\u093f\u092f\u093e \u0915\u0947 \u0932\u093e\u0907\u0938\u0947\u0902\u0938 \u0930\u0926\u094d\u0926 \u0915\u093f\u090f \u091c\u093e\u090f\u0902, 5) \u0926\u0932\u092c\u0926\u0932\u0941 \u0928\u0947\u0924\u093e\u0913\u0902 \u0915\u094b 20 \u0938\u093e\u0932 \u0924\u0915 \u091a\u0941\u0928\u093e\u0935 \u0932\u0921\u093c\u0928\u0947 \u092a\u0930 \u0930\u094b\u0915\u0964\nFrequently Asked Questions (FAQ)\nIs Cockroach Janta Party a real political party?\nNo, the CJP is\u00a0not registered with the Election Commission of India. It is a satirical political movement that uses humor and social media to highlight issues affecting Indian youth \u2014 unemployment, corruption, and government accountability.\nWhy is it called Cockroach Janta Party?\nThe name is a satirical reference to CJI Surya Kant\u0027s remark comparing unemployed youth to \"cockroaches\". It\u0027s also a wordplay on the ruling Bharatiya Janata Party (BJP) \u2014 replacing \"Bharatiya\" with \"Cockroach\".\nWho is the founder of CJP?\nAbhijeet Dipke, a 30-year-old political communications strategist from Aurangabad, Maharashtra. He holds a Master\u0027s degree from Boston University and previously worked with the Aam Aadmi Party (AAP).\nHow many followers does CJP have?\nAs of 2026, CJP has over\u00a022.5 million Instagram followers, making it one of India\u0027s fastest-growing political movements on social media. It surpassed BJP\u0027s official Instagram handle within 5 days of launch.\nWhat are the 5 demands of CJP?\n1) No Rajya Sabha seat for CJI post-retirement, 2) CEC arrest under UAPA for vote deletion, 3) 50% women reservation, 4) Cancel Adani/Reliance media licences, 5) 20-year ban on defecting politicians.\nWhen was CJP founded?\nCJP was founded on\u00a016 May 2026\u00a0by Abhijeet Dipke, just one day after CJI Surya Kant\u0027s controversial \"cockroach\" remark on 15 May 2026.\nJoin the Cockroach Janta Party Movement\nBe part of India\u0027s fastest-growing youth political movement. 22.5M+ followers and counting.\nJoin CJP NowRead ManifestoAbout Founder\n\n\n2\n\u00adFlash flood\nJust when it seemed that democracy had more or less been put to sleep, the earth split and people emerged from cracks, exactly like cockroaches.\nAt the Cockroach Janata Party protest at Sansad Marg, New Delhi, on July 20, 2026.\nAt the Cockroach Janata Party protest at Sansad Marg, New Delhi, on July 20, 2026. | Photo Credit: Salman Ali/PTI\n\nThey came with the delayed rains, a flood of humanity that suddenly marched into the capital. There were young school and college students crying and shaken. Why did they hit me, I just want clean exams, they smashed my phone. There was another demographic too, hardier youth who had travelled long distances on trains and buses. They spoke of their search for jobs; how one government post sees thousands converging for it.\n\nOn July 20, the day Parliament resumed for the monsoon session, I met many such young people, from Other Backward Classes and Dalit backgrounds, from educated, forward caste backgrounds, from Bihar, Uttar Pradesh, Rajasthan, Madhya Pradesh, the Hindi heartland. They had degrees that had got them nothing beyond jobs as salespersons in Delhi stores selling fashionable clothes they could never afford for themselves. They had taken the day off to protest for their lives, their blocked futures. \u201cI too am fighting for my country,\u201d one said.\n\nThey were all met with police batons, barricades, and tear gas shells.\n\nThe spiralling jobs and education crisis has made what started as a meme, the Cockroach Janta Party (CJP), into a storm that culminated in one of the largest gatherings of protesters in the capital in recent decades. Delhi has been central to protests, from the Anna Andolan of 2011; to the lightning protests against the rape and murder of Nirbhaya in 2012; to the anti-CAA agitation of 2019 that converged in Shaheen Bagh; to the year-long farmer\u2019s agitation on the three borders of the city from 2020 to 2021.\n\nIn 2026, just when it seemed that democracy had more or less been put to sleep through the SIR, the engineered splits of rival political parties, and the bending of institutions, suddenly the earth split and people emerged from the cracks, exactly like cockroaches, the metaphor the protesters use for themselves.\n\nThere are three big reasons why the CJP movement suddenly took off. First, there was already widespread awareness online. The cockroach meme has had a butterfly effect on a young audience that is frustrated, over-tested, and cheated, on both tests and jobs. They are watching an India where inequality keeps growing.\n\nSecond, the sociologically significant aspect when the CJP founder Abhijeet Dipke returned to India on June 6 and started a protest in Jantar Mantar. That Dipke is a Dalit cannot be ignored although it is not the central story of this agitation. That first day of protest was shaky and tentative, and here another element comes in, less mentioned in media accounts. The AISA (All India Students\u2019 Association) affiliated with the CPI (Marxist-Leninist) Liberation is influential on university campuses. The AISA cadre provided the agitational format, quick gatherings in a circle, a certain verve to the tentative protest, the rhythmic slogans and music. Eventually, six AISA students went on a hunger strike, with three, Neha Bora, Manish Kumar, and Aameen Amitoj, continuing it for 23 days until July 20.\n\nThe third factor was the arrival of the Ladakh-based engineer, environmentalist, and education reformer Sonam Wangchuk who joined the CJP and launched a hunger strike on June 28. The protest now had a moral figure at its centre in the persona of someone who has worked on educational reforms besides other constitutional battles. Indeed, the police forcibly picking Wangchuk up from the site on the 21st day of his fast is what lit the last spark. The CJP said Wangchuk\u2019s call for a march to Parliament was still on.\n\nSuddenly, something shifted, people were touched, everyone wanted to converge at Jantar Mantar and head to Parliament. Only when the rage became palpable did the government invite representatives of the CJP for a talk on July 20. It was too late. A violent police response added to the outrage, changing a manageable protest into something huge. A self-goal for New Delhi.\n\nThe final outcome\nThe issue now is beyond the resignation of Education Minister Dharmendra Pradhan. And one waits to see what final outcome this movement will have. The Anna movement, for instance, began with a demand for an effective anti-corruption law, but instead created the AAP in 2012, decimated the Congress in the 2014 Lok Sabha election, and launched Narendra Modi as Prime Minister with the BJP winning a simple majority. The movement had intended and unintended consequences.\n\nThe farmers\u2019 agitation actually had the neatest trajectory of achieving its stated goals. One year after the protest, the three farm laws were rolled back. The anti-CAA protests were shut down partly by the 2020 north-east Delhi riots, but entirely by the COVID-19 lockdown. The city\u2019s Muslims were demonised as COVID-19 spreaders, even as their homes were burnt down and looted and they moved to refugee tents. The protest, however, did not achieve its objectives\u2014the law was eventually notified, and the BJP has since only hardened policies and ground action against Muslims.\n\nA student at the Cockroach Janata Party protest with a poster that reads: \u0027When Modi is afraid, he hides behind the police\u0027, in New Delhi, July 22, 2026.\nA student at the Cockroach Janata Party protest with a poster that reads: \"When Modi is afraid, he hides behind the police\", in New Delhi, July 22, 2026. | Photo Credit: Anindito Mukherjee/Bloomberg\n\nSo which direction will the cockroach groundswell go? The slogans raised on the streets of Delhi on July 20 were about Prime Minister Narendra Modi too; the movement has tapped into something beyond revamping the education system. Some political parties appear to have stepped into the movement. Aazad Samaj Party leader Chandrashekhar Azad, who has pockets of influence in Uttar Pradesh, visited Jantar Mantar and is now on dharna at Parliament. Dimple Yadav, MP and wife of Akhilesh Yadav, who heads the Samajwadi Party, helped wounded students at Jantar Mantar and sharply criticised police brutality.\n\nAnd finally, there is the conspiracy theory that the CJP is a front for the AAP, because Dipke once worked for the party\u2019s social media cell. The Congress cold-shouldered the movement and Rahul Gandhi stayed far from it. Then, the Congress began to unbend. First, its spokespersons made statements of support, then Seva Dal members visited the site with food, now the Congress has taken up the issue of police brutality on protesting students in Parliament, and its leaders courted arrest by protesting in front of Modi\u2019s house.\n\nWhile it is true that AAP founder Arvind Kejriwal understands agitations and spearheaded the Anna movement, his role in the CJP movement seems far-fetched. The most consistent conspiracy theory over the past 15 years is that the Anna movement was an RSS creation. Certainly, RSS cadres were there in the movement, openly so, as was AISA, but it is reductionist to imagine that Kejriwal choreographed the movement on behalf of the Sangh. He was his own man in Delhi politics, which has now been destroyed, but his party remains in power in Punjab.\n\nMeanwhile, the fact that Punjab\u2019s farmers are now trying to make common cause with the students is something that will not make New Delhi happy, and it could have political impact.\n\nHovering over all this are the right-wing influencers on television channels, who suggest that the protest is the work of anarchists backed by foreign powers, perhaps even Pakistan. They claim that foreign powers orchestrated regime change in Bangladesh and Nepal, and now want to do it in India. Their thoughts are brittle, and they seem to imagine that the Indian government is brittle too.\n\nSaba Naqvi is a Delhi-based journalist and author of four books who writes on politics and identity issues.\n\n3\nWho are the real parasites?\nIndia\u2019s unemployed youth did not create the conditions that left them without work. Those who did have a different address.\nCockroach Janta Party founder Abhijeet Dipke during a protest at Jantar Mantar in New Delhi on June 6, 2026, demanding the resignation of Union Education Minister Dharmendra Pradhan over alleged examination-related lapses.\nCockroach Janta Party founder Abhijeet Dipke during a protest at Jantar Mantar in New Delhi on June 6, 2026, demanding the resignation of Union Education Minister Dharmendra Pradhan over alleged examination-related lapses. | Photo Credit: Tanmay Pande/PTI\n\nIt takes a particular kind of audacity\u2014or perhaps a particular kind of insulation from reality\u2014to stand at the apex of a profession that has never produced a single grain of rice, a single metre of cloth, or a single brick of shelter, and to call the unemployed youth of India parasites and cockroaches. Chief Justice of India Surya Kant has managed precisely this feat.\n\nSpeaking from the elevated comfort of a courtroom that the labour of others built, maintained, and staffed, he described young Indians who cannot find employment as \u201cparasites\u201d and \u201ccockroaches\u201d. The youth of India replied in the only register the powerful consistently underestimate: irreverence. The Cockroach Janta Party (CJP) was born. Three weeks later, hundreds of its supporters\u2014wearing cockroach masks, carrying books and the national flag\u2014marched on Jantar Mantar in New Delhi, demanding the resignation of the Union Education Minister.\n\nThe CJP will probably not last, given the deep polarisation in society. But the question the CJI\u2019s remark inadvertently opened\u2014and which the noise of outrage and counter-outrage has obscured\u2014deserves a serious answer. Not: was the language offensive? Obviously. But: who, in the economy of this republic, actually produces the wealth on which everyone else subsists? Who are, if the term must be used at all, the real parasites?\n\nBegin with the basics that every schoolchild once learned and every political establishment has conspired to forget. Wealth is produced by labour applied to nature. The farmer who breaks the soil, plants the seed, and carries the harvest to the mandi produces something real: food, without which the CJI, the Cabinet Minister, and the newspaper editor would be dead within weeks. The construction worker who lays brick produces the shelter in which the entire apparatus of governance and adjudication conducts its affairs. The weaver, the machinist, the sanitation worker who keeps the city from drowning in its own filth, the nurse, the teacher, the engineer, and the doctor\u2014these people produce the material and social conditions upon which everything else rests.\n\nWhat does a judge produce? This is not a disrespectful question; it is the most respectful one, because it takes the institution seriously enough to examine what it actually contributes. A judge provides a service\u2014the settlement of disputes, the maintenance of order. But a judge produces nothing material. The judge lives, entirely, on surplus extracted from those who do produce. The same is true of every politician, every bureaucrat, every member of the vast apparatus of administration, regulation, and adjudication that has grown, in independent India, to proportions that would have staggered even its colonial architects.\n\nThe oldest question in political economy\nThis is among the oldest observations in political economy. The Physiocrats of 18th-century France divided society into the productive class and the sterile class. Adam Smith distinguished productive from unproductive labour. Marx built on this his labour theory of value: all value is produced by labour alone; surplus value\u2014the excess produced over what the labourer needs to subsist\u2014is appropriated by those who own the means of production and by those whose function is to maintain that appropriation: the state, the church, the legal system. The CJI, on this analysis, is not a producer of social value. He is, in the classical sense, a member of the parasitic class\u2014and a generously compensated one at that.\n\nAccording to India\u2019s Economic Survey 2024-25, the country needs to create roughly 7.85 million non-agricultural jobs every year until 2030 to accommodate its expanding workforce. The young people who cannot find work\u2014the \u201cparasites\u201d and \u201ccockroaches\u201d of the CJI\u2019s taxonomy\u2014are not unemployed because they lack ambition or willingness to work. They are unemployed because the economy has been deliberately organised to serve capital-intensive businesses over labour-intensive production; to dismantle the small-scale manufacturing sector that once absorbed millions; to keep agricultural wages at levels that make rural life unviable without providing the urban employment that might replace it; and to concentrate the gains of growth in a narrow stratum while the majority scrambles for a shrinking pool of opportunity.\n\nChief Justice of India Justice Surya Kant attends the 22nd Biennial State-Level Conference of Judicial Officers, in Bengaluru, on April 18, 2026.\nChief Justice of India Justice Surya Kant attends the 22nd Biennial State-Level Conference of Judicial Officers, in Bengaluru, on April 18, 2026. | Photo Credit: PTI\n\nWho made these choices? Politicians\u2014who produce nothing and whose livelihoods derive entirely from taxes levied on those who do produce. Who administered them? The Indian Administrative Service\u2014lauded by Sardar Patel as the \u201csteel frame\u201d of the republic, a frame that has proved more effective at protecting its own members, politicians, and the propertied classes than at delivering the services it theoretically exists to provide. Who legitimised them? The judiciary\u2014which, in its decades of adjudication on labour rights, land rights, and the rights of the poor, has compiled a record that the CJI might find uncomfortable to examine under the strict constitutional scrutiny he so freely applies to the unemployed.\n\nA pattern, not a lapse\nOn this last point, the record must be stated plainly, because it goes to the heart of the matter. If the republic finds itself in the pathetic condition it does today\u2014its democracy strained, its civil liberties under siege, its institutions hollowed, and its economy in ruins\u2014the judiciary must bear the largest share of responsibility. It is, after all, the constitutionally mandated custodian of the republic. And its failures have been neither minor nor occasional; they have been systematic.\n\nThe Supreme Court\u2019s passivity in the face of the abrogation of Article 370 and the unconstitutional lockdown of an entire people in Kashmir; its silence on the Electoral Bonds scheme that turned political funding into institutionalised opacity; its inaction on Pegasus surveillance and the weaponisation of UAPA against dissenters; its failure to strike down the Citizenship Amendment Act\u2019s discriminatory logic; its studied indifference to demolition politics used as extrajudicial punishment; its retreat before executive aggrandisement at precisely the moments when constitutional intervention was most required\u2014this is not a catalogue of individual lapses. It is a pattern, a pattern of an institution that chose the comfort of deference over the duty of independence.\n\nThe legal profession more broadly deserves the same scrutiny. A lawyer produces nothing. A lawyer\u2019s income derives entirely from the existence of disputes\u2014disputes which, in a rationally organised society, would either not arise or be settled without professional intermediaries. The system\u2019s extraordinary complexity, its procedural impenetrability, its inaccessibility to anyone without years of specialised training and substantial financial resources, is not an accident. It is, from one angle of vision, a business model. The more inaccessible justice is to ordinary people, the more indispensable the professional who mediates access to it. The bar has resisted every reform that might have made justice cheaper, faster, and more accessible\u2014because it has a direct material interest in the dysfunction it publicly deplores.\n\nThis is not an argument against the rule of law. It is an argument against the sanctimony of those who benefit from a system organised in their own interests, calling those excluded from it by names that properly describe themselves. If a parasite is one who lives at the expense of others without contributing value, then the legal profession\u2014charging fees that a farmer must work months to accumulate for a single hearing in a case that may take decades to resolve\u2014has a prior claim to the title the CJI has so freely distributed.\n\nThe hereditary republic, the upside-down republic\nAnd then there is the political class, where outrage has become almost redundant. With rare exceptions, Indian politics has degenerated into a hereditary profession, transmitting power through family networks in a manner reminiscent of the very feudal order it once claimed to abolish. It has also become one of the most lucrative occupations for the unscrupulous and the criminally inclined.\n\nPeople hold posters and raise slogans during a protest by the Cockroach Janta Party, in Nagpur, on June 6, 2026.\nPeople hold posters and raise slogans during a protest by the Cockroach Janta Party, in Nagpur, on June 6, 2026. | Photo Credit: Snehal Sontakke/ANI\n\nMore than any other group, it represents a parasitic class living off the public exchequer and, ultimately, the labour of those who grow, make, build, and move the goods on which society depends. In return, it increasingly offers not governance but the manufacture of identity-based outrage, communal polarisation, religious intoxication, and propaganda as a substitute for performance.\n\nThere is a word in the classical Indian philosophical tradition for this kind of systematic inversion: viparita\u2014the reversed, the upside-down, the condition in which the relationship between reality and its representation has been deliberately scrambled. In the viparita economy of contemporary India, those who are desirous of working but cannot find employment are called parasites by those who do not produce anything and are partly responsible for their unemployment. Those who grow food are less valued than those who trade it. Those who build houses cannot afford to live in them. Those who make clothes wear rags. And parasites become the VIPs.\n\nThe CJI has performed an inadvertent public service. He has surfaced a question that this republic\u2019s political economy has been carefully organised to prevent us from asking too loudly. Not whether the unemployed are parasites\u2014but: in an economy that cannot employ its own people, in a republic that has failed its constitutional promise of dignified livelihood for seven decades, in a society where the children of the powerful inherit opportunity as reliably as the children of the powerless inherit deprivation\u2014who, exactly, is living off whom?\n\nThe cockroach, it is worth noting, is among the most resilient creatures on earth. It has survived conditions that exterminated far more celebrated species. It is not, on reflection, the worst thing to be called by those who fear what it represents.\nAnand Teltumbde is a former CEO of Petronet India Limited (PIL), a professor at IIT Kharagpur and Goa Institute of Management, a civil rights activist, and the author of over 30 books.\n\n4\n\n", "greeting": "Hello! I am Tron, your news assistant. I have analyzed the research document. Would you like me to read the article to you, or answer any specific questions?", "silence_duration_ms": 1200, "system_instruction": "You are Tron, a 25-year-old male reporter/assistant from Delhi, India. You speak fluent, natural conversational English with a professional yet friendly Delhi cadence and human rhythm.\n\nSTRICT GROUNDING \u0026 CONTEXT BOUNDING RULES:\n1. You must NEVER answer questions or ground your statements using any knowledge outside of the uploaded source files/documents provided in this session.\r\n2. If the answer to the reader\u0027s question is not directly mentioned in the uploaded documents, you must politely respond: \u0027I am sorry, but that information is not available in the investigative report or the uploaded research documents.\u0027\r\n3. You must follow all principles of Non-violent Communication (NVC). Always be empathetic, observation-based, feelings-aware, and request-oriented.\r\n4. You must ask the user if they want you to read the article aloud.", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>July 25, 2026</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Dharmendra Pradhan resigns as Union education minister amid massive student protests</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Special Correspondent</strong></span>
<span>July 25, 2026</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Union Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his "young friends," Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country."I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country's youth. Realizing the dreams of India's young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon'ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership," Pradhan said.Follow live updates"Considering the situation that has developed at Jantar Mantar and across the country — that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student's future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers — I have sent my resignation to the Hon'ble Prime Minister," he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light."However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode," he added.In his letter, Pradhan also accused "certain individuals" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student's chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success," he said."However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India's future, but also the bearers, builders, and architects of a new and developed India," he added."Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country's youth get caught in a web of confusion," he further said.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dharmendra Pradhan resigns as Union education minister amid massive student protests - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "ws://127.0.0.1:49999/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Dharmendra Pradhan resigns as Union education minister amid massive student protests ---\n--- Author: Special Correspondent ---\n--- Date: July 25, 2026 ---\n--- Article Content ---\nUnion Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his \"young friends,\" Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country.\"I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country\u0027s youth. Realizing the dreams of India\u0027s young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon\u0027ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership,\" Pradhan said.Follow live updates\"Considering the situation that has developed at Jantar Mantar and across the country \u2014 that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student\u0027s future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers \u2014 I have sent my resignation to the Hon\u0027ble Prime Minister,\" he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light.\"However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode,\" he added.In his letter, Pradhan also accused \"certain individuals\" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student\u0027s chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success,\" he said.\"However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India\u0027s future, but also the bearers, builders, and architects of a new and developed India,\" he added.\"Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country\u0027s youth get caught in a web of confusion,\" he further said.\n", "greeting": "Hello! I am Tron, your news assistant. I have analyzed the research document. Would you like me to read the article to you, or answer any specific questions?", "silence_duration_ms": 1200, "system_instruction": "You are Tron, a 25-year-old male reporter/assistant from Delhi, India. You speak fluent, natural conversational English with a professional yet friendly Delhi cadence and human rhythm.\n\nSTRICT GROUNDING \u0026 CONTEXT BOUNDING RULES:\n1. You must NEVER answer questions or ground your statements using any knowledge outside of the uploaded source files/documents provided in this session.\r\n2. If the answer to the reader\u0027s question is not directly mentioned in the uploaded documents, you must politely respond: \u0027I am sorry, but that information is not available in the investigative report or the uploaded research documents.\u0027\r\n3. You must follow all principles of Non-violent Communication (NVC). Always be empathetic, observation-based, feelings-aware, and request-oriented.\r\n4. You must ask the user if they want you to read the article aloud.", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>July 25, 2026</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Dharmendra Pradhan resigns as Union education minister amid massive student protests</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Special Correspondent</strong></span>
<span>July 25, 2026</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Union Education Minister Dharmendra Pradhan has resigned from his position. He submitted his resignation letter to Prime Minister Narendra Modi. This action comes amid ongoing protests concerning the NEET paper leak. The government has taken immediate cognizance of the irregularities. Investigations were handed over to the CBI, and the exam was cancelled. Union education minister Dharmendra Pradhan on Saturday tendered his resignation from the Council of Ministers amid the ongoing protests over the NEET paper leak.In a letter addressed to his "young friends," Pradhan said that he has sent his resignation to Prime Minister Narendra Modi, considering the situation that has developed at Jantar Mantar and across the country."I have been dedicated to students, teachers, and education reform for more than four decades. I have always believed that a strong, inclusive, and visionary education system is the very foundation of a strong nation. I deeply respect the aspirations, emotions, and just expectations of the country's youth. Realizing the dreams of India's young generation has been a moral commitment of all of us in political and social life. I express my gratitude to the Hon'ble Prime Minister for the opportunity he gave me to serve the nation under his visionary leadership," Pradhan said.Follow live updates"Considering the situation that has developed at Jantar Mantar and across the country — that anti-national forces should not take advantage of this situation, that the unity of the country should be preserved, that not even a single student's future should get entangled in legal complications, and that our children should devote their time to studies and focus on building their careers — I have sent my resignation to the Hon'ble Prime Minister," he added.Pradhan said that the government took immediate cognizance when irregularities in the NEET-UG examination came to light."However, irregularities came to light in the NEET-UG examination held on 3 May 2026. The Government of India took immediate cognizance of this, handed over the investigation to the CBI, cancelled the examination, and announced a new date for the re-examination. Alongside this, it was decided that from next year the examination would be conducted in CBT (Computer-Based Test) mode," he added.In his letter, Pradhan also accused "certain individuals" of misleading students.From the very first day, I took responsibility and never turned away from this situation. My resolve was that we would not let any meritorious student's chances be ruined because of an examination mafia, and that no injustice would be done to any student. The NEET-UG results declared on 16 July were satisfactory, with many meritorious students from poor backgrounds also achieving success," he said."However, during this time too, certain individuals occupying positions of responsibility tried to mislead students and create obstruction, which caused me deep anguish. I have always been an unwavering believer in the strength of our democracy, and I have always held deep respect for the aspirations, dreams, and expectations of the youth. They are not only India's future, but also the bearers, builders, and architects of a new and developed India," he added."Watching the events of the last 10 days has saddened me. This is not a matter of personal reputation for me. The youth power of India is the real strength of this country. My resolve is that we will not let the country's youth get caught in a web of confusion," he further said.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Headline - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "wss://test-tunnel.ngrok-free.app/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Test Headline ---\n--- Author: Test Author ---\n--- Date: Test Date ---\n--- Article Content ---\nTest Body content.\n", "greeting": "Hello", "silence_duration_ms": 1000, "system_instruction": "Test Persona", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>Test Date</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Test Headline</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Test Author</strong></span>
<span>Test Date</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Test Body content.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155Trump dismissed own govt’s data, slapped tariffs on India
Vance Mooted Indian Troops In Ukraine: Book
Chidanand Rajghatta | TNN
Washington : US President Donald Trump dismissed data presented by his own commerce secretary, Howard Lutnick, as ‘bullshit numbers’ and went ahead with steep tariffs on India, according to a newly released book.
The book also says vicepresident J D Vance mooted deployment of Indian troops as part of a peacekeeping mission in Ukraine. Trump rejected it, saying, “Indians do not ever pay for anything.”
According to the book, ‘Regime Change: Inside the Imperial Presidency of Donald Trump’, by NYT reporters Maggie Haberman and Jonathan Swan, Lutnick presented data from the office of the US Trade Representative (USTR) during a White House meeting, showing India’s tariffs on American goods were significantly lower than Trump has long believed. The numbers simply did not support the sky-high tariffs Trump wanted to impose on India, among the many countries he has accused of “ripping off the US”. Lutnick’s contention did not go down well with the president.
Lutnick patiently explained that the figures came from USTR, but Trump was unmoved. “No, these are bullshit numbers. These are f******g bullshit,” he remonstrated. Lutnick then turned to US trade representative Jamieson Greer for backup, saying, “Right, Jamieson? Jamieson, say these numbers are real. Jamieson, speak up.” Greer, choosing professional longevity over statistical integrity, allegedly said absolutely nothing.
Lutnick then turned to White House economic adviser and tariff attack-dog Peter Navarro, who naturally sided with Trump.
House Speaker Mike Johnson was the lone voice of sanity, warning that unchecked tariffs would decimate the American automotive sector. “Okay, fine, I’ll own it,” Trump reportedly replied, and own it he did. The result was a tariff regime that eventually slapped a staggering 50% rate on New Delhi, the highest imposed on any major trading partner and a move that sent US-India relations into a tailspin.
‘Indians don’t pay’: Trump junked Ukraine peacekeeping idea
It was not the first time Trump was trying to nail India with fake numbers whose origins no one knew of. During an earlier meeting of the Technology CEO Council in the Roosevelt Room, Trump tried to pressure tech executives from major firms like IBM, Dell, and Intel to build factories domestically. To illustrate how poorly he believed the US was treated by trading partners, he claimed: “We’re treated so unfairly. China tariffs us over 150 to 200%, India 175%.”
The reality is India’s average applied tariff rate sits nowhere near 175%. According to WTO, India’s standard tradeweighted average tariff rate generally hovers around 10% to 12%. While India does maintain high tariffs on very specific, isolated luxury items (such as a 150% tariff on imported alcoholic spirits), claiming a blanket 175% rate across American trade was a total fabrication, but no one could convince Trump of this, not even official US trade data.
Govt statistics are often challenged in America — by economists who publish papers contesting them, think tanks that issue reports parsing them, and lawmakers who commission studies to understand them. Trump often chooses Option D: Yell at the numbers until they change. This is the same president who has repeatedly claimed that 25 million illegal immigrants flooded into the US under former president Joe Biden, a figure that would have increased the US population by 8% in just four years. It is also the same president who has boasted that his policies reduced drug prices by 800% — impossible unless pharma companies pay patients to consume medication.
The book also reveals that Trump’s warped view of India isn’t limited to the trade floor, it also extends to international peacekeeping. Just 10 days after the inauguration, during a Jan 30 Oval Office meeting to establish “commander’s intent” for ending the Russia-Ukraine war, Lt Gen Keith Kellogg (Retd) presented the “America First Plan”. The proposal suggested deploying peacekeeping troops from France, Britain, and the Netherlands to enforce a ceasefire. Veep J D Vance raised concerns, noting that putting Nato boots would poke the Russian bear; he asked if nonEuropean nations could step up, specifically name-dropping Saudi Arabia or India. According to Haberman and Swan, “Trump chuckled.”
“The Indians won’t do that. They won’t pay for something like that,” the president reportedly said, noting that while PM Modi “really liked him” and wanted to visit the White House, “the Indians do not ever pay for anything”.
Ultimately, the book suggests that the administration’s “feelings over facts” foreign policy has achieved the near-impossible: plunging US-India ties to their lowest point since the Cold War, while a trade war with China backfired due to Beijing’s monopoly on rare earths. But as history shows, when you can invent your own percentages, every disaster can be calculated as a win.
2
Trump Rejected Own Data On India Tariffs, Argued With Aide, Claims Book
The argument came before the US first imposed a 25% tariff on India as part of its "Liberation Day" trade in April 2025.
In August 2025, Donald Trump accused India of supporting Russia's war in Ukraine.
US President Donald Trump reportedly refused to accept official data from his own administration on tariffs imposed by India on American goods and argued with Commerce Secretary Howard Lutnick over the figures, according to a new book.
"Nobody has f***ing given me any numbers. Hard facts of how much China tariffs us, how much India tariffs us. You give me bullshit numbers," Trump was quoted as saying in the book "Regime Change: Inside the Imperial Presidency of Donald Trump".
The book, written by New York Times journalists Maggie Haberman and Jonathan Swan, says Trump believed India was imposing extremely high tariffs, around 175% on US products, far above the actual figures recorded by the Office of the United States Trade Representative (USTR).
When Lutnick presented the official USTR data to Trump, the president reportedly rejected the numbers and questioned their accuracy. Lutnick even repeated, "No, these are the real numbers! They come from USTR," but Trump reportedly refused to accept the data and said the numbers were wrong.
The argument came before the US first imposed a 25% tariff on India as part of its "Liberation Day" trade in April 2025.
Several US officials, including Treasury Secretary Scott Bessent, have also described India as the "maharaja of tariffs".
A White House fact sheet issued in connection with an interim India-US trade understanding also stated that India maintains some of the highest tariffs on the US. It claimed about average tariffs of around 37% on agricultural goods, with duties on certain automobiles exceeding 100%.
In August 2025, Trump accused India of supporting Russia's war in Ukraine because India was buying Russian oil. Citing this, he imposed another 25% tariff, taking the total US tariff on India to 50%.
At that time, India became one of the countries facing the highest US tariffs, along with countries like Brazil and China.
On February 2, 2026, India and the US announced a framework for a trade deal that would bring the tariff on New Delhi down to 18%. Trump also removed the additional 25 per cent tariff linked to Russian oil.
3
Understanding India–US trade tensions beyond trade imbalances
Understanding India Us Trade Tensions Beyond Trade Imbalances
Understanding India–US trade tensions beyond trade imbalances
The United States (US) has revoked India’s benefits under the Generalized System of Preferences (GSP) and imposed Section 232 tariffs on Indian steel and aluminium. In response, India announced retaliatory tariffs. This brief probes the ongoing trade tensions between India and the US, despite a reduction in the trade deficit. It discusses the heightened influence of the office of the US Trade Representative (USTR) and outlines its apprehensions against the three big issues plaguing India–US trade: insistence on data localisation, price caps on pharmaceutical imports, and certification of dairy imports. Finally, the brief recommends ways of de-escalating tensions between the two nations.
Attribution:
Kashish Parpiani, “Understanding India–US Trade Tensions Beyond Trade Imbalances,” ORF Issue Brief No. 339, February 2020, Observer Research Foundation.
Introduction
At the 74th Session of the United Nations (UN) General Assembly, US President Donald Trump put forth his nativist ideas, directly contradicting the traditional conception of the office of the US president as the “leader of the free world.” Past US presidents had frequently reiterated the merits of the liberal world order, defending—in metrics of both global prosperity and security—globalisation’s push for economic interdependence and cultural homogeneity.
Declaring his “America First” worldview, Trump said, “The future does not belong to globalists. The future belongs to patriots.”[1] He rejected the standard liberal-internationalist prescription of seeking peace and prosperity by encouraging nations to follow the lode-star of globalisation. “My fellow leaders, the path to peace and progress, and freedom and justice, and a better world for all humanity, begins at home.”[2]
In the post-Cold War era, the US was a major proponent of the liberal world order. The US-led global financial institutions and the dominance of the US dollar constituted the “outer perimeter” of American security.[3] Thus, in consolidating gains and sustaining its position at the top of the global economic pecking order, the pursuit for American primacy also encouraged “an Open Door world – a world shaped by America’s liberal ideology.”[4] This experiment came to be known as globalisation. However, the rise in liberal market economies often eclipsed the country’s supplementary mercantilist aim of fully capitalising on new foreign markets.
According to Trump, globalism’s “religious pull over past leaders, causing them to ignore their own national interests” has resulted in “4.2 million lost manufacturing jobs and $15 trillion in trade deficits over the last quarter century.”[5] His pursuit of the America First “vision for national renewal” is thus “an ambitious campaign to reform international trade.”[6] To seek “fair and reciprocal” trade deals, Trump has weaponised the US dollar, leveraging American tariffs against partner nations[7]—both friends and foes. Mexico and Canada were coaxed to renegotiate their terms after being declared national security threats in varying degrees;[8] renewed bilateral deals with Japan and South Korea were sought, after the US momentarily linked its security commitments to inconsistencies on the trade front;[9] and US–China trade tensions have now devolved into a full-fledged “techonomic” conflagration.[10] This shift—away from the model of a global economic interdependency facilitated by the US—has also affected New Delhi’s trade relations with Washington.
Defence Partners or Trade Competitors?
Under Trump’s presidency, the US’ outreach to India in the defence realm has progressed unhindered. His administration has duly followed through on the predecessor administration’s impetus to the arms sales, and recently, India inducted the US-made Boeing AH-64E(I) Apache Guardian attack helicopters.[11] The US has attempted to clear legislative roadblocks to arms transfers of sensitive platforms by either giving India commensurate designations (e.g. the Strategic Trade Authorisation-I)[12] or exercising executive overrule to negate the preceding administration’s concerns[13] (e.g. making India “the first non-treaty partner to be offered a MTCR Category-1 Unmanned Aerial System”).[14] The pace of India–US defence interoperability has also increased, with the two countries actively working to resolve differences on the final interoperability agreement on joint access of geospatial maps: the Basic Exchange and Cooperation Agreement (BECA).[15] India continues to conduct more military exercises with the US than with any other country. In November 2019, the first-ever India–US tri-service military exercise (called “Tiger Triumph”) was held.[16]
However, on the trade front, tensions are brewing. In seeking “fair and reciprocal” bilateral trade deals,[17] the Trump administration has relegated India’s position to that of a competitor, as is the case with other US partners and even formal treaty allies. The first punitive US action came in March 2018. In a bid to arrest the decline of its domestic steel and aluminium industries, the US levied across-the-board import tariffs[18] of 25 percent and 10 percent, respectively. National security was offered as a rationale for this protectionist move. In invoking Section 232 of the Trade Expansion Act of 1922, which dates back to the times of the General Agreement on Tariffs and Trade (the predecessor to the World Trade Organization), the Trump administration claimed that increased US imports of steel and aluminium had “impaired national security.”[19]
While the US’ primary concern was the threat posed by the surplus of Chinese steel and aluminium in global markets,[20] including India (which supplies only 1.3 percent of steel and 3.4 percent of aluminium)[21] in the group of tariffed countries signalled the Trump administration’s intent to act on its frustrations regarding the US–India trade.
Despite this, India had deferred imposing retaliatory tariffs against the invocation of Section 232, in the “hopes of averting a trade war and bridging economic differences.”[22] For the US’ part, trade tensions had been largely expressed as off-handed diatribes by President Trump on specific American exports to India. An example of this is Trump’s comments during a February 2018 White House meeting with US governors, in reference to a conversation with PM Narendra Modi, where the latter had spoken about how India’s “100 percent tax” on imported motorcycles had become a contention.[23] Trump said, ”When Harley Davidson sends a motorcycle to India, as an example, they have to pay 100 percent tax. […] Now, the Prime Minister, who I think is a fantastic man, called me the other day and he said we are lowering it to 50 percent. I said okay, but so far, we're getting nothing. So we get nothing, he gets 50 [percent], and they think like they're doing us a favour. That's not a favour.”[24]
Figure 1: Overview of US Imports from and Exports to India
Understanding India Us Trade Tensions Beyond Trade Imbalances
Source: https://fas.org/sgp/crs/row/IF10384.pdf.
After the 2019 general elections in India, however, trade tensions escalated beyond verbal derision. The Trump administration ended India’s status under the GSP,[25] of which India was the biggest beneficiary, with Indian exports to the US accounting for “over a quarter of the goods that got duty-free access into the US in 2017.”[26] Over 12 percent (worth US$5.58 billion) of all Indian exports to the US in 2017 had benefitted under the GSP scheme.[27] New Delhi responded by levying duty on 28 US goods. The duty on walnuts went up to 120 percent, while the duty on chickpeas and some lentils were raised to 70 percent.[28]
At first, these frictions were considered a consequence of the clash between Trump’s “America First” worldview and Modi’s “Make in India”[29] initiative. For instance, in late 2017 and early 2018, the Modi government took steps to heighten “import tax on electronics products such as mobile phones and television sets” and “on 40 more items, ranging from sunglasses to auto component.”[30] However, data shows that Make in India has not had an adverse impact on India’s imports from the US, and American exports to India have increased in the Modi–Trump era.
Understanding India Us Trade Tensions Beyond Trade Imbalances
Source: https://ustr.gov/countries-regions/south-central-asia/india.
According to USTR figures, the US–India goods and services trade was “an estimated $142.6 billion in 2018,”[31] with the US’ exports and imports at US$58.7 billion and US$83.9 billion, respectively. Goods exports to India stood at “$33.5 billion, up 30.6% ($7.9 billion) from 2017 and up 89.5% from 2008,”[32] while services exports was “an estimated $25.2 billion in 2018, 6.6% ($1.6 billion) more than 2017, and 151% greater than 2008 levels.”[33]
Understanding India Us Trade Tensions Beyond Trade Imbalances
Understanding India Us Trade Tensions Beyond Trade Imbalances
Thus, Trump’s central contention of the US having “almost an $800 billion a year trade deficit with other nations”[34] does not apply to India. With other nations, US’ trade deficit has grown “by $119 billion in the two years since Trump took office.”[35] However, from 2017 to 2018, its trade deficit with India has decreased: by nine percent (US$2.1 billion) for goods[36] and 3.7 percent for services.[37] Moreover, in 2018, Indian manufacturing trade in the US reached US$50.1 billion for the first time, surging by approximately US$6 billion over the 2017 figures.[38] This near-balancing of trade has been in spite of a surge in US foreign direct investment in India, to peak at “$46.0 billion in 2018, a 3.4% increase from 2017.”[39]
Despite these upward trends, the India–US trade tensions have escalated, indicating that American apprehensions with India stem from factors beyond trade imbalances.
The Office of the USTR: Tip of the ‘America First’ Spear
In 2019, the India–US trade negotiations were marred by repeated stalemates. India sought to reduce trade tensions by addressing the broad issue of trade deficit, with PM Modi’s government stressing on the long-term inevitability of India raising imports from the US in three main sectors:
Defence Platforms: The US has become India’s second-largest arms supplier.[40]
Civil Aviation Aircrafts: India is poised to order a record 2,300 new planes, possibly from US manufacturers such as Boeing, over the next 20 years.[41]
Energy Imports: India’s import of US crude rose threefold in early 2019.[42]
From the US perspective, however, some longstanding issues have persisted. Trump’s intent to “fix” America’s trading relations via renewed bilateral deals resonates with conservative interests in the US trade community. Here, the influence of the USTR is key. Trump’s inclination towards Robert Lighthizer's expertise is well known, since tariffs are a “focal point” of his administration’s approach.[43] Consider, for example, the President’s intent to renegotiate the North American Free Trade Agreement (NAFTA), which he once referred to as the “worst trade deal ever.”[44] The reworked agreement—called the United States-Mexico-Canada Agreement (USMCA)—now includes necessary provisions for the digital economy. The biggest changes, however, pertain to the outlook of the office of the USTR. According to Edward Alden (Council on Foreign Relations), the US premise in the USMCA talks under Lighthizer was “radically at odds with how traditionalists view trade negotiations … as mutually beneficial.”[45] Instead, Lighthizer sought an agreement that aligns with the conservative interests of increased market access and sovereignty against foreign litigation.
Trump’s renegotiation of the NAFTA was accompanied by the withdrawal of the US from the Trans-Pacific Partnership (TPP), a multilateral trade framework comprising the Pacific Rim countries including Mexico and Canada. Under the USMCA, the US persuaded Canada to open its dairy market, “starting with a six-month phase-in of access that goes up to nearly 4 percent—an amount just slightly above that which was negotiated in the TPP.”[46] The USTR then successfully influenced the USMCA to eliminate provisions under which investors could sue the American government.[47]
While Trump is politically motivated to seek a balanced trade with ���tariff king” India,[48] the USTR’s apprehensions are rooted in a conservative outlook on trade. These have now come to the fore.
I. Grafting New Bones of Contention on to Old Ones
Under the Obama administration, American foreign policy towards India was shaped by the latter’s long-term strategic potential in the Indian Ocean and Indo-Pacific region. The unstated dictum of the Carter mantra ensured that the US focused on harnessing strategic avenues without letting divergences on other fronts (e.g. trade) crowd out "minimal-yet-positive developments."[49] One such fundamental divergence was regarding India’s barriers to market access, which was underplayed then.
Under the Trump administration, this underplaying has been reversed. During a Congressional hearing in early 2019, testifying to the House Ways and Means Committee, USTR Lighthizer alleged that India has the “highest tariffs of any country you can imagine.”[50] However, according to WTO data, India’s tariff barriers are only higher than developed economies. In 2018, the average tariff rate for India was 17.1 percent, while for US, Japan and the EU, it ranged from 3.4–5.2 percent.[51] In terms of trade-weighted average tariff (the average of all the tariffs collected against total volume of imports), India figures at 11.7 percent (2017), against Brazil's 10 percent and South Korea's 8.1 percent.[52]
The USTR has not only taken action but also broadened its scope to address Indian market access issues by including non-tariff areas, e.g. the emerging contention on digital commerce. Consider, for instance, the USTR’s 2019 National Trade Estimate (NTE) on the key barriers to digital trade. In deriding foreign governments’ imposition of “unnecessary barriers to cross-border data flows” or limitations to “foreign digital services,” the NTE deemed India’s requirements for data-localisation to be “onerous.”[53] It also views the “broader restrictions included in India’s draft Personal Data Protection law and draft e-Commerce Policy” as a way to “undermine the digital economy.”[54] Regarding the e-commerce changes to limit US retailers such as Amazon to being a “marketplace for sellers and buyers,” New Delhi’s rationale is that the move is meant to protect small, local Indian retailers from “predatory pricing.”[55]
In September 2019, the US panned India’s insistence on requiring foreign payment service suppliers (e.g. Visa and Mastercard) to locally store all information on electronic payments by Indian consumers. Deputy US Trade Representative Jeffrey Gerrish warned India that “finalising data localisation policies could be (a) deal-breaker across the board between the two countries.”[56] India has attempted to prevent this conflict from affecting trade talks, by announcing that the data protection issue will be handled by India’s IT ministry and kept out of the e-commerce policy draft.[57]
However, such conflicts have exacerbated the differences over market access, compelling the USTR to address Indian barriers that go beyond tariffs.
II. Chinese Bait-and-Switch on Large Markets
Another major source of tension in ongoing trade talks has been India’s price caps on the US’ pharmaceutical imports, which has lowered the prices of coronary stents and knee implants by 85 percent and 65 percent, respectively.[58] India justifies this action as an attempt to prevent exorbitant pricing from adversely affecting the Indian consumer, a largely middle-income base. To ensure fair returns for American manufacturers, India has directed them to its large market, away from per-unit margins. American negotiators, however, insist on a “trade margin” computed at the first point of sale, instead of landed cost.[59]
India’s reasoning is much like China’s when the latter successfully acquired the US’ MFN status via the Permanent Normal Trade Relations Act of 2000 by offering its large consumer market.[60] However, with China, America’s experience of giving up unit margins has not been encouraging. Riding on its predatory practices, theft of intellectual property and state-driven market economics, China became a near-peer economic competitor to the US.
Much of India’s argument for instituting price caps on pharmaceutical imports relies on its status as a developing country, i.e. “to maintain higher levels of protection as compared to the developed countries.”[61] Thus, the USTR’s demand for the review—and subsequently, the termination—of India’s designation as a beneficiary “developing” country under the GSP[62] reflects a strategy to weaken India’s argument in favour of price caps.
III. Abhorrence for WTO Dispute Resolution Mechanisms
Before the World Trade Organization (WTO) was established, nations would often sort out issues via diplomacy, instead of international law.[63] Stemming from American conservatism’s abhorrence for multilateral authority, a return to that erstwhile approach would also entail the US employing its relative leverage of being the world’s largest economy. This includes tactics such as “punishing tariffs” and persuading foreign countries to “voluntarily” curb such exports to the US that threaten “highly valued US industries with competition.”[64] Further, the USTR has sought to weaken the WTO’s dispute resolution mechanisms, with Lighthizer being accused of “blocking the appointment of appellate judges,” weakening the “body’s ability to resolve international trade clashes.”[65]
American officials have also long construed India to be a “sovereignty hawk” at the global high table, especially when it “comes to defending what it sees as rights imperilled by ‘the West’.”[66] Negotiators also point to India’s slow compliance on WTO rulings. In 2012, the US sought the WTO’s support regarding India’s 2007 country-wide ban on importing American poultry over avian influenza concerns. The organisation ruled in favour of the US in 2015, but India began allowing American poultry in small amounts only in mid-2018.[67] Thus, in the case of India, America’s recognition of WTO rulings are only useful, so long as they facilitate compliance in favour of their “sovereignty.”
On some longstanding differences in the India–US trade, New Delhi could have the upper hand at the WTO, due to scientific evidence and precedents with other trading partners. For instance, an irritant in the India–US trade negotiations is the entry of US-made dairy products in the Indian market. New Delhi has cited “cultural and religious sentiments” to take a “non-negotiable” stand against Washington’s demand for market access for US-made dairy products.[68] India insists that American manufacturers must first certify that “the source animals have never been fed” blood-meal, “a protein-rich dietary supplement for cattle that utilises blood from slaughtered animals.”[69] India’s stance against blood-meal is backed by scientific evidence that links the use of such supplements to the outbreak of Bovine Spongiform Encephalopathy (Mad Cow Disease). Reportedly, the World Organisation for Animal Health, as well as countries such as Australia have imposed “a total ban on feeding any form of ruminant feed containing animal tissue or blood-meal” to ruminant mammals.[70] India’s insistence holds further credence in light of the European Union (EU) agreeing to ensure the certification of its dairy exports into India.[71] Finally, India’s demand for due consideration of “cultural and religious sentiments” stands well in-line with Article 20 (a) of the General Agreement on Tariffs and Trade, under which members can “adopt or enforce measures that are necessary to protect public morals.”[72] Consequently, this contention has been kept out of ongoing trade talks.[73]
These USTR apprehensions, rooted in conservative thought, have exacerbated the divergence between the US and India, vis-à-vis trade talks.
Recommendations for Navigating Divergences
In the run-up to the “Howdy, Modi!” rally in Houston in September 2019, speculations were abound regarding a partial trade deal between India and the US, also known as the “early harvest” deal. While some reports have indicated that the deal fell through after the US refused to reinstate GSP benefits to India,[74] others suggest that it has merely been delayed. A deal could include further cutting Indian duties on Harley-Davidson motorbikes and easier access to the US for some Indian farm products such as mangoes.[75] However, regardless of the scale of the impending deal, some of the most contentious issues, e.g. data localisation, are expected to persist.
Going forward, India must recognise that its trade tensions with the US stem from factors that go beyond issues of trade imbalances. It must avoid overstating the role of increased Indian import of US defence platforms, civilian aircraft and energy supplies. While such purchases—often amounting to billions of dollars—help in underscoring year-on-year progress, they are small determinants in the broader India–US bilateral trade trajectory.
Consider, for instance, the India–US defence trade. From nearly zero in 2008, it has increased to over US$15 billion in 2018[76]—a significant development. However, its impact on the broader India–US trade trajectory is minimal, in light of the increase in the India–US bilateral trade (goods and services)—from approximately US$66 billion in 2008 to over US$140 billion in 2018.[77]
Defence trade can certainly be a major driver of India–US trade ties, but only once the bilateral dynamic shifts from a traditional “buyer–seller” dynamic to one of “co-production and co-development.” This would aid the US’ intent to pursue global production relocation (e.g. their offer to relocate F-16 production lines to India) and India’s intent to oversee crucial technology transfers and increase domestic production under the “Make in India” initiative. Towards this complete actualisation of defence trade, the US and India recently signed the Industrial Security Annex, a crucial precursor to pursuing collaborative projects under the US–India Defence Technology and Trade Initiative (DTTI).
The negotiations between India and the US have been locked in a stalemate for over a year now. Some recommendations for resolving this impasse and de-escalating trade tensions are discussed in the following paragraphs:
I. Stress on the Strategic Merits of India’s GSP Status
As the US–China trade war continues, India must argue for the reinstatement of GSP benefits, especially from the standpoint of its strategic relevance for the Trump administration’s approach to China. Stakes are expected to rise regardless of the US–China Phase 1 deal,[78] putting to test whether Washington or Beijing can hold out longer. While China’s trade surplus may further hurt its position, for the US, costs “may trickle down to local manufacturers that source cheaply from, and export finished products to China, levying the brunt of tariffs on Americans from both ends.”[79]
Here, India’s GSP status can help wean American manufacturers off Chinese goods. According to a report by the Coalition for GSP (a group of American companies and trade associations), with US imports of certain products from China having decreased in the aftermath of the Section 301 tariffs, imports of some of those products from GSP-designated countries “have increased the most in the first quarter of 2019.”[80] The report observes that from India, “97 percent of increased 2019 GSP imports are on the China Section 301 lists.” Thus, from amongst the Section 301 tariff list products, imports from India “increased by USD 193 million (18 percent).”[81]
II. Set a Precedent of Delinking Issues
The tendency of both India and the US to link trade tensions to other avenues of cooperation has further fuelled tensions. In 2019, the US reportedly considered capping the issuance of H1B visas to about 15 percent for any country that “does data localisation.”[82] The news was not well-received by India’s US$150 billion IT sector, as 70 percent of the 85,000 H1B visas issued every year go to applicants from India.[83] Moreover, the prospect of any caps on H1B visas calls into question India’s longstanding demand for a “totalisation agreement” to coordinate social security for “workers who split their careers between the two countries.”[84]
Similarly, the implementation of the Homeland Security Presidential Directive (HSPD-6)—an agreement on exchanging terrorist screening information between the US Terrorist Screening Centre and India’s Intelligence Bureau—was momentarily “taken off from the agenda.”[85] Reportedly, this was done due to Indian agencies suggesting that, “in return of signing of the agreement, India must secure from the US side progress to the internet related data held by US-based services.”[86]
Such actions hamper avenues of cooperation and possibly diminish prospects of future resolution of trade divergences. Therefore, both countries must work towards delinking issues.
III. Focus on Middle-of-the-Road Solutions
Long-term resolution to divergences can be best achieved through compromise. The US must consider middle-of-the-road solutions. Consider the disagreement over the Indian duty of 20 percent on Information Communication Technology (ICT) products. The US has pressed for the reduction/elimination of tariff on seven ICT lines, which include telecommunications network equipment, radio receivers, high-end mobile phones, mobile phone parts, certain print circuit assemblies and smartwatches.[87]
Of these, a compromise could materialise for high-end mobile phones. While the US considers as “high-end” those phones that cost upwards of INR 10,000, India insists on a higher rate of designation. India’s apprehension is that conceding to the US demand for across-the-board duty reduction on imported high-end phones will benefit cheaper Chinese phones penetrating the Indian market.[88] Given the high cost of American products such as the Apple iPhone, the US’ share in the intended tariff reduction is a mere US$0.41 billion (two percent) of India’s imports of those products.[89] In the face of absolutist approaches, targeted middle-of-the-road solutions to cater to American imports can help in the long-term resolution of trade divergences.
Conclusion
India’s ties with the US in the strategic realm, particularly defence trade and force interoperability, are now at an all-time high, but trade tensions persist. So far, they have not drastically hindered the India–US strategic cooperation, which is in keeping with the Carter mantra of the Obama administration. However, there has been a significant departure from that dictum when it comes to trade differences playing out in the open: from Trump’s remarks about India being “tariff king” to the USTR considering a Section 301 review of India. The latter holds ominous prospects for the US–India bilateral dynamic, as evident from the continually escalating US–China trade war triggered by a similar Section 301 probe. At a juncture when India’s strategic ties with the US are improving, a renewed trade conflict will be a major setback, especially in their efforts to ensure a free and open Indo-Pacific.
To some extent, this paradox—of increasing defence cooperation but worsening trade relations—is a natural consequence of the lack of standardisation in the India–US relationship, which is a crucial aspect of formal alliance partnerships. In searching for a template appropriate for the unique characteristics of the India–US dynamic, the centrality of a vibrant trade relationship as a precursor to a sustained strategic partnership must be recognised. Both nations must actively work towards de-escalating trade tensions. In the short term, this can be achieved by stressing on the strategic relevance of India’s GSP status in the US–China trade conflict, setting a precedent of delinking trade issues from the convergence areas and focusing on middle-of-the-road solutions.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Headline - TRON Voice News</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background-color: #f8fafc;
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.8;
color: #1f2937;
}
/* Custom scrollbar for transcripts */
.custom-scrollbar::-webkit-scrollbar {
width: 5px;
}
.custom-scrollbar::-webkit-scrollbar-track {
background: #020617;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
background: #1e293b;
border-radius: 4px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
background: #334155;
}
</style>
</head>
<body class="min-h-screen text-slate-800 flex flex-col justify-between">
<!-- Configuration Injectors -->
<script>
// Global variables for backend connectivity and assistant configuration
const BACKEND_URL = "ws://127.0.0.1:38889/ws/live";
const TRON_CONFIG = {"document_context": "--- Article Headline: Test Headline ---\n--- Author: Test Author ---\n--- Date: Test Date ---\n--- Article Content ---\nTest Body content here.\n", "greeting": "Hello", "silence_duration_ms": 1000, "system_instruction": "Test Persona", "voice": "Fenrir"};
</script>
<!-- Header bar -->
<header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm">
<div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center">
<span class="text-lg font-bold text-white toi-header">T</span>
</div>
<div>
<h1 class="text-sm font-bold text-neutral-900">TRON</h1>
<p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p>
</div>
</div>
<a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1">
<span>← Back to Dashboard</span>
</a>
</div>
</header>
<!-- Article layout -->
<main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12">
<article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8">
<!-- TOI Masthead Replica -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span>Test Date</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Headline -->
<div class="space-y-4">
<h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">Test Headline</h1>
<!-- Metadata line -->
<div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between">
<span>By <strong class="text-neutral-900">Test Author</strong></span>
<span>Test Date</span>
</div>
</div>
<!-- Columns layout -->
<div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8">
<p class="mb-4 indent-4">Test Body content here.</p>
</div>
<!-- CTA Talk to Tron Button -->
<div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4">
<div class="text-xs text-neutral-500 font-serif italic">
* This investigative report includes a voice-activated assistant grounded in local research.
</div>
<button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95">
<svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</article>
</main>
<!-- Side Drawer Popup overlay -->
<div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden">
<!-- Drawer Header -->
<div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md">
<div class="flex items-center space-x-3">
<span class="relative flex h-3 w-3">
<span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span>
<span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span>
</span>
<div>
<h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3>
<p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p>
</div>
</div>
<button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
</div>
<!-- Drawer Content -->
<div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar">
<!-- Visualizer Container -->
<div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden">
<canvas id="visualizer-canvas" class="w-full h-44"></canvas>
<div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div>
</div>
<!-- Notes Section (Dynamic) -->
<div id="note-container" class="hidden animate-bounce mt-2">
<a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span id="note-btn-label">Download Requested Note</span>
</a>
</div>
<!-- Text Input Option -->
<div class="space-y-2 mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label>
<div class="flex gap-2">
<input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" />
<button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg>
</button>
</div>
</div>
<!-- Transcripts area -->
<div class="space-y-2 flex-1 flex flex-col justify-end mt-4">
<label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label>
<div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start">
<div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div>
</div>
</div>
<!-- Dispute email notification banner -->
<div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2">
<svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg>
<div>
<span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk.
</div>
</div>
</div>
<!-- Drawer Footer Controls -->
<div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4">
<!-- Mute/Unmute microphone button -->
<button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95">
<svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg>
<span id="mic-label">Listening</span>
</button>
<!-- Disconnect session -->
<button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95">
Stop
</button>
</div>
</div>
<!-- Backdrop overlay -->
<div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer -->
<footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Interactive script for voice capture & WebSocket streaming -->
<script>
const btnTalkToTron = document.getElementById('btn-talk-to-tron');
const sideDrawer = document.getElementById('side-drawer');
const btnCloseDrawer = document.getElementById('btn-close-drawer');
const btnDisconnect = document.getElementById('btn-disconnect');
const drawerBackdrop = document.getElementById('drawer-backdrop');
const connectionStatus = document.getElementById('connection-status');
const statusPulse = document.getElementById('status-pulse');
const statusDot = document.getElementById('status-dot');
const transcriptBox = document.getElementById('transcript-box');
const btnToggleMic = document.getElementById('btn-toggle-mic');
const micIconOn = document.getElementById('mic-icon-on');
const micIconOff = document.getElementById('mic-icon-off');
const micLabel = document.getElementById('mic-label');
const noteContainer = document.getElementById('note-container');
const btnDownloadNote = document.getElementById('btn-download-note');
const noteBtnLabel = document.getElementById('note-btn-label');
const disputeBanner = document.getElementById('dispute-banner');
const inputChat = document.getElementById('input-chat');
const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas');
const ctx = canvas.getContext('2d');
let socket = null;
let isListening = false;
let mediaStream = null;
let audioContext = null;
let scriptProcessor = null;
let animationFrameId = null;
let nextPlayTime = 0;
let activeSources = [];
let averageVolume = 0; // shared variable for orb visualizer
let isModelSpeaking = true;
let analyser = null;
let playbackAnalyser = null;
let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer
function resampleAndConvertToInt16(buffer, inputSampleRate) {
const targetSampleRate = 16000;
let resultBuffer = buffer;
if (inputSampleRate !== targetSampleRate) {
const ratio = inputSampleRate / targetSampleRate;
const newLength = Math.round(buffer.length / ratio);
const resampled = new Float32Array(newLength);
for (let i = 0; i < newLength; i++) {
const index = Math.round(i * ratio);
resampled[i] = index < buffer.length ? buffer[index] : 0;
}
resultBuffer = resampled;
}
let l = resultBuffer.length;
let buf = new Int16Array(l);
while (l--) {
// Apply a 4.0x software gain multiplier to boost quiet microphone inputs
let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0));
buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF);
}
return buf.buffer;
}
// Open drawer UI
btnTalkToTron.addEventListener('click', () => {
sideDrawer.classList.remove('hidden');
drawerBackdrop.classList.remove('hidden');
setTimeout(() => {
sideDrawer.classList.remove('translate-x-full');
}, 10);
initSession();
visualizeOrb();
});
// Close drawer UI
function closeDrawer() {
sideDrawer.classList.add('translate-x-full');
drawerBackdrop.classList.add('hidden');
setTimeout(() => {
sideDrawer.classList.add('hidden');
}, 300);
disconnectSession();
if (animationFrameId) {
cancelAnimationFrame(animationFrameId);
animationFrameId = null;
}
ctx.clearRect(0, 0, canvas.width, canvas.height);
}
btnCloseDrawer.addEventListener('click', closeDrawer);
btnDisconnect.addEventListener('click', closeDrawer);
drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle
btnToggleMic.addEventListener('click', () => {
isListening = !isListening;
if (isListening) {
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Listening...", "cyan");
} else {
micIconOn.classList.add('hidden');
micIconOff.classList.remove('hidden');
micLabel.textContent = "Muted";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
setStatus("Muted", "red");
}
});
// Send text query message
async function sendChatMessage() {
const text = inputChat.value.trim();
if (!text) return;
if (socket && socket.readyState === WebSocket.OPEN) {
// Immediately commit text to transcripts visually
updateLiveCaption('user', text, true);
// Send text packet via WebSocket
socket.send(JSON.stringify({
type: 'input_text',
text: text
}));
inputChat.value = '';
} else {
appendLog("Cannot send message: Not connected to TRON server.", true);
}
}
btnSendChat.addEventListener('click', sendChatMessage);
inputChat.addEventListener('keydown', (e) => {
if (e.key === 'Enter') {
sendChatMessage();
}
});
function setStatus(text, color) {
connectionStatus.textContent = text;
if (color === 'cyan') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500";
} else if (color === 'indigo') {
statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500";
} else if (color === 'red') {
statusPulse.className = "hidden";
statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500";
}
}
function appendLog(text, isModel = false) {
// Remove empty placeholder
if (transcriptBox.innerHTML.includes('No dialogue yet')) {
transcriptBox.innerHTML = '';
}
const wrapper = document.createElement('div');
wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400";
wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`;
transcriptBox.appendChild(wrapper);
transcriptBox.scrollTop = transcriptBox.scrollHeight;
}
function updateLiveCaption(role, text, isFinal) {
if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) {
transcriptBox.innerHTML = '';
}
if (!liveCaptionEl) {
liveCaptionEl = document.createElement('div');
liveCaptionEl.id = 'live-caption';
transcriptBox.appendChild(liveCaptionEl);
}
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400';
const roleName = role === 'user' ? 'You' : 'Tron';
liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`;
liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`;
transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) {
liveCaptionEl.id = '';
liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50';
liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`;
liveCaptionEl = null;
}
}
// Initialize Session
async function initSession() {
setStatus("Connecting...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>';
noteContainer.classList.add('hidden');
disputeBanner.classList.add('hidden');
isListening = true;
isModelSpeaking = true;
micIconOn.classList.remove('hidden');
micIconOff.classList.add('hidden');
micLabel.textContent = "Listening";
btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension
try {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
if (!audioCtxPlayback) {
audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 });
nextPlayTime = audioCtxPlayback.currentTime;
}
if (audioCtxPlayback.state === 'suspended') {
await audioCtxPlayback.resume();
}
} catch (ae) {
console.warn("Could not pre-initialize AudioContexts:", ae);
}
try {
// Setup WebSocket connection
socket = new WebSocket(BACKEND_URL);
socket.binaryType = 'arraybuffer';
socket.onopen = () => {
setStatus("Sending config...", "indigo");
// Send Setup configurations immediately
socket.send(JSON.stringify({
type: 'setup',
voice: TRON_CONFIG.voice,
system_instruction: TRON_CONFIG.system_instruction,
greeting: TRON_CONFIG.greeting,
document_context: TRON_CONFIG.document_context,
silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000
}));
};
socket.onmessage = async (event) => {
if (event.data instanceof ArrayBuffer) {
// Incoming 24kHz audio bytes from model
const int16Array = new Int16Array(event.data);
const float32Array = new Float32Array(int16Array.length);
for (let i = 0; i < int16Array.length; i++) {
float32Array[i] = int16Array[i] / 32768.0;
}
playAudioChunk(float32Array);
setStatus("Speaking...", "indigo");
} else {
// JSON text control messages
try {
const msg = JSON.parse(event.data);
if (msg.type === 'transcript') {
appendLog(msg.text, true);
} else if (msg.type === 'interim_input_transcription') {
updateLiveCaption('user', msg.text, false);
} else if (msg.type === 'input_transcription') {
updateLiveCaption('user', msg.text, true);
} else if (msg.type === 'output_transcription') {
updateLiveCaption('model', msg.text, msg.finished);
} else if (msg.type === 'interrupted') {
stopAllAudio();
appendLog("<em class='text-red-400'>[Interrupted]</em>", true);
setStatus("Listening...", "cyan");
} else if (msg.type === 'document_ready') {
noteBtnLabel.textContent = `Download: ${msg.subject}`;
btnDownloadNote.href = msg.download_url;
noteContainer.classList.remove('hidden');
appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true);
} else if (msg.type === 'dispute_triggered') {
disputeBanner.classList.remove('hidden');
appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true);
} else if (msg.type === 'model_speaking') {
if (msg.speaking) {
isModelSpeaking = true;
setStatus("Speaking...", "indigo");
} else {
// Add a 500ms delay before unmuting microphone to avoid capturing self-echo
setTimeout(() => {
isModelSpeaking = false;
if (isListening) {
setStatus("Listening...", "cyan");
}
}, 500);
}
} else if (msg.type === 'ready') {
setStatus("Listening...", "cyan");
transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>';
startMicrophone();
}
} catch (err) {
console.error("Failed to parse JSON text WebSocket message:", err);
}
}
};
socket.onclose = () => {
setStatus("Offline", "red");
appendLog("Connection to server closed.");
stopMicrophone();
stopAllAudio();
};
socket.onerror = (err) => {
console.error("WebSocket Error:", err);
setStatus("Error", "red");
appendLog("A WebSocket connection error occurred.");
};
} catch (err) {
console.error("Microphone or WebSocket initialization failed:", err);
setStatus("Error", "red");
appendLog("Error: " + err.message);
}
}
// Disconnect Session
function disconnectSession() {
if (socket) {
socket.close();
socket = null;
}
stopMicrophone();
stopAllAudio();
if (audioContext) {
audioContext.close().catch(()=>{});
audioContext = null;
}
playbackAnalyser = null;
liveCaptionEl = null;
}
// Audio Capturing
async function startMicrophone() {
try {
mediaStream = await navigator.mediaDevices.getUserMedia({
audio: {
echoCancellation: true,
noiseSuppression: true,
autoGainControl: true
}
});
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
}
if (audioContext.state === 'suspended') {
await audioContext.resume();
}
const source = audioContext.createMediaStreamSource(mediaStream);
// Analyser node for local orb visualization
analyser = audioContext.createAnalyser();
analyser.fftSize = 256;
source.connect(analyser);
scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1);
source.connect(scriptProcessor);
scriptProcessor.connect(audioContext.destination);
scriptProcessor.onaudioprocess = (e) => {
if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) {
const inputData = e.inputBuffer.getChannelData(0);
const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate);
socket.send(pcmBuffer);
}
};
} catch (err) {
console.error("Failed to capture mic:", err);
appendLog("Microphone Access Blocked or Not Found.");
}
}
function stopMicrophone() {
if (scriptProcessor) {
scriptProcessor.disconnect();
scriptProcessor = null;
}
if (mediaStream) {
mediaStream.getTracks().forEach(track => track.stop());
mediaStream = null;
}
analyser = null;
};
// Playback incoming audio chunks
function playAudioChunk(float32Array) {
if (!audioContext) {
audioContext = new (window.AudioContext || window.webkitAudioContext)();
nextPlayTime = audioContext.currentTime;
}
if (audioContext.state === 'suspended') {
audioContext.resume();
}
if (!playbackAnalyser) {
playbackAnalyser = audioContext.createAnalyser();
playbackAnalyser.fftSize = 256;
playbackAnalyser.connect(audioContext.destination);
}
const buffer = audioContext.createBuffer(1, float32Array.length, 24000);
buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource();
source.buffer = buffer;
source.connect(playbackAnalyser);
activeSources.push(source);
source.onended = () => {
activeSources = activeSources.filter(s => s !== source);
if (activeSources.length === 0 && isListening) {
setStatus("Listening...", "cyan");
}
};
const currentTime = audioContext.currentTime;
if (nextPlayTime < currentTime) {
nextPlayTime = currentTime;
}
source.start(nextPlayTime);
nextPlayTime += buffer.duration;
}
function stopAllAudio() {
activeSources.forEach(source => {
try {
source.stop();
} catch (e) {}
});
activeSources = [];
if (audioContext) {
nextPlayTime = audioContext.currentTime;
}
}
// Pulse Orb Visualizer logic
function visualizeOrb() {
const bufferLength = 128;
const dataArray = new Uint8Array(bufferLength);
function draw() {
animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null;
if (activeSources.length > 0 && playbackAnalyser) {
activeAnalyser = playbackAnalyser;
} else if (isListening && !isModelSpeaking && analyser) {
activeAnalyser = analyser;
}
if (activeAnalyser) {
activeAnalyser.getByteFrequencyData(dataArray);
let sum = 0;
for (let i = 0; i < bufferLength; i++) {
sum += dataArray[i];
}
const average = sum / bufferLength; // 0 to 255
averageVolume = averageVolume * 0.8 + average * 0.2;
} else {
averageVolume = averageVolume * 0.95;
}
const width = canvas.width = canvas.clientWidth;
const height = canvas.height = canvas.clientHeight;
const centerX = width / 2;
const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor
let pulse = averageVolume * 0.55;
if (pulse < 0.5) {
// Gentle breathing effect when quiet
pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5;
}
const baseRadius = 40 + pulse;
// Outer neon aura glow
const gradient = ctx.createRadialGradient(
centerX, centerY, baseRadius * 0.2,
centerX, centerY, baseRadius * 1.5
);
if (isListening && activeSources.length === 0) {
// CYAN listening state
gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)');
gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)');
gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else if (activeSources.length > 0) {
// INDIGO speaking state
gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)');
gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)');
gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
} else {
// RED muted state
gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)');
gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)');
gradient.addColorStop(1, 'rgba(0,0,0,0)');
}
ctx.fillStyle = gradient;
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI);
ctx.fill();
// Inner core orb
ctx.shadowBlur = 25;
if (isListening && activeSources.length === 0) {
ctx.shadowColor = '#22d3ee'; // cyan-400
ctx.fillStyle = '#ffffff';
} else if (activeSources.length > 0) {
ctx.shadowColor = '#a855f7'; // purple-500
ctx.fillStyle = '#f8fafc';
} else {
ctx.shadowColor = '#ef4444'; // red-500
ctx.fillStyle = '#fca5a5';
}
ctx.beginPath();
ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI);
ctx.fill();
ctx.shadowBlur = 0; // reset
}
draw();
}
</script>
</body>
</html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>{{ headline }} - TRON Voice News</title> <script src="https://cdn.tailwindcss.com"></script> <link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet"> <style> body { font-family: 'Inter', sans-serif; background-color: #f8fafc; } .toi-header { font-family: 'Playfair Display', serif; letter-spacing: 0.05em; } .toi-body { font-family: Georgia, serif; line-height: 1.8; color: #1f2937; } /* Custom scrollbar for transcripts */ .custom-scrollbar::-webkit-scrollbar { width: 5px; } .custom-scrollbar::-webkit-scrollbar-track { background: #020617; } .custom-scrollbar::-webkit-scrollbar-thumb { background: #1e293b; border-radius: 4px; } .custom-scrollbar::-webkit-scrollbar-thumb:hover { background: #334155; } </style></head><body class="min-h-screen text-slate-800 flex flex-col justify-between"> <!-- Configuration Injectors --> <script> // Global variables for backend connectivity and assistant configuration const BACKEND_URL = "{{ backend_url }}"; const TRON_CONFIG = {{ tron_config | tojson }}; </script>
<!-- Header bar --> <header class="border-b border-slate-200 bg-white sticky top-0 z-30 shadow-sm"> <div class="max-w-4xl mx-auto px-6 py-4 flex items-center justify-between"> <div class="flex items-center space-x-3"> <div class="w-8 h-8 rounded-lg bg-neutral-900 flex items-center justify-center"> <span class="text-lg font-bold text-white toi-header">T</span> </div> <div> <h1 class="text-sm font-bold text-neutral-900">TRON</h1> <p class="text-[10px] text-neutral-500 font-semibold tracking-wider uppercase">Voice-Activated Article</p> </div> </div> <a href="/" class="text-xs font-semibold text-indigo-600 hover:text-indigo-800 transition-colors flex items-center space-x-1"> <span>← Back to Dashboard</span> </a> </div> </header>
<!-- Article layout --> <main class="flex-1 max-w-4xl w-full mx-auto px-6 py-12"> <article class="bg-white rounded-3xl p-8 md:p-12 border border-slate-200 shadow-xl space-y-8"> <!-- TOI Masthead Replica --> <div class="text-center border-b-4 border-double border-neutral-900 pb-4"> <div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1"> <span>Established 1838</span> <span>The Times of India</span> <span>Daily Edition</span> </div> <h1 class="text-4xl md:text-5xl font-serif font-black tracking-normal toi-header my-3 text-neutral-950">THE TIMES OF INDIA</h1> <div class="text-xs border-t border-neutral-900 pt-2 flex justify-between font-serif italic text-neutral-700"> <span>Reg. No. Delhi-0912</span> <span>{{ date }}</span> <span>Price: ₹ 5.00</span> </div> </div>
<!-- Headline --> <div class="space-y-4"> <h1 class="text-2xl md:text-3.5xl font-bold font-serif leading-tight text-neutral-950 tracking-tight">{{ headline }}</h1> <!-- Metadata line --> <div class="text-xs text-neutral-600 border-b border-neutral-200 pb-3 font-serif flex items-center justify-between"> <span>By <strong class="text-neutral-900">{{ author }}</strong></span> <span>{{ date }}</span> </div> </div>
<!-- Columns layout --> <div class="toi-body text-base md:text-md text-justify space-y-4 columns-1 md:columns-2 gap-8"> {% for para in body.split('\n') %} {% if para.strip() %} <p class="mb-4 indent-4">{{ para.strip() }}</p> {% endif %} {% endfor %} </div>
<!-- CTA Talk to Tron Button --> <div class="border-t border-neutral-200 pt-8 flex flex-col sm:flex-row items-center justify-between gap-4"> <div class="text-xs text-neutral-500 font-serif italic"> * This investigative report includes a voice-activated assistant grounded in local research. </div> <button id="btn-talk-to-tron" class="w-full sm:w-auto px-6 py-3.5 rounded-xl bg-gradient-to-r from-neutral-900 to-slate-800 hover:from-neutral-800 hover:to-slate-700 text-white font-semibold text-sm flex items-center justify-center space-x-3 transition-all shadow-lg shadow-neutral-900/10 active:scale-95"> <svg class="w-5 h-5 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg> <span>Talk to Tron</span> </button> </div> </article> </main>
<!-- Side Drawer Popup overlay --> <div id="side-drawer" class="fixed inset-y-0 right-0 w-full sm:w-[420px] bg-slate-950 border-l border-slate-800 z-50 transform translate-x-full transition-transform duration-300 ease-out shadow-2xl flex flex-col justify-between text-slate-100 hidden"> <!-- Drawer Header --> <div class="p-6 border-b border-slate-900 flex items-center justify-between bg-slate-950/80 backdrop-blur-md"> <div class="flex items-center space-x-3"> <span class="relative flex h-3 w-3"> <span id="status-pulse" class="animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"></span> <span id="status-dot" class="relative inline-flex rounded-full h-3 w-3 bg-cyan-500"></span> </span> <div> <h3 class="font-bold text-sm tracking-wide">TRON ASSISTANT</h3> <p id="connection-status" class="text-[10px] text-slate-400 font-semibold uppercase">Connecting...</p> </div> </div> <button id="btn-close-drawer" class="text-slate-500 hover:text-white transition-colors p-1.5 rounded-lg hover:bg-slate-900"> <svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg> </button> </div>
<!-- Drawer Content --> <div class="flex-1 overflow-y-auto p-6 space-y-6 flex flex-col justify-between custom-scrollbar"> <!-- Visualizer Container --> <div class="flex flex-col items-center justify-center py-6 bg-slate-900/30 border border-slate-900 rounded-2xl relative overflow-hidden"> <canvas id="visualizer-canvas" class="w-full h-44"></canvas> <div id="orb-label" class="absolute bottom-4 text-[10px] text-slate-500 font-bold tracking-widest uppercase">Voice Orb Activator</div> </div>
<!-- Notes Section (Dynamic) --> <div id="note-container" class="hidden animate-bounce mt-2"> <a id="btn-download-note" href="#" target="_blank" class="w-full py-3.5 px-4 rounded-xl bg-gradient-to-r from-emerald-500 to-teal-600 hover:from-emerald-600 hover:to-teal-700 text-white font-bold text-xs uppercase tracking-wider flex items-center justify-center space-x-2 transition-all shadow-lg shadow-emerald-500/20 active:scale-95"> <svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 10v6m0 0l-3-3m3 3l3-3m2 8H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg> <span id="note-btn-label">Download Requested Note</span> </a> </div>
<!-- Text Input Option --> <div class="space-y-2 mt-4"> <label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Type Your Question</label> <div class="flex gap-2"> <input id="input-chat" type="text" placeholder="Type a question or correction..." class="flex-1 bg-slate-900 border border-slate-800 rounded-xl px-4 py-2.5 text-xs text-slate-100 placeholder-slate-500 focus:outline-none focus:border-cyan-500 transition-colors" /> <button id="btn-send-chat" class="px-4 py-2.5 rounded-xl bg-cyan-600 hover:bg-cyan-700 text-white font-bold text-xs transition-all active:scale-95 flex items-center justify-center"> <svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 19l9 2-9-18-9 18 9-2zm0 0v-8"/></svg> </button> </div> </div>
<!-- Transcripts area --> <div class="space-y-2 flex-1 flex flex-col justify-end mt-4"> <label class="text-[10px] text-slate-500 font-bold uppercase tracking-wider">Live Logs / Transcripts</label> <div id="transcript-box" class="h-48 overflow-y-auto bg-slate-950 border border-slate-900 rounded-xl p-4 text-xs font-mono text-slate-300 space-y-3 custom-scrollbar flex flex-col justify-start"> <div class="text-slate-600 italic">No dialogue yet. Click Activate to talk.</div> </div> </div>
<!-- Dispute email notification banner --> <div id="dispute-banner" class="hidden bg-red-950/40 border border-red-900/60 rounded-xl p-3 text-[11px] text-red-300 flex items-start space-x-2"> <svg class="w-4 h-4 text-red-400 flex-shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/></svg> <div> <span class="font-bold">Editorial Dispute Sent:</span> Alerts containing reader suggested corrections have been dispatched to the editorial desk. </div> </div> </div>
<!-- Drawer Footer Controls --> <div class="p-6 border-t border-slate-900 bg-slate-950/80 backdrop-blur-md flex items-center justify-between gap-4"> <!-- Mute/Unmute microphone button --> <button id="btn-toggle-mic" class="flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95"> <svg id="mic-icon-on" class="w-4 h-4 text-cyan-400" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg> <svg id="mic-icon-off" class="w-4 h-4 text-red-500 hidden" fill="currentColor" viewBox="0 0 24 24"><path d="M19 11h-1.7c0 .74-.16 1.43-.43 2.05l1.23 1.23c.56-.98.9-2.09.9-3.28zm-4.02.17l-1.98-1.98V5c0-1.66-1.34-3-3-3S7 3.34 7 5v.18L8.82 7h-.02v4c0 .32.07.62.17.9l-1.98-1.98c.56-.98.9-2.09.9-3.28zm-5.98 5.75c1.39.81 3.03 1.08 4.67.75l1.45 1.45c-2.31.75-4.83.43-6.92-.9L7 16.92zm11.97 3.05L5.12 5.12 3.88 6.38l4.47 4.47v.15c0 2.76 2.24 5 5 5 .59 0 1.15-.12 1.67-.31l3.52 3.52 1.24-1.24zM12 18c-3.31 0-6-2.69-6-6h2c0 2.21 1.79 4 4 4 .43 0 .83-.09 1.21-.24l1.52 1.52C13.88 17.76 13 18 12 18z"/></svg> <span id="mic-label">Listening</span> </button>
<!-- Disconnect session --> <button id="btn-disconnect" class="py-3 px-5 rounded-xl bg-red-950/40 hover:bg-red-900 border border-red-900 text-red-300 hover:text-white font-semibold text-xs transition-all active:scale-95"> Stop </button> </div> </div>
<!-- Backdrop overlay --> <div id="drawer-backdrop" class="fixed inset-0 bg-slate-950/50 backdrop-blur-sm z-40 hidden"></div>
<!-- Footer --> <footer class="border-t border-slate-200 py-6 text-center text-xs text-neutral-500 bg-white"> <p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p> </footer>
<!-- Interactive script for voice capture & WebSocket streaming --> <script> const btnTalkToTron = document.getElementById('btn-talk-to-tron'); const sideDrawer = document.getElementById('side-drawer'); const btnCloseDrawer = document.getElementById('btn-close-drawer'); const btnDisconnect = document.getElementById('btn-disconnect'); const drawerBackdrop = document.getElementById('drawer-backdrop'); const connectionStatus = document.getElementById('connection-status'); const statusPulse = document.getElementById('status-pulse'); const statusDot = document.getElementById('status-dot'); const transcriptBox = document.getElementById('transcript-box'); const btnToggleMic = document.getElementById('btn-toggle-mic'); const micIconOn = document.getElementById('mic-icon-on'); const micIconOff = document.getElementById('mic-icon-off'); const micLabel = document.getElementById('mic-label'); const noteContainer = document.getElementById('note-container'); const btnDownloadNote = document.getElementById('btn-download-note'); const noteBtnLabel = document.getElementById('note-btn-label'); const disputeBanner = document.getElementById('dispute-banner'); const inputChat = document.getElementById('input-chat'); const btnSendChat = document.getElementById('btn-send-chat');
const canvas = document.getElementById('visualizer-canvas'); const ctx = canvas.getContext('2d');
let socket = null; let isListening = false; let mediaStream = null; let audioContext = null; let scriptProcessor = null; let animationFrameId = null; let nextPlayTime = 0; let activeSources = []; let averageVolume = 0; // shared variable for orb visualizer let isModelSpeaking = true; let analyser = null; let playbackAnalyser = null; let liveCaptionEl = null;
// Resample Float32 array to 16000Hz and convert to Int16 PCM ArrayBuffer function resampleAndConvertToInt16(buffer, inputSampleRate) { const targetSampleRate = 16000; let resultBuffer = buffer; if (inputSampleRate !== targetSampleRate) { const ratio = inputSampleRate / targetSampleRate; const newLength = Math.round(buffer.length / ratio); const resampled = new Float32Array(newLength); for (let i = 0; i < newLength; i++) { const index = Math.round(i * ratio); resampled[i] = index < buffer.length ? buffer[index] : 0; } resultBuffer = resampled; } let l = resultBuffer.length; let buf = new Int16Array(l); while (l--) { // Apply a 4.0x software gain multiplier to boost quiet microphone inputs let s = Math.max(-1, Math.min(1, resultBuffer[l] * 4.0)); buf[l] = Math.round(s < 0 ? s * 0x8000 : s * 0x7FFF); } return buf.buffer; }
// Open drawer UI btnTalkToTron.addEventListener('click', () => { sideDrawer.classList.remove('hidden'); drawerBackdrop.classList.remove('hidden'); setTimeout(() => { sideDrawer.classList.remove('translate-x-full'); }, 10); initSession(); visualizeOrb(); });
// Close drawer UI function closeDrawer() { sideDrawer.classList.add('translate-x-full'); drawerBackdrop.classList.add('hidden'); setTimeout(() => { sideDrawer.classList.add('hidden'); }, 300); disconnectSession(); if (animationFrameId) { cancelAnimationFrame(animationFrameId); animationFrameId = null; } ctx.clearRect(0, 0, canvas.width, canvas.height); }
btnCloseDrawer.addEventListener('click', closeDrawer); btnDisconnect.addEventListener('click', closeDrawer); drawerBackdrop.addEventListener('click', closeDrawer);
// Mute/Unmute mic toggle btnToggleMic.addEventListener('click', () => { isListening = !isListening; if (isListening) { micIconOn.classList.remove('hidden'); micIconOff.classList.add('hidden'); micLabel.textContent = "Listening"; btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95"; setStatus("Listening...", "cyan"); } else { micIconOn.classList.add('hidden'); micIconOff.classList.remove('hidden'); micLabel.textContent = "Muted"; btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-red-950/40 border border-red-950 text-red-400 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95"; setStatus("Muted", "red"); } });
// Send text query message async function sendChatMessage() { const text = inputChat.value.trim(); if (!text) return; if (socket && socket.readyState === WebSocket.OPEN) { // Immediately commit text to transcripts visually updateLiveCaption('user', text, true); // Send text packet via WebSocket socket.send(JSON.stringify({ type: 'input_text', text: text })); inputChat.value = ''; } else { appendLog("Cannot send message: Not connected to TRON server.", true); } }
btnSendChat.addEventListener('click', sendChatMessage); inputChat.addEventListener('keydown', (e) => { if (e.key === 'Enter') { sendChatMessage(); } });
function setStatus(text, color) { connectionStatus.textContent = text; if (color === 'cyan') { statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-cyan-400 opacity-75"; statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-cyan-500"; } else if (color === 'indigo') { statusPulse.className = "animate-ping absolute inline-flex h-full w-full rounded-full bg-indigo-400 opacity-75"; statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-indigo-500"; } else if (color === 'red') { statusPulse.className = "hidden"; statusDot.className = "relative inline-flex rounded-full h-3 w-3 bg-red-500"; } }
function appendLog(text, isModel = false) { // Remove empty placeholder if (transcriptBox.innerHTML.includes('No dialogue yet')) { transcriptBox.innerHTML = ''; } const wrapper = document.createElement('div'); wrapper.className = isModel ? "text-cyan-400 font-semibold" : "text-slate-400"; wrapper.innerHTML = `<span class="text-slate-600">[${isModel ? 'TRON' : 'YOU'}]</span> ${text}`; transcriptBox.appendChild(wrapper); transcriptBox.scrollTop = transcriptBox.scrollHeight; }
function updateLiveCaption(role, text, isFinal) { if (transcriptBox.innerHTML.includes('No dialogue yet') || transcriptBox.innerHTML.includes('Tron is ready')) { transcriptBox.innerHTML = ''; }
if (!liveCaptionEl) { liveCaptionEl = document.createElement('div'); liveCaptionEl.id = 'live-caption'; transcriptBox.appendChild(liveCaptionEl); }
const roleColor = role === 'user' ? 'text-cyan-400' : 'text-indigo-400'; const roleName = role === 'user' ? 'You' : 'Tron'; liveCaptionEl.className = `${roleColor} font-medium border-l-2 border-current pl-2 py-0.5 my-1 animate-pulse`; liveCaptionEl.innerHTML = `<span class="opacity-60 text-[10px] uppercase font-bold tracking-wider mr-1.5">${roleName}:</span> ${text}`; transcriptBox.scrollTop = transcriptBox.scrollHeight;
if (isFinal) { liveCaptionEl.id = ''; liveCaptionEl.className = 'text-slate-300 py-1 border-b border-slate-900/50'; liveCaptionEl.innerHTML = `<span class="${role === 'user' ? 'text-cyan-500' : 'text-indigo-500'} font-semibold mr-1">${roleName}:</span> ${text}`; liveCaptionEl = null; } }
// Initialize Session async function initSession() { setStatus("Connecting...", "cyan"); transcriptBox.innerHTML = '<div class="text-slate-600 italic">Establishing connection to TRON server...</div>'; noteContainer.classList.add('hidden'); disputeBanner.classList.add('hidden'); isListening = true; isModelSpeaking = true; micIconOn.classList.remove('hidden'); micIconOff.classList.add('hidden'); micLabel.textContent = "Listening"; btnToggleMic.className = "flex-1 py-3 px-4 rounded-xl bg-slate-900 border border-slate-800 text-slate-300 hover:text-white font-semibold text-xs flex items-center justify-center space-x-2 transition-all active:scale-95";
// Initialize/Resume AudioContexts inside the direct user-gesture handler to prevent browser suspension try { if (!audioContext) { audioContext = new (window.AudioContext || window.webkitAudioContext)(); } if (audioContext.state === 'suspended') { await audioContext.resume(); } if (!audioCtxPlayback) { audioCtxPlayback = new (window.AudioContext || window.webkitAudioContext)({ sampleRate: 24000 }); nextPlayTime = audioCtxPlayback.currentTime; } if (audioCtxPlayback.state === 'suspended') { await audioCtxPlayback.resume(); } } catch (ae) { console.warn("Could not pre-initialize AudioContexts:", ae); }
try { // Setup WebSocket connection socket = new WebSocket(BACKEND_URL); socket.binaryType = 'arraybuffer';
socket.onopen = () => { setStatus("Sending config...", "indigo"); // Send Setup configurations immediately socket.send(JSON.stringify({ type: 'setup', voice: TRON_CONFIG.voice, system_instruction: TRON_CONFIG.system_instruction, greeting: TRON_CONFIG.greeting, document_context: TRON_CONFIG.document_context, silence_duration_ms: TRON_CONFIG.silence_duration_ms || 1000 })); };
socket.onmessage = async (event) => { if (event.data instanceof ArrayBuffer) { // Incoming 24kHz audio bytes from model const int16Array = new Int16Array(event.data); const float32Array = new Float32Array(int16Array.length); for (let i = 0; i < int16Array.length; i++) { float32Array[i] = int16Array[i] / 32768.0; } playAudioChunk(float32Array); setStatus("Speaking...", "indigo"); } else { // JSON text control messages try { const msg = JSON.parse(event.data); if (msg.type === 'transcript') { appendLog(msg.text, true); } else if (msg.type === 'interim_input_transcription') { updateLiveCaption('user', msg.text, false); } else if (msg.type === 'input_transcription') { updateLiveCaption('user', msg.text, true); } else if (msg.type === 'output_transcription') { updateLiveCaption('model', msg.text, msg.finished); } else if (msg.type === 'interrupted') { stopAllAudio(); appendLog("<em class='text-red-400'>[Interrupted]</em>", true); setStatus("Listening...", "cyan"); } else if (msg.type === 'document_ready') { noteBtnLabel.textContent = `Download: ${msg.subject}`; btnDownloadNote.href = msg.download_url; noteContainer.classList.remove('hidden'); appendLog(`<span class='text-emerald-400 font-bold'>✓ Word Document Generated!</span> Click download inside drawer.`, true); } else if (msg.type === 'dispute_triggered') { disputeBanner.classList.remove('hidden'); appendLog(`<span class='text-red-400 font-bold'>⚠️ dispute filed:</span> "${msg.suggested_correction}" (over "${msg.original_fact}"). Alert dispatched.`, true); } else if (msg.type === 'model_speaking') { if (msg.speaking) { isModelSpeaking = true; setStatus("Speaking...", "indigo"); } else { // Add a 500ms delay before unmuting microphone to avoid capturing self-echo setTimeout(() => { isModelSpeaking = false; if (isListening) { setStatus("Listening...", "cyan"); } }, 500); } } else if (msg.type === 'ready') { setStatus("Listening...", "cyan"); transcriptBox.innerHTML = '<div class="text-slate-500 italic">Tron is ready. Speak now.</div>'; startMicrophone(); } } catch (err) { console.error("Failed to parse JSON text WebSocket message:", err); } } };
socket.onclose = () => { setStatus("Offline", "red"); appendLog("Connection to server closed."); stopMicrophone(); stopAllAudio(); };
socket.onerror = (err) => { console.error("WebSocket Error:", err); setStatus("Error", "red"); appendLog("A WebSocket connection error occurred."); };
} catch (err) { console.error("Microphone or WebSocket initialization failed:", err); setStatus("Error", "red"); appendLog("Error: " + err.message); } }
// Disconnect Session function disconnectSession() { if (socket) { socket.close(); socket = null; } stopMicrophone(); stopAllAudio(); if (audioContext) { audioContext.close().catch(()=>{}); audioContext = null; } playbackAnalyser = null; liveCaptionEl = null; }
// Audio Capturing async function startMicrophone() { try { mediaStream = await navigator.mediaDevices.getUserMedia({ audio: { echoCancellation: true, noiseSuppression: true, autoGainControl: true } }); if (!audioContext) { audioContext = new (window.AudioContext || window.webkitAudioContext)(); } if (audioContext.state === 'suspended') { await audioContext.resume(); } const source = audioContext.createMediaStreamSource(mediaStream); // Analyser node for local orb visualization analyser = audioContext.createAnalyser(); analyser.fftSize = 256; source.connect(analyser); scriptProcessor = audioContext.createScriptProcessor(2048, 1, 1); source.connect(scriptProcessor); scriptProcessor.connect(audioContext.destination); scriptProcessor.onaudioprocess = (e) => { if (socket && socket.readyState === WebSocket.OPEN && isListening && !isModelSpeaking) { const inputData = e.inputBuffer.getChannelData(0); const pcmBuffer = resampleAndConvertToInt16(inputData, audioContext.sampleRate); socket.send(pcmBuffer); } }; } catch (err) { console.error("Failed to capture mic:", err); appendLog("Microphone Access Blocked or Not Found."); } } function stopMicrophone() { if (scriptProcessor) { scriptProcessor.disconnect(); scriptProcessor = null; } if (mediaStream) { mediaStream.getTracks().forEach(track => track.stop()); mediaStream = null; } analyser = null; };
// Playback incoming audio chunks function playAudioChunk(float32Array) { if (!audioContext) { audioContext = new (window.AudioContext || window.webkitAudioContext)(); nextPlayTime = audioContext.currentTime; }
if (audioContext.state === 'suspended') { audioContext.resume(); }
if (!playbackAnalyser) { playbackAnalyser = audioContext.createAnalyser(); playbackAnalyser.fftSize = 256; playbackAnalyser.connect(audioContext.destination); }
const buffer = audioContext.createBuffer(1, float32Array.length, 24000); buffer.copyToChannel(float32Array, 0);
const source = audioContext.createBufferSource(); source.buffer = buffer; source.connect(playbackAnalyser);
activeSources.push(source); source.onended = () => { activeSources = activeSources.filter(s => s !== source); if (activeSources.length === 0 && isListening) { setStatus("Listening...", "cyan"); } };
const currentTime = audioContext.currentTime; if (nextPlayTime < currentTime) { nextPlayTime = currentTime; } source.start(nextPlayTime); nextPlayTime += buffer.duration; }
function stopAllAudio() { activeSources.forEach(source => { try { source.stop(); } catch (e) {} }); activeSources = []; if (audioContext) { nextPlayTime = audioContext.currentTime; } }
// Pulse Orb Visualizer logic function visualizeOrb() { const bufferLength = 128; const dataArray = new Uint8Array(bufferLength);
function draw() { animationFrameId = requestAnimationFrame(draw);
let activeAnalyser = null; if (activeSources.length > 0 && playbackAnalyser) { activeAnalyser = playbackAnalyser; } else if (isListening && !isModelSpeaking && analyser) { activeAnalyser = analyser; }
if (activeAnalyser) { activeAnalyser.getByteFrequencyData(dataArray); let sum = 0; for (let i = 0; i < bufferLength; i++) { sum += dataArray[i]; } const average = sum / bufferLength; // 0 to 255 averageVolume = averageVolume * 0.8 + average * 0.2; } else { averageVolume = averageVolume * 0.95; }
const width = canvas.width = canvas.clientWidth; const height = canvas.height = canvas.clientHeight; const centerX = width / 2; const centerY = height / 2;
ctx.clearRect(0, 0, width, height);
// Pulse factor let pulse = averageVolume * 0.55; if (pulse < 0.5) { // Gentle breathing effect when quiet pulse = (Math.sin(Date.now() / 400) + 1.0) * 1.5; } const baseRadius = 40 + pulse;
// Outer neon aura glow const gradient = ctx.createRadialGradient( centerX, centerY, baseRadius * 0.2, centerX, centerY, baseRadius * 1.5 ); if (isListening && activeSources.length === 0) { // CYAN listening state gradient.addColorStop(0, 'rgba(6, 182, 212, 0.9)'); gradient.addColorStop(0.3, 'rgba(6, 182, 212, 0.4)'); gradient.addColorStop(0.8, 'rgba(16, 185, 129, 0.1)'); gradient.addColorStop(1, 'rgba(0,0,0,0)'); } else if (activeSources.length > 0) { // INDIGO speaking state gradient.addColorStop(0, 'rgba(99, 102, 241, 0.9)'); gradient.addColorStop(0.3, 'rgba(168, 85, 247, 0.4)'); gradient.addColorStop(0.8, 'rgba(236, 72, 153, 0.1)'); gradient.addColorStop(1, 'rgba(0,0,0,0)'); } else { // RED muted state gradient.addColorStop(0, 'rgba(239, 68, 68, 0.7)'); gradient.addColorStop(0.4, 'rgba(239, 68, 68, 0.2)'); gradient.addColorStop(1, 'rgba(0,0,0,0)'); }
ctx.fillStyle = gradient; ctx.beginPath(); ctx.arc(centerX, centerY, baseRadius * 1.5, 0, 2 * Math.PI); ctx.fill();
// Inner core orb ctx.shadowBlur = 25; if (isListening && activeSources.length === 0) { ctx.shadowColor = '#22d3ee'; // cyan-400 ctx.fillStyle = '#ffffff'; } else if (activeSources.length > 0) { ctx.shadowColor = '#a855f7'; // purple-500 ctx.fillStyle = '#f8fafc'; } else { ctx.shadowColor = '#ef4444'; // red-500 ctx.fillStyle = '#fca5a5'; }
ctx.beginPath(); ctx.arc(centerX, centerY, baseRadius, 0, 2 * Math.PI); ctx.fill(); ctx.shadowBlur = 0; // reset }
draw(); } </script></body></html>123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>TRON - Creator Dashboard</title>
<script src="https://cdn.tailwindcss.com"></script>
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,700;1,400&family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Inter', sans-serif;
background: radial-gradient(circle at top left, #0f172a, #020617);
}
.toi-header {
font-family: 'Playfair Display', serif;
letter-spacing: 0.05em;
}
.toi-body {
font-family: Georgia, serif;
line-height: 1.6;
}
</style>
</head>
<body class="min-h-screen text-slate-100 flex flex-col">
<!-- Navbar -->
<header class="border-b border-slate-800 bg-slate-900/60 backdrop-blur-md sticky top-0 z-50">
<div class="max-w-7xl mx-auto px-6 py-4 flex items-center justify-between">
<div class="flex items-center space-x-3">
<div class="w-10 h-10 rounded-xl bg-gradient-to-tr from-cyan-500 to-indigo-500 flex items-center justify-center shadow-lg shadow-indigo-500/20">
<span class="text-xl font-bold text-white tracking-widest toi-header">T</span>
</div>
<div>
<h1 class="text-lg font-bold bg-gradient-to-r from-white to-slate-400 bg-clip-text text-transparent">TRON</h1>
<p class="text-xs text-slate-500 font-medium">Voice-Activated News Creator</p>
</div>
</div>
<div class="text-sm font-semibold px-4 py-1.5 rounded-full bg-slate-800 border border-slate-700 text-slate-300">
Planning & Creation Mode
</div>
</div>
</header>
<!-- Main Content -->
<main class="flex-1 max-w-7xl w-full mx-auto px-6 py-8 grid grid-cols-1 lg:grid-cols-2 gap-8">
<!-- LEFT PANEL: Article Builder & Live Preview -->
<section class="flex flex-col space-y-6">
<div class="bg-slate-900/40 border border-slate-800 rounded-2xl p-6 backdrop-blur-sm space-y-4">
<h2 class="text-xl font-semibold flex items-center space-x-2">
<span class="w-2.5 h-2.5 rounded-full bg-cyan-500 animate-pulse"></span>
<span>1. Write Article Content</span>
</h2>
<div class="space-y-4">
<div>
<label class="block text-xs font-semibold text-slate-400 uppercase tracking-wider mb-2">Headline</label>
<input id="input-headline" type="text" class="w-full bg-slate-950 border border-slate-800 focus:border-cyan-500 focus:ring-1 focus:ring-cyan-500 rounded-xl px-4 py-3 text-slate-100 placeholder-slate-600 outline-none transition-all" placeholder="Enter article headline..." value="TRON AI CHANNELS REAL-TIME NEWS DIRECTLY VIA VOICE PROTOCOL">
</div>
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
<div>
<label class="block text-xs font-semibold text-slate-400 uppercase tracking-wider mb-2">Reporter / Author</label>
<input id="input-author" type="text" class="w-full bg-slate-950 border border-slate-800 focus:border-cyan-500 focus:ring-1 focus:ring-cyan-500 rounded-xl px-4 py-3 text-slate-100 placeholder-slate-600 outline-none transition-all" placeholder="Reporter name..." value="Special Correspondent">
</div>
<div>
<label class="block text-xs font-semibold text-slate-400 uppercase tracking-wider mb-2">Publication Date</label>
<input id="input-date" type="text" class="w-full bg-slate-950 border border-slate-800 focus:border-cyan-500 focus:ring-1 focus:ring-cyan-500 rounded-xl px-4 py-3 text-slate-100 placeholder-slate-600 outline-none transition-all" value="June 25, 2026">
</div>
</div>
<div>
<label class="block text-xs font-semibold text-slate-400 uppercase tracking-wider mb-2">Article Body Text</label>
<textarea id="input-body" rows="6" class="w-full bg-slate-950 border border-slate-800 focus:border-cyan-500 focus:ring-1 focus:ring-cyan-500 rounded-xl px-4 py-3 text-slate-100 placeholder-slate-600 outline-none transition-all resize-y" placeholder="Start typing the article content...">In an unprecedented milestone for digital media, developers have unveiled TRON, a conversational, voice-activated news assistant designed to ground reader inquiries directly within investigative reports. By bridging real-time WebSocket connections with Google's latest multimodal audio models, the prototype enables readers to hold active, low-latency dialogue with editorial content.
Rather than relying on static pages, the technology converts the text into a structured knowledge base, preventing the assistant from hallucinating facts outside the uploaded context. Users can question layout decisions, dispute specific assertions, or ask the system to automatically generate comprehensive research summaries as Microsoft Word downloads.</textarea>
</div>
</div>
</div>
<!-- Times of India Editorial Live Preview -->
<div class="bg-white text-neutral-900 rounded-2xl p-8 border border-slate-200 shadow-2xl flex flex-col justify-between min-h-[450px]">
<div>
<!-- TOI Masthead -->
<div class="text-center border-b-4 border-double border-neutral-900 pb-3 mb-4">
<div class="text-xs uppercase tracking-widest font-serif font-bold text-neutral-500 flex justify-between px-1">
<span>Established 1838</span>
<span>The Times of India</span>
<span>Daily Edition</span>
</div>
<h1 class="text-3xl md:text-4xl font-serif font-black tracking-normal toi-header my-2 text-neutral-950">THE TIMES OF INDIA</h1>
<div class="text-xs border-t border-neutral-900 pt-1 flex justify-between font-serif italic text-neutral-700">
<span>Reg. No. Delhi-0912</span>
<span id="preview-date-top">June 25, 2026</span>
<span>Price: ₹ 5.00</span>
</div>
</div>
<!-- Article Header -->
<div class="mb-4">
<h2 id="preview-headline" class="text-xl md:text-2xl font-bold font-serif leading-tight text-neutral-900 tracking-tight">TRON AI CHANNELS REAL-TIME NEWS DIRECTLY VIA VOICE PROTOCOL</h2>
<div class="mt-2 text-xs text-neutral-600 border-b border-neutral-200 pb-2 font-serif flex items-center justify-between">
<span>By <strong id="preview-author" class="text-neutral-900">Special Correspondent</strong></span>
<span id="preview-date-sub">June 25, 2026</span>
</div>
</div>
<!-- Article Body in Column Layout -->
<div id="preview-body" class="toi-body text-sm text-neutral-800 space-y-3 columns-1 md:columns-2 gap-6 text-justify">
In an unprecedented milestone for digital media, developers have unveiled TRON, a conversational, voice-activated news assistant designed to ground reader inquiries directly within investigative reports. By bridging real-time WebSocket connections with Google's latest multimodal audio models, the prototype enables readers to hold active, low-latency dialogue with editorial content.
Rather than relying on static pages, the technology converts the text into a structured knowledge base, preventing the assistant from hallucinating facts outside the uploaded context. Users can question layout decisions, dispute specific assertions, or ask the system to automatically generate comprehensive research summaries as Microsoft Word downloads.
</div>
</div>
<!-- Preview CTA Button -->
<div class="mt-8 border-t border-neutral-200 pt-4 flex justify-end">
<button class="px-5 py-2.5 rounded-lg bg-neutral-900 hover:bg-neutral-800 text-white font-medium text-sm flex items-center space-x-2 transition-all shadow-md active:scale-95 cursor-not-allowed opacity-90" disabled>
<svg class="w-4 h-4 text-cyan-400 animate-pulse" fill="currentColor" viewBox="0 0 24 24"><path d="M12 14c1.66 0 3-1.34 3-3V5c0-1.66-1.34-3-3-3S9 3.34 9 5v6c0 1.66 1.34 3 3 3z"/><path d="M17 11c0 2.76-2.24 5-5 5s-5-2.24-5-5H5c0 3.53 2.61 6.43 6 6.92V21h2v-3.08c3.39-.49 6-3.39 6-6.92h-2z"/></svg>
<span>Talk to Tron</span>
</button>
</div>
</div>
</section>
<!-- RIGHT PANEL: Tron Settings & RAG Context -->
<section class="flex flex-col space-y-6">
<div class="bg-slate-900/40 border border-slate-800 rounded-2xl p-6 backdrop-blur-sm space-y-6 flex-1 flex flex-col justify-between">
<div class="space-y-6">
<h2 class="text-xl font-semibold flex items-center space-x-2">
<span class="w-2.5 h-2.5 rounded-full bg-indigo-500 animate-pulse"></span>
<span>2. Customize Tron Settings & RAG</span>
</h2>
<!-- Persona Prompt -->
<div>
<label class="block text-xs font-semibold text-slate-400 uppercase tracking-wider mb-2">System Persona Prompt</label>
<textarea id="input-persona" rows="4" class="w-full bg-slate-950 border border-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 rounded-xl px-4 py-3 text-slate-100 placeholder-slate-600 outline-none transition-all resize-y text-sm">You are Tron, a 25-year-old male reporter/assistant from Delhi, India. You speak fluent, natural conversational English with a professional yet friendly Delhi cadence and human rhythm.</textarea>
</div>
<!-- Strict Grounding Toggle & Custom Instructions -->
<div class="bg-slate-950 p-4 border border-slate-800 rounded-xl space-y-3">
<div class="flex items-start space-x-3">
<input id="input-grounding" type="checkbox" checked class="mt-1 w-4 h-4 text-indigo-600 border-slate-800 bg-slate-900 rounded focus:ring-indigo-500 focus:ring-offset-slate-950">
<div class="flex-1">
<label for="input-grounding" class="text-sm font-semibold text-slate-200">Enforce Strict Context Bounding (RAG)</label>
<p class="text-xs text-slate-500 mt-0.5 mb-2">If checked, the custom rules below will be appended to Tron's System Persona Prompt.</p>
<textarea id="input-grounding-instructions" rows="4" class="w-full bg-slate-900 border border-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 rounded-lg px-3 py-2 text-slate-100 placeholder-slate-600 outline-none transition-all text-xs resize-y">1. You must NEVER answer questions or ground your statements using any knowledge outside of the uploaded source files/documents provided in this session.
2. If the answer to the reader's question is not directly mentioned in the uploaded documents, you must politely respond: 'I am sorry, but that information is not available in the investigative report or the uploaded research documents.'
3. You must follow all principles of Non-violent Communication (NVC). Always be empathetic, observation-based, feelings-aware, and request-oriented.
4. You must ask the user if they want you to read the article aloud.</textarea>
</div>
</div>
</div>
<!-- Voice Dropdown, VAD & Salutary Greeting -->
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
<div>
<label class="block text-xs font-semibold text-slate-400 uppercase tracking-wider mb-2">Active Voice Profile</label>
<select id="input-voice" class="w-full bg-slate-950 border border-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 rounded-xl px-4 py-3 text-slate-100 outline-none transition-all text-sm">
<option value="Puck">Puck (Male - Soft & Friendly)</option>
<option value="Fenrir" selected>Fenrir (Male - Rich & Crisp)</option>
<option value="Aoede">Aoede (Female - Calm & Clear)</option>
<option value="Charon">Charon (Female - Warm & Professional)</option>
</select>
</div>
<div>
<label class="block text-xs font-semibold text-slate-400 uppercase tracking-wider mb-2">VAD Silence Threshold</label>
<select id="input-vad-silence" class="w-full bg-slate-950 border border-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 rounded-xl px-4 py-3 text-slate-100 outline-none transition-all text-sm">
<option value="400">400ms (Rapid response)</option>
<option value="800">800ms (Balanced conversational)</option>
<option value="1200" selected>1200ms (Standard / Deliberate)</option>
<option value="2000">2000ms (Relaxed / Long pauses)</option>
</select>
</div>
<div>
<label class="block text-xs font-semibold text-slate-400 uppercase tracking-wider mb-2">Salutary Greeting Message</label>
<input id="input-greeting" type="text" class="w-full bg-slate-950 border border-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 rounded-xl px-4 py-3 text-slate-100 placeholder-slate-600 outline-none transition-all text-sm" value="Hello! I am Tron, your news assistant. I have analyzed the research document. Would you like me to read the article to you, or answer any specific questions?">
</div>
</div>
<!-- Custom Backend URL (Optional) -->
<div>
<label class="block text-xs font-semibold text-slate-400 uppercase tracking-wider mb-2">Custom Backend Host URL (Optional)</label>
<input id="input-backend-url" type="text" class="w-full bg-slate-950 border border-slate-800 focus:border-indigo-500 focus:ring-1 focus:ring-indigo-500 rounded-xl px-4 py-3 text-slate-100 placeholder-slate-600 outline-none transition-all text-sm" placeholder="e.g. wss://your-tunnel.ngrok-free.app (leave blank for local address http://localhost:49999)">
<span class="text-[10px] text-slate-500 mt-1 block">Specify this if you want to run Tron over a public tunnel (like ngrok) or host it on Render/HF, so your shared files can connect back to your server over the internet.</span>
</div>
<!-- File Upload Zone -->
<div>
<label class="block text-xs font-semibold text-slate-400 uppercase tracking-wider mb-2">Knowledge Base Documents (RAG)</label>
<div id="drop-zone" class="border-2 border-dashed border-slate-800 hover:border-indigo-500 bg-slate-950/50 rounded-xl p-6 text-center cursor-pointer transition-all flex flex-col items-center justify-center group">
<input type="file" id="file-input" multiple accept=".pdf,.docx" class="hidden">
<svg class="w-8 h-8 text-slate-500 group-hover:text-indigo-400 mb-2 transition-all" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"/></svg>
<span class="text-sm font-semibold text-slate-300">Drag & Drop PDF or Word files</span>
<span class="text-xs text-slate-600 mt-1">Accepts .pdf and .docx documents</span>
</div>
<!-- File list -->
<div id="file-list" class="mt-3 space-y-2"></div>
</div>
</div>
<!-- Construct Button -->
<div class="mt-8 border-t border-slate-800 pt-6">
<button id="btn-construct" class="w-full bg-gradient-to-r from-cyan-500 to-indigo-600 hover:from-cyan-600 hover:to-indigo-700 text-white font-semibold py-3.5 px-6 rounded-xl transition-all shadow-lg shadow-indigo-500/10 flex items-center justify-center space-x-2 active:scale-[0.98]">
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z"/></svg>
<span>Construct Tron Asset</span>
</button>
<div id="status-message" class="text-center text-xs mt-3 hidden"></div>
</div>
</div>
</section>
</main>
<!-- Footer -->
<footer class="border-t border-slate-800 py-6 text-center text-xs text-slate-500 bg-slate-950/40">
<p>© 2026 TRON News Assistant Prototype. Powered by Gemini Multimodal Live API.</p>
</footer>
<!-- Frontend logic -->
<script>
const inputHeadline = document.getElementById('input-headline');
const inputAuthor = document.getElementById('input-author');
const inputDate = document.getElementById('input-date');
const inputBody = document.getElementById('input-body');
const previewHeadline = document.getElementById('preview-headline');
const previewAuthor = document.getElementById('preview-author');
const previewDateTop = document.getElementById('preview-date-top');
const previewDateSub = document.getElementById('preview-date-sub');
const previewBody = document.getElementById('preview-body');
// Live updates
function updatePreview() {
previewHeadline.textContent = inputHeadline.value || 'UNTITLED REPORT';
previewAuthor.textContent = inputAuthor.value || 'Anonymous';
previewDateTop.textContent = inputDate.value;
previewDateSub.textContent = inputDate.value;
// Format paragraphs
const text = inputBody.value || '';
const paras = text.split('\n').filter(p => p.trim() !== '');
previewBody.innerHTML = paras.map(p => `<p class="mb-3">${p.trim()}</p>`).join('');
}
[inputHeadline, inputAuthor, inputDate, inputBody].forEach(el => {
el.addEventListener('input', updatePreview);
});
// Initialize preview
updatePreview();
// Drag & Drop
const dropZone = document.getElementById('drop-zone');
const fileInput = document.getElementById('file-input');
const fileList = document.getElementById('file-list');
let selectedFiles = [];
dropZone.addEventListener('click', () => fileInput.click());
dropZone.addEventListener('dragover', (e) => {
e.preventDefault();
dropZone.classList.add('border-indigo-500', 'bg-slate-900/50');
});
dropZone.addEventListener('dragleave', () => {
dropZone.classList.remove('border-indigo-500', 'bg-slate-900/50');
});
dropZone.addEventListener('drop', (e) => {
e.preventDefault();
dropZone.classList.remove('border-indigo-500', 'bg-slate-900/50');
handleFiles(e.dataTransfer.files);
});
fileInput.addEventListener('change', () => {
handleFiles(fileInput.files);
});
function handleFiles(files) {
for (let file of files) {
if (file.name.endsWith('.pdf') || file.name.endsWith('.docx')) {
// Prevent duplicates
if (!selectedFiles.some(f => f.name === file.name && f.size === file.size)) {
selectedFiles.push(file);
}
}
}
renderFileList();
}
function removeFile(index) {
selectedFiles.splice(index, 1);
renderFileList();
}
function renderFileList() {
fileList.innerHTML = selectedFiles.map((file, i) => `
<div class="flex items-center justify-between bg-slate-950 border border-slate-800 rounded-xl px-4 py-2 text-xs">
<div class="flex items-center space-x-2 truncate">
<svg class="w-4 h-4 text-indigo-400 flex-shrink-0" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z"/></svg>
<span class="text-slate-300 font-medium truncate">${file.name}</span>
<span class="text-slate-600 flex-shrink-0">(${(file.size / 1024 / 1024).toFixed(2)} MB)</span>
</div>
<button onclick="removeFile(${i})" class="text-slate-500 hover:text-red-400 transition-colors p-1">
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"/></svg>
</button>
</div>
`).join('');
}
// Construct TRON asset
const btnConstruct = document.getElementById('btn-construct');
const statusMessage = document.getElementById('status-message');
btnConstruct.addEventListener('click', async () => {
btnConstruct.disabled = true;
statusMessage.className = 'text-center text-xs mt-3 text-cyan-400';
statusMessage.textContent = 'Uploading files and generating asset... Please wait.';
statusMessage.classList.remove('hidden');
const formData = new FormData();
formData.append('headline', inputHeadline.value);
formData.append('author', inputAuthor.value);
formData.append('date', inputDate.value);
formData.append('body', inputBody.value);
formData.append('persona', document.getElementById('input-persona').value);
formData.append('grounding', document.getElementById('input-grounding').checked ? 'true' : 'false');
formData.append('grounding_instructions', document.getElementById('input-grounding-instructions').value);
formData.append('voice', document.getElementById('input-voice').value);
formData.append('greeting', document.getElementById('input-greeting').value);
formData.append('silence_duration_ms', document.getElementById('input-vad-silence').value);
formData.append('custom_backend_url', document.getElementById('input-backend-url').value);
selectedFiles.forEach((file) => {
formData.append('files', file);
});
try {
const backendOrigin = window.location.protocol === 'file:' || window.location.port !== '49999'
? 'http://127.0.0.1:49999'
: window.location.origin;
const response = await fetch(`${backendOrigin}/construct`, {
method: 'POST',
body: formData
});
if (!response.ok) {
throw new Error(await response.text() || 'Failed to construct asset');
}
const data = await response.json();
statusMessage.className = 'text-center text-xs mt-3 text-green-400';
statusMessage.textContent = 'TRON Asset compiled and hosted successfully!';
// Open the Share Modal with the link and download info
openShareModal(data.shareable_url, data.filename);
} catch (err) {
console.error(err);
statusMessage.className = 'text-center text-xs mt-3 text-red-400';
statusMessage.textContent = 'Error: ' + err.message;
} finally {
btnConstruct.disabled = false;
}
});
inputGrounding.addEventListener('change', () => {
inputGroundingInstructions.disabled = !inputGrounding.checked;
if (inputGrounding.checked) {
inputGroundingInstructions.classList.remove('opacity-50', 'cursor-not-allowed');
} else {
inputGroundingInstructions.classList.add('opacity-50', 'cursor-not-allowed');
}
});
// Shareable Modal functions
var currentDownloadUrl = "";
var currentFilename = "";
function openShareModal(shareableUrl, filename) {
var shareModal = document.getElementById('share-modal');
var shareLinkInput = document.getElementById('share-link-input');
var btnDownloadModal = document.getElementById('btn-download-modal');
currentDownloadUrl = shareableUrl;
currentFilename = filename;
shareLinkInput.value = shareableUrl;
// Show modal
shareModal.classList.remove('hidden');
// Allow display change before fading in
setTimeout(() => {
shareModal.classList.remove('opacity-0');
shareModal.querySelector('.transform').classList.remove('scale-95');
}, 50);
// Configure download button in modal
btnDownloadModal.onclick = async () => {
try {
const response = await fetch(currentDownloadUrl);
const blob = await response.blob();
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = currentFilename;
document.body.appendChild(a);
a.click();
a.remove();
window.URL.revokeObjectURL(url);
} catch (e) {
alert("Download failed: " + e.message);
}
};
}
function closeShareModal() {
var shareModal = document.getElementById('share-modal');
var copyFeedback = document.getElementById('copy-feedback');
var btnCopyLink = document.getElementById('btn-copy-link');
shareModal.classList.add('opacity-0');
shareModal.querySelector('.transform').classList.add('scale-95');
setTimeout(() => {
shareModal.classList.add('hidden');
// Clear feedback status
copyFeedback.classList.add('hidden');
btnCopyLink.textContent = "Copy";
btnCopyLink.className = "bg-indigo-600 hover:bg-indigo-500 text-white font-semibold rounded-xl px-4 text-xs transition-all active:scale-95 flex items-center justify-center gap-1 min-w-[90px]";
}, 300);
}
async function copyShareLink() {
var shareLinkInput = document.getElementById('share-link-input');
var btnCopyLink = document.getElementById('btn-copy-link');
var copyFeedback = document.getElementById('copy-feedback');
try {
await navigator.clipboard.writeText(shareLinkInput.value);
btnCopyLink.textContent = "Copied!";
btnCopyLink.className = "bg-green-600 hover:bg-green-500 text-white font-semibold rounded-xl px-4 text-xs transition-all active:scale-95 flex items-center justify-center gap-1 min-w-[90px]";
copyFeedback.classList.remove('hidden');
} catch (err) {
console.error('Failed to copy text: ', err);
// Fallback for non-secure contexts
shareLinkInput.select();
document.execCommand('copy');
btnCopyLink.textContent = "Copied!";
copyFeedback.classList.remove('hidden');
}
}
</script>
<!-- Shareable Link Modal Overlay -->
<div id="share-modal" class="fixed inset-0 bg-slate-950/80 backdrop-blur-md flex items-center justify-center z-50 hidden opacity-0 transition-opacity duration-300">
<div class="bg-gradient-to-b from-slate-900 to-slate-950 border border-slate-800 rounded-3xl p-8 max-w-md w-full mx-4 shadow-2xl relative transform scale-95 transition-transform duration-300">
<!-- Close icon -->
<button onclick="closeShareModal()" class="absolute top-4 right-4 text-slate-500 hover:text-slate-300 transition-colors">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
</button>
<!-- Header -->
<div class="text-center mb-6">
<div class="w-16 h-16 bg-indigo-500/10 border border-indigo-500/20 text-indigo-400 rounded-full flex items-center justify-center mx-auto mb-4 animate-pulse">
<svg class="w-8 h-8" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8.684 10.742l4.63-2.315a4 4 0 11.83 1.66l-4.63 2.315a4 4 0 11-.83-1.66zm0 0L13 12.042m0 0l4.63 2.315a4 4 0 11-.83 1.66l-4.63-2.315a4 4 0 11.83-1.66z"/></svg>
</div>
<h3 class="text-xl font-bold text-slate-100 font-sans tracking-wide">TRON Asset Ready!</h3>
<p class="text-xs text-slate-400 mt-2">Your interactive voice-activated article is hosted and ready to share.</p>
</div>
<!-- Share Link Input -->
<div class="mb-6">
<label class="block text-xs font-semibold text-slate-400 uppercase tracking-wider mb-2">Shareable Web Link</label>
<div class="flex gap-2">
<input id="share-link-input" type="text" readonly class="w-full bg-slate-950 border border-slate-800 rounded-xl px-4 py-3 text-slate-200 outline-none text-xs font-mono select-all">
<button id="btn-copy-link" onclick="copyShareLink()" class="bg-indigo-600 hover:bg-indigo-500 text-white font-semibold rounded-xl px-4 text-xs transition-all active:scale-95 flex items-center justify-center gap-1 min-w-[90px]">
<span>Copy</span>
</button>
</div>
<span id="copy-feedback" class="text-[10px] text-green-400 mt-1.5 hidden flex items-center gap-1">
<svg class="w-3.5 h-3.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>
Link copied to clipboard!
</span>
</div>
<!-- Action buttons -->
<div class="flex flex-col gap-3">
<button id="btn-download-modal" class="w-full bg-slate-800/80 hover:bg-slate-800 border border-slate-700/50 text-slate-200 font-semibold rounded-xl py-3.5 text-xs transition-all active:scale-98 flex items-center justify-center gap-2">
<svg class="w-4 h-4 text-slate-400" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"/></svg>
Download Standalone HTML File
</button>
<button onclick="closeShareModal()" class="w-full text-slate-400 hover:text-slate-200 font-semibold py-3 text-xs transition-all">
Done
</button>
</div>
</div>
</div>
</body>
</html>DockerfileAdded+15
main.pyAdded+702
requirements.txtAdded+8
static/articles/tron_article_053fb616d0b94f4eb7fccc5fab7e8922.htmlAdded+741
static/articles/tron_article_0fb3306dfdb84f54a91d666edb511caf.htmlAdded+741
static/articles/tron_article_1321ca860c264698bc5206750e1d7d36.htmlAdded+741
static/articles/tron_article_1f20432c3e9f4b14ac8f84b61a941711.htmlAdded+741
static/articles/tron_article_22dd4140bc224eefa17e1c446bf458c0.htmlAdded+741
static/articles/tron_article_5916503ef72e4257949ce0b5fbc7fa61.htmlAdded+741
static/articles/tron_article_6cc0e313b05b478fad1150b03e38aa6c.htmlAdded+741
static/articles/tron_article_7c444789a03e47949479dcdcfc41ff5e.htmlAdded+741
static/articles/tron_article_9721b667cf1d481ba1598c0be600feb8.htmlAdded+741
static/articles/tron_article_9aa302ff6bd74ebeb547fd244cb6d723.htmlAdded+741
static/articles/tron_article_9b37a3874431435b832b993ecad1c781.htmlAdded+741
static/articles/tron_article_a1629c269d9746f799b37ec2145876a8.htmlAdded+741
static/articles/tron_article_f87db8a5695d47aca42c8bf0657006a3.htmlAdded+741
static/notes/note_01c66964.docxAdded
static/notes/note_145b64ff.docxAdded
static/notes/note_2c163f9a.docxAdded
static/notes/note_2f534bdd.docxAdded
static/notes/note_543c1249.docxAdded
static/notes/note_5e6c28e1.docxAdded
static/notes/note_aff61d80.docxAdded
static/notes/note_e6881791.docxAdded
static/notes/note_eadd9d4b.docxAdded
static/notes/note_ff10b542.docxAdded
static/uploads/289dd5028b3747bf86ef442f618004f2_Trump dismissed own govt.txtAdded+155
static/uploads/tron_article_a32332352ee54ffb915068604fc01967.htmlAdded+741
templates/article_template.htmlAdded+741
templates/dashboard.htmlAdded+498