From a3ba80b4be84baaa4293c1073c3ee758d9c13487 Mon Sep 17 00:00:00 2001 From: Shubhamsaboo Date: Sat, 2 May 2026 12:14:44 -0700 Subject: [PATCH] Remove stale insurance live demo code --- .../live_demo/app.js | 17 +----- .../live_demo/server.py | 56 +----------------- .../live_demo/styles.css | 59 +------------------ .../requirements.txt | 1 - 4 files changed, 3 insertions(+), 130 deletions(-) diff --git a/voice_ai_agents/insurance_claim_live_agent_team/live_demo/app.js b/voice_ai_agents/insurance_claim_live_agent_team/live_demo/app.js index 2f5143da..a16385c6 100644 --- a/voice_ai_agents/insurance_claim_live_agent_team/live_demo/app.js +++ b/voice_ai_agents/insurance_claim_live_agent_team/live_demo/app.js @@ -4,8 +4,6 @@ const timelineEl = document.querySelector("#timeline"); const handoffEl = document.querySelector("#handoff"); const packetMarkdownEl = document.querySelector("#packetMarkdown"); const packetDialog = document.querySelector("#packetDialog"); -const routePill = document.querySelector("#routePill"); -const claimState = document.querySelector("#claimState"); const packetProgress = document.querySelector("#packetProgress"); const callStatus = document.querySelector("#callStatus"); const micButton = document.querySelector("#micButton"); @@ -97,21 +95,19 @@ function render() { renderFields(); renderTimeline(); renderHandoff(); - renderRoute(); renderPacket(); } function renderTranscript() { transcriptEl.innerHTML = state.transcript .map((turn) => { - const safeText = escapeHtml(turn.text).replace(/passenger has neck pain/gi, '$&'); const initials = turn.speaker === "Agent" ? "AI" : "CL"; return `
${initials}
${escapeHtml(turn.speaker)} -

${safeText}

+

${escapeHtml(turn.text)}

`; @@ -240,17 +236,6 @@ function renderHandoff() { packetProgress.textContent = `${state.progress}%`; } -function renderRoute() { - if (!routePill || !claimState) return; - const route = state.route || "needs_docs"; - routePill.className = "route-pill"; - if (route === "emergency_escalation") routePill.classList.add("emergency"); - if (route === "needs_docs" || route === "special_investigation") routePill.classList.add("docs"); - if (route === "ready_for_adjuster") routePill.classList.add("ready"); - routePill.textContent = routeLabels[route] || route; - claimState.textContent = `Claim state: ${(routeLabels[route] || route).toLowerCase()}`; -} - function renderPacket() { packetMarkdownEl.textContent = state.packet_markdown || "# Initial Adjuster Handoff\n\nNo packet generated yet."; } diff --git a/voice_ai_agents/insurance_claim_live_agent_team/live_demo/server.py b/voice_ai_agents/insurance_claim_live_agent_team/live_demo/server.py index dfab3d99..40ed8569 100644 --- a/voice_ai_agents/insurance_claim_live_agent_team/live_demo/server.py +++ b/voice_ai_agents/insurance_claim_live_agent_team/live_demo/server.py @@ -18,7 +18,7 @@ from dataclasses import dataclass, field from pathlib import Path from typing import Any -from fastapi import FastAPI, File, Form, HTTPException, UploadFile, WebSocket, WebSocketDisconnect +from fastapi import FastAPI, HTTPException, WebSocket, WebSocketDisconnect from fastapi.middleware.cors import CORSMiddleware from fastapi.responses import FileResponse from fastapi.staticfiles import StaticFiles @@ -134,37 +134,6 @@ def _claimant_text(session: IntakeSession) -> str: ) -def _transcribe_audio(audio_bytes: bytes, mime_type: str) -> str: - try: - from google.genai import types - except ImportError as exc: - raise HTTPException( - status_code=503, - detail="Missing google-genai package. Run pip install -r requirements.txt.", - ) from exc - - try: - response = _client().models.generate_content( - model=MODEL, - contents=[ - types.Part.from_bytes(data=audio_bytes, mime_type=mime_type), - ( - "Transcribe this claimant audio as plain text only. " - "Preserve names, phone numbers, policy numbers, locations, dates, " - "injuries, documents, and evidence exactly when audible." - ), - ], - ) - except HTTPException: - raise - except Exception as exc: - raise HTTPException(status_code=502, detail=f"Gemini audio transcription failed: {exc}") from exc - text = (response.text or "").strip() - if not text: - raise HTTPException(status_code=422, detail="No speech was transcribed from the audio.") - return text - - def _status(value: Any, urgent: bool = False) -> str: text = str(value or "").strip().lower() if urgent: @@ -528,29 +497,6 @@ async def message(request: MessageRequest) -> SessionResponse: ) -@app.post("/api/audio", response_model=SessionResponse) -async def audio_message( - session_id: str = Form(...), - audio: UploadFile = File(...), -) -> SessionResponse: - session = sessions.get(session_id) - if session is None: - raise HTTPException(status_code=404, detail="Unknown intake session.") - audio_bytes = await audio.read() - if not audio_bytes: - raise HTTPException(status_code=400, detail="Audio file is empty.") - mime_type = audio.content_type or "audio/webm" - text = _transcribe_audio(audio_bytes, mime_type) - session.transcript.append({"speaker": "Claimant", "text": text}) - state = await _process_with_adk_graph(session, add_claimant_facing_reply=True) - return SessionResponse( - session_id=session.session_id, - model=MODEL, - has_api_key=_has_api_key(), - state=state, - ) - - @app.websocket("/ws/live") async def live_voice(websocket: WebSocket) -> None: await websocket.accept() diff --git a/voice_ai_agents/insurance_claim_live_agent_team/live_demo/styles.css b/voice_ai_agents/insurance_claim_live_agent_team/live_demo/styles.css index 234850cd..923bf6df 100644 --- a/voice_ai_agents/insurance_claim_live_agent_team/live_demo/styles.css +++ b/voice_ai_agents/insurance_claim_live_agent_team/live_demo/styles.css @@ -109,8 +109,7 @@ h3 { } .live-model, -.status-line, -.state-pill { +.status-line { color: var(--muted); font-size: 13px; display: inline-flex; @@ -135,7 +134,6 @@ h3 { background: var(--muted-soft); } -.route-pill, .status-pill { border-radius: 999px; font-size: 12px; @@ -145,54 +143,6 @@ h3 { letter-spacing: 0; } -.operator { - display: flex; - align-items: center; - gap: 12px; -} - -.headset { - width: 22px; - height: 22px; - border: 2px solid var(--body); - border-bottom: 0; - border-radius: 14px 14px 4px 4px; - position: relative; - opacity: 0.9; -} - -.headset::before, -.headset::after { - content: ""; - position: absolute; - top: 10px; - width: 5px; - height: 9px; - background: var(--body); - border-radius: 3px; -} - -.headset::before { - left: -4px; -} - -.headset::after { - right: -4px; -} - -.avatar { - width: 34px; - height: 34px; - display: grid; - place-items: center; - border-radius: 50%; - background: var(--panel-strong); - border: 1px solid var(--hairline-strong); - color: var(--ink); - font-size: 12px; - font-weight: 700; -} - .dashboard { display: grid; grid-template-columns: minmax(340px, 0.9fr) minmax(470px, 1.23fr) minmax(370px, 0.96fr); @@ -475,13 +425,6 @@ h3 { overflow-wrap: anywhere; } -.highlight { - color: var(--danger); - background: var(--danger-bg); - border-radius: 4px; - padding: 1px 3px; -} - .text-entry { display: grid; grid-template-columns: 1fr auto; diff --git a/voice_ai_agents/insurance_claim_live_agent_team/requirements.txt b/voice_ai_agents/insurance_claim_live_agent_team/requirements.txt index d473cc84..c11f4cf9 100644 --- a/voice_ai_agents/insurance_claim_live_agent_team/requirements.txt +++ b/voice_ai_agents/insurance_claim_live_agent_team/requirements.txt @@ -1,7 +1,6 @@ google-adk>=2.0.0a1 google-genai>=1.0.0 fastapi>=0.115 -python-multipart>=0.0.9 uvicorn[standard]>=0.30 pydantic>=2.7 typing-extensions>=4.12