# hudsonmathew1910/heros architecture

> Architecture diagram of the GitHub repository hudsonmathew1910/heros, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hudsonmathew1910/heros
- Repository: https://github.com/hudsonmathew1910/heros

## Overview

Heros is a Django AI-assistant platform. Its main workflow accepts chat or developer-API requests, manages user/session context, routes prompts through Baymax to model providers, and returns responses; supporting stages include intent detection, web search, file handling, and usage tracking. Infinsight provides a separate dataset-analysis workflow spanning ingestion, retrieval, structured analysis, and LLM interpretation; Zuno adds music-assistant actions. The map preserves documented capabilities, but several subsystem links rely on README statements or source-index references rather than inspected implementation excerpts.

Main entry points: [`backend/views.py`](https://github.com/hudsonmathew1910/heros/blob/main/backend/views.py) (Web API and sessions), [`infinsight/Rag.py`](https://github.com/hudsonmathew1910/heros/blob/main/infinsight/Rag.py) (RAG orchestration), [`backend/hero_model.py`](https://github.com/hudsonmathew1910/heros/blob/main/backend/hero_model.py) (Baymax dispatcher), [`zuno/views.py`](https://github.com/hudsonmathew1910/heros/blob/main/zuno/views.py) (Zuno music assistant)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_request["Request and Accounts"]
  node_web_views["Web API and sessions<br/>[views.py]"]
  node_developer_api["Developer API<br/>[developer_api.py]"]
  node_records[("Accounts and chat state<br/>[models.py]")]
  node_key_security["Key encryption<br/>[encryption.py]"]
  node_usage["Usage tracking<br/>[usage_tracker.py]"]
end

subgraph group_ai["AI Routing"]
  node_intent["Intent detection<br/>[Nlp.py]"]
  node_baymax["Baymax dispatcher<br/>[hero_model.py]"]
  node_halo["Halo engine<br/>[halo.py]"]
  node_model_registry["Model registry<br/>[llm_registry.py]"]
  node_catalogue["Provider catalogue<br/>[llm_catalogue.py]"]
  node_web_search["Web search<br/>[web_search.py]"]
end

subgraph group_infinsight["Infinsight Analytics"]
  node_inf_views["Analytics endpoints<br/>[views.py]"]
  node_rag["RAG orchestration<br/>[Rag.py]"]
  node_file_parse["Dataset parsing<br/>[file_parses.py]"]
  node_embedding["Embedding retrieval<br/>[Embedding.py]"]
  node_analytics_llm["Analyst LLM<br/>[Llm.py]"]
  node_analyst_engine["Structured analysis<br/>[analyst_engine.py]"]
  node_inf_records[("Analytics sessions<br/>[models.py]")]
  node_guest["Guest access<br/>[guest.py]"]
end

subgraph group_apps["Apps and Tools"]
  node_zuno["Zuno music assistant<br/>[views.py]"]
  node_browser(("Browser extension"))
end

node_user(("Platform user"))
node_developer(("API client"))
node_provider_services{{"LLM providers"}}
node_music_services{{"YouTube Music and YouTube"}}

node_user -->|"sends requests"| node_web_views
node_developer -->|"calls API"| node_developer_api
node_web_views -->|"reads and writes"| node_records
node_web_views -->|"uses encryption"| node_key_security
node_web_views -->|"tracks usage"| node_usage
node_web_views -->|"detects intent"| node_intent
node_web_views -->|"dispatches prompts"| node_baymax
node_developer_api -.->|"routes inference"| node_baymax
node_baymax -->|"loads models"| node_model_registry
node_baymax -->|"invokes search"| node_web_search
node_baymax -->|"falls back across"| node_provider_services
node_user -->|"uploads and queries"| node_inf_views
node_inf_views -->|"starts analysis"| node_rag
node_inf_views -->|"manages sessions"| node_inf_records
node_rag -->|"parses datasets"| node_file_parse
node_rag -->|"stores and retrieves"| node_embedding
node_rag -->|"generates interpretation"| node_analytics_llm
node_rag -->|"runs data analysis"| node_analyst_engine
node_rag -->|"uses session data"| node_inf_records
node_analytics_llm -->|"selects guest models"| node_guest
node_guest -->|"manages guest data"| node_inf_records
node_browser -.->|"sends music intent"| node_zuno
node_zuno -->|"uses assistant context"| node_baymax
node_zuno -.->|"loads intent models"| node_model_registry
node_zuno -->|"searches and links"| node_music_services

click node_web_views "https://github.com/hudsonmathew1910/heros/blob/main/backend/views.py"
click node_developer_api "https://github.com/hudsonmathew1910/heros/blob/main/backend/developer_api.py"
click node_records "https://github.com/hudsonmathew1910/heros/blob/main/backend/models.py"
click node_key_security "https://github.com/hudsonmathew1910/heros/blob/main/backend/encryption.py"
click node_usage "https://github.com/hudsonmathew1910/heros/blob/main/backend/usage_tracker.py"
click node_intent "https://github.com/hudsonmathew1910/heros/blob/main/backend/Nlp.py"
click node_baymax "https://github.com/hudsonmathew1910/heros/blob/main/backend/hero_model.py"
click node_halo "https://github.com/hudsonmathew1910/heros/blob/main/backend/halo.py"
click node_model_registry "https://github.com/hudsonmathew1910/heros/blob/main/backend/llm_registry.py"
click node_catalogue "https://github.com/hudsonmathew1910/heros/blob/main/backend/llm_catalogue.py"
click node_web_search "https://github.com/hudsonmathew1910/heros/blob/main/backend/models_task/web_search.py"
click node_inf_views "https://github.com/hudsonmathew1910/heros/blob/main/infinsight/views.py"
click node_rag "https://github.com/hudsonmathew1910/heros/blob/main/infinsight/Rag.py"
click node_file_parse "https://github.com/hudsonmathew1910/heros/blob/main/infinsight/file_parses.py"
click node_embedding "https://github.com/hudsonmathew1910/heros/blob/main/infinsight/Embedding.py"
click node_analytics_llm "https://github.com/hudsonmathew1910/heros/blob/main/infinsight/Llm.py"
click node_analyst_engine "https://github.com/hudsonmathew1910/heros/blob/main/infinsight/analyst_engine.py"
click node_inf_records "https://github.com/hudsonmathew1910/heros/blob/main/infinsight/models.py"
click node_guest "https://github.com/hudsonmathew1910/heros/blob/main/infinsight/guest.py"
click node_zuno "https://github.com/hudsonmathew1910/heros/blob/main/zuno/views.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_web_views,node_developer_api,node_records,node_key_security,node_usage,node_user,node_developer toneBlue
class node_intent,node_baymax,node_halo,node_model_registry,node_catalogue,node_web_search toneAmber
class node_inf_views,node_rag,node_file_parse,node_embedding,node_analytics_llm,node_analyst_engine,node_inf_records,node_guest toneMint
class node_zuno,node_browser toneRose
class node_provider_services,node_music_services toneIndigo
```

## Components

### Request and Accounts

- [Web API and sessions](https://github.com/hudsonmathew1910/heros/blob/main/backend/views.py): `backend/views.py`
- [Developer API](https://github.com/hudsonmathew1910/heros/blob/main/backend/developer_api.py): `backend/developer_api.py`
- [Accounts and chat state](https://github.com/hudsonmathew1910/heros/blob/main/backend/models.py): `backend/models.py`
- [Key encryption](https://github.com/hudsonmathew1910/heros/blob/main/backend/encryption.py): `backend/encryption.py`
- [Usage tracking](https://github.com/hudsonmathew1910/heros/blob/main/backend/usage_tracker.py): `backend/usage_tracker.py`

### AI Routing

- [Intent detection](https://github.com/hudsonmathew1910/heros/blob/main/backend/Nlp.py): `backend/Nlp.py`
- [Baymax dispatcher](https://github.com/hudsonmathew1910/heros/blob/main/backend/hero_model.py): `backend/hero_model.py`
- [Halo engine](https://github.com/hudsonmathew1910/heros/blob/main/backend/halo.py): `backend/halo.py`
- [Model registry](https://github.com/hudsonmathew1910/heros/blob/main/backend/llm_registry.py): `backend/llm_registry.py`
- [Provider catalogue](https://github.com/hudsonmathew1910/heros/blob/main/backend/llm_catalogue.py): `backend/llm_catalogue.py`
- [Web search](https://github.com/hudsonmathew1910/heros/blob/main/backend/models_task/web_search.py): `backend/models_task/web_search.py`

### Infinsight Analytics

- [Analytics endpoints](https://github.com/hudsonmathew1910/heros/blob/main/infinsight/views.py): `infinsight/views.py`
- [RAG orchestration](https://github.com/hudsonmathew1910/heros/blob/main/infinsight/Rag.py): `infinsight/Rag.py`
- [Dataset parsing](https://github.com/hudsonmathew1910/heros/blob/main/infinsight/file_parses.py): `infinsight/file_parses.py`
- [Embedding retrieval](https://github.com/hudsonmathew1910/heros/blob/main/infinsight/Embedding.py): `infinsight/Embedding.py`
- [Analyst LLM](https://github.com/hudsonmathew1910/heros/blob/main/infinsight/Llm.py): `infinsight/Llm.py`
- [Structured analysis](https://github.com/hudsonmathew1910/heros/blob/main/infinsight/analyst_engine.py): `infinsight/analyst_engine.py`
- [Analytics sessions](https://github.com/hudsonmathew1910/heros/blob/main/infinsight/models.py): `infinsight/models.py`
- [Guest access](https://github.com/hudsonmathew1910/heros/blob/main/infinsight/guest.py): `infinsight/guest.py`

### Apps and Tools

- [Zuno music assistant](https://github.com/hudsonmathew1910/heros/blob/main/zuno/views.py): `zuno/views.py`
- **Browser extension**

### Other components

- **Platform user**
- **API client**
- **LLM providers**
- **YouTube Music and YouTube**

## Connections

- Platform user → Web API and sessions: sends requests
- API client → Developer API: calls API
- Web API and sessions → Accounts and chat state: reads and writes (evidence: `backend/views.py`)
- Web API and sessions → Key encryption: uses encryption (evidence: `backend/views.py`)
- Web API and sessions → Usage tracking: tracks usage (evidence: `backend/views.py`)
- Web API and sessions → Intent detection: detects intent (evidence: `backend/views.py`)
- Web API and sessions → Baymax dispatcher: dispatches prompts (evidence: `backend/views.py`)
- Developer API → Baymax dispatcher: routes inference
- Baymax dispatcher → Model registry: loads models (evidence: `backend/hero_model.py`)
- Baymax dispatcher → Web search: invokes search (evidence: `backend/hero_model.py`)
- Baymax dispatcher → LLM providers: falls back across
- Platform user → Analytics endpoints: uploads and queries
- Analytics endpoints → RAG orchestration: starts analysis (evidence: `infinsight/views.py`)
- Analytics endpoints → Analytics sessions: manages sessions (evidence: `infinsight/views.py`)
- RAG orchestration → Dataset parsing: parses datasets (evidence: `infinsight/Rag.py`)
- RAG orchestration → Embedding retrieval: stores and retrieves (evidence: `infinsight/Rag.py`)
- RAG orchestration → Analyst LLM: generates interpretation (evidence: `infinsight/Rag.py`)
- RAG orchestration → Structured analysis: runs data analysis (evidence: `infinsight/Rag.py`)
- RAG orchestration → Analytics sessions: uses session data (evidence: `infinsight/Rag.py`)
- Analyst LLM → Guest access: selects guest models (evidence: `infinsight/Llm.py`)
- Guest access → Analytics sessions: manages guest data (evidence: `infinsight/guest.py`)
- Browser extension → Zuno music assistant: sends music intent
- Zuno music assistant → Baymax dispatcher: uses assistant context (evidence: `zuno/views.py`)
- Zuno music assistant → Model registry: loads intent models (evidence: `zuno/views.py`)
- Zuno music assistant → YouTube Music and YouTube: searches and links (evidence: `zuno/views.py`)
