How veryfastlearner/salesgenius works
1. Repo shape
This repository is a two-surface product: a React/Vite web shell in frontend/, plus two Python/Gradio applications for AI-driven workflows. The Python side is split into a sales intelligence assistant and a data-visualization assistant.
2. Top-level user entry points
The main user-facing paths are:
- app_gui.py for the SalesGenius chat experience
- smart_dashboard.py for the PlotSense / dashboard experience
- frontend/ as the browser-based launcher and navigation layer
The React UI appears to act as the primary portal into the two Gradio apps.
3. Frontend boundary
frontend/src/App.jsx and its components (ChatPanel, TracePanel, ProfileCard, PlotSensePanel, HeroSection) compose the browser UX. The frontend/src/api/ adapters (salesGenius.js, plotSense.js) isolate the UI from the Python services, which is the main client/server boundary in the repo.
4. SalesGenius backend architecture
The sales assistant is orchestrated as a sequential multi-agent pipeline described in the README and implemented across sales_agent.py and likely exposed through final_api.py. The chain is:
Analyzer/Gatekeeper → Validator/Strategist → Sales Agent/Expert.
Each stage narrows or reformats the request before the final response is returned to the UI.
5. Multi-agent data flow
The first agent filters irrelevant input and decides whether to stop early. If the request is relevant, the second agent turns the raw chat into structured intent and profile updates. The final agent uses that validated context to produce the user-facing answer plus hidden recommendation/next-step data for the interface.
6. Model and service dependencies
The architecture relies on Groq-hosted LLMs, with smaller models used for gating and formatting and a larger model used for the final reasoning step. The sales pipeline also pulls in Tavily for live company/news context and a local CSV dataset, sme_financial_decision.csv, for sector/financial benchmark grounding.
7. State handling and output normalization
A notable architectural concern is output hardening: the system normalizes LLM responses into strict dictionary/list shapes before sending them back to the UI. This indicates the backend is stateful across chat turns and is designed to avoid crashes from malformed model output.
8. PlotSense / Smart Dashboard subsystem
smart_dashboard.py is a separate Gradio app for CSV-driven analysis. Its workflow is: user uploads a dataset → the DataFrame is analyzed → chart recommendations are generated → the best recommendation drives plot generation → a separate explanation step turns the chart into plain-language insights.
9. PlotSense internal boundaries
The PlotSense flow combines three distinct responsibilities: recommendation, chart generation, and explanation. That is a clear pipeline boundary between AI suggestion, visualization rendering, and narrative interpretation, all mediated through Pandas and Matplotlib in memory.
10. Testing and validation
test_sales_agent.py and test_output.txt indicate at least one backend test path focused on the sales orchestration layer. The presence of tests and captured output suggests the backend behavior is important to keep deterministic enough for multi-turn interactions and UI state updates.
11. Deployment/runtime split
The repo mixes a Python runtime for AI services and a Node/Vite runtime for the frontend. The React app is built and served separately from the Gradio/Python services, which means the architecture is effectively a browser client plus one or more local or remote AI-backed Python servers.
12. Architecture summary for diagramming
If you’re drawing this system, model it as three major boxes: a React portal, a SalesGenius AI service with a 3-agent LLM pipeline and live/external data sources, and a PlotSense analytics service that turns uploaded CSVs into chart recommendations, plots, and explanations. The important boundaries are the UI-to-Python API boundary and the internal multi-agent/data-processing stages inside each Python service.
Main entry points: App.jsx App shell · sales_agent.py Agent pipeline · ChatPanel.jsx Chat panel · PlotSensePanel.jsx Plot panel
Components 22
Frontend portal
React/Vite browser UI and API bridge
- Main entry · Vite/React application entry point
frontend/src/main.jsx - App shell · Top-level browser experience that routes users into the two assistant surfaces
frontend/src/App.jsx - Chat panel · SalesGenius conversation interface
frontend/src/components/ChatPanel.jsx - Trace panel · Shows reasoning or execution trace for the sales workflow
frontend/src/components/TracePanel.jsx - Profile card · Displays customer or account context
frontend/src/components/ProfileCard.jsx - Plot panel · Dashboard surface for PlotSense interactions
frontend/src/components/PlotSensePanel.jsx - Hero section · Landing and navigation header
frontend/src/components/HeroSection.jsx - Sales API · Frontend adapter for the sales intelligence backend
frontend/src/api/salesGenius.js - Plot API · Frontend adapter for the PlotSense backend
frontend/src/api/plotSense.js
SalesGenius service
Gradio-backed sales intelligence pipeline
- Gradio app · SalesGenius chat application entry point
app_gui.py - Service API · Backend surface exposing the sales workflow to the UI
final_api.py - Agent pipeline · Sequential analyzer, validator, strategist, and expert stages
sales_agent.py - Groq models · Small and large hosted LLMs used across the sales stages
- Live context · Tavily-backed company and news lookup
- Benchmark CSV · Local sector and financial grounding dataset
sme_financial_decision.csv - Output guard · Hardened response shaping for chat state and UI safety
PlotSense service
CSV-driven analytics and visualization flow
- Dashboard app · PlotSense CSV analysis application entry point
smart_dashboard.py - Upload data · Ingests the user-provided dataset
- Data analysis · Inspects and prepares the dataframe for visualization
- Recommend chart · Chooses the most suitable chart from candidate options
- Render plot · Builds the selected chart in memory
- Explain chart · Turns the visualization into plain-language insights
Connections 21
- Main entry → App shell: bootstraps · React entry mounts the main portal
- App shell → Hero section: navigates · Landing area frames the product surfaces
- App shell → Chat panel: shows · Primary sales conversation UI
- App shell → Trace panel: shows · Trace and reasoning view
- App shell → Profile card: shows · Customer context pane
- App shell → Plot panel: shows · PlotSense dashboard surface
- Chat panel → Sales API: calls · Sales chat exchanges go through the client adapter
- Plot panel → Plot API: calls · Dashboard actions go through the plot adapter
- Sales API → Gradio app: requests · Browser client reaches the sales app/service boundary
- Plot API → Dashboard app: requests · Browser client reaches the PlotSense service boundary
- Gradio app → Service API: exposes · Gradio app surfaces the backend workflow
- Service API → Agent pipeline: orchestrates · Service delegates to the multi-agent sales flow
- Agent pipeline → Groq models: uses · Multiple Groq-hosted models power gating and final reasoning
- Agent pipeline → Live context: enriches · Fetches live context for company and market grounding
- Agent pipeline → Benchmark CSV: grounds · Uses the local benchmark dataset for validation and context
- Agent pipeline → Output guard: normalizes · Shapes model output into safe structured responses
- Dashboard app → Upload data: starts · Dashboard begins with dataset ingestion
- Upload data → Data analysis: prepares · Uploaded data is inspected and transformed
- Data analysis → Recommend chart: feeds · Analysis context informs chart selection
- Recommend chart → Render plot: selects · Chosen visualization is rendered
- Render plot → Explain chart: describes · Rendered chart is translated into insights