How ta2002/it-support-agent works
Project type and purpose
• This is a single-page web application (React + Vite) that runs entirely in the browser.
• It uses browser Web APIs (screen capture, speech recognition, media streaming) and integrates with external AI and TTS services to provide an interactive IT-support assistant.
File structure
• Top-level files: Vite config, Tailwind config, tsconfig, package.json, .env example.
• /src: all source code:
• main.tsx + index.html – entry point for bootstrapping the React app.
• App.tsx – root application component orchestrating pages and global providers.
• /hooks – custom hooks (useTheme, useSelectTheme).
• /lib/utils.ts – shared utility functions.
• /config/site.ts – site-wide constants (nav items, metadata).
• /assets – images, fonts, etc.
• /types – TypeScript type definitions.
• No internal backend directory – all “backend” interactions are via Axios/SDK calls in the browser.
Extract architectural insights from the README
• The app flow:
1. User speaks (SpeechRecognition).
2. Screenshot (MediaDevices API).
3. Send question + screenshot to chosen LLM (OpenAI or Groq).
4. Chat history (React state in App).
5. Send AI response to ElevenLabs TTS, play audio.
• UI is built with React + Tailwind + shadcn UI.
• External dependencies: Axios, Groq SDK, OpenAI API, ElevenLabs API, various Web APIs.
Main components
a. Client Application (Browser)
• React SPA (App.tsx, component tree)
• UI Components (buttons, cards, select, nav, chat window)
• Custom Hooks & Utils (useTheme, useSelectTheme, utils.ts)
b. Browser Web APIs
• SpeechRecognition API
• MediaDevices API (screen capture)
• MediaSource API (audio streaming)
c. External AI Services
• OpenAI GPT-4o-mini endpoint
• Groq Llama-vision endpoint
d. External TTS Service
• ElevenLabs API for speech synthesis
e. Static Hosting / Deployment
• Vercel (vercel.json) or any static site host
Relationships and data flows
• User → (click/voice) → React UI
• React UI → SpeechRecognition API → transcribed text
• React UI → MediaDevices API → screenshot blob
• React orchestrates: send {transcript, screenshot} via Axios/Groq SDK to LLM
• LLM response → React state → Chat UI
• LLM response → ElevenLabs API → audio stream → MediaSource → audio playback
• Config (site.ts, env vars) feeds into API client modules
Architectural patterns & design principles
• Component-based architecture (React + shadcn UI)
• Hook abstraction for cross-cutting concerns (theme, TTS playback)
• Single source of truth for chat state held in App.tsx (or via Context if scaled)
• Environment-driven configuration (VITE_… env vars)
• Layered external service integration (LLM layer vs. TTS layer)
Essential elements to capture
• Clear labels on every node (e.g., “Groq Llama-vision API”)
• UI component subtree to illustrate where screen & speech controls live
• Deployment target (Vercel) showing static hosting of index.html + bundle