# reid41/qa-pilot architecture

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

- Interactive diagram: https://gitdiagram.com/reid41/qa-pilot
- Repository: https://github.com/reid41/qa-pilot

## Overview

QA-Pilot is a web app for asking questions about GitHub repositories or uploaded source snapshots. Users create a session, load a source, then chat; the backend prepares repository data for retrieval and generates answers with a configured LLM. The product also manages sessions and settings and offers Python/Go codegraphs. The README documents these capabilities, while sampled backend excerpts show the chat, upload, and Python-graph entry points; some storage and Go-graph wiring is not visible in the excerpts.

Main entry points: [`app.py`](https://github.com/reid41/qa-pilot/blob/main/app.py) (HTTP API), [`svelte-app/src/App.svelte`](https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/App.svelte) (Session workspace), [`svelte-app/src/PromptTemplatesModal.svelte`](https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/PromptTemplatesModal.svelte) (Prompt templates), [`svelte-app/src/Chat.svelte`](https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/Chat.svelte) (Chat panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Web interface"]
  node_appui["Session workspace<br/>[App.svelte]"]
  node_chatui["Chat panel<br/>[Chat.svelte]"]
  node_sourceui["Source upload dialog"]
  node_settingsui["Settings and models"]
  node_apikeyui["API key settings<br/>[ApiKeyModal.svelte]"]
  node_promptui["Prompt templates"]
  node_deleteui["Template deletion"]
  node_modelui["Local model manager"]
  node_confirmui["Session deletion"]
end

subgraph group_api["Application backend"]
  node_backend["HTTP API<br/>[app.py]"]
  node_postgres[("PostgreSQL sessions")]
  node_config["Runtime configuration<br/>[runtime_config.py]"]
  node_models["Model adapters<br/>[qa_model_apis.py]"]
end

subgraph group_knowledge["Source and retrieval"]
  node_sources["Upload validation<br/>[local_sources.py]"]
  node_handler["Repository data handler<br/>[helper.py]"]
  node_vector[("Vector retrieval store<br/>[helper.py]")]
end

subgraph group_analysis["Code navigation"]
  node_pygraph["Python codegraph<br/>[codegraph.py]"]
  node_gograph["Go codegraph<br/>[go_codegraph.py]"]
  node_parser["Go parser<br/>[parser.go]"]
end

node_user(("User"))

node_user -->|"uses"| node_appui
node_appui -->|"renders"| node_chatui
node_appui -->|"opens"| node_sourceui
node_appui -->|"renders"| node_settingsui
node_appui -->|"renders"| node_apikeyui
node_appui -->|"renders"| node_modelui
node_appui -->|"renders"| node_promptui
node_appui -->|"renders"| node_confirmui
node_promptui -->|"opens"| node_deleteui
node_appui -->|"loads sessions"| node_backend
node_chatui -->|"sends chat"| node_backend
node_sourceui -->|"uploads sources"| node_backend
node_backend -->|"validates uploads"| node_sources
node_backend -->|"loads repository data"| node_handler
node_backend -->|"selects models"| node_models
node_backend -->|"reads sessions"| node_postgres
node_handler -.->|"indexes and retrieves"| node_vector
node_backend -->|"serves graph data"| node_pygraph
node_backend -.->|"serves Go graph"| node_gograph
node_gograph -.->|"uses parser"| node_parser
node_backend -->|"loads configuration"| node_config
node_settingsui -.->|"edits settings"| node_backend
node_apikeyui -.->|"manages keys"| node_backend
node_promptui -->|"manages templates"| node_backend
node_modelui -.->|"manages models"| node_backend

click node_appui "https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/App.svelte"
click node_chatui "https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/Chat.svelte"
click node_sourceui "https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/NewSourceModal.svelte"
click node_settingsui "https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/ConfigEditor.svelte"
click node_apikeyui "https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/ApiKeyModal.svelte"
click node_promptui "https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/PromptTemplatesModal.svelte"
click node_deleteui "https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/DeleteTemplateModal.svelte"
click node_modelui "https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/LlamaCppModelsModal.svelte"
click node_confirmui "https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/DeleteConfirmationModal.svelte"
click node_backend "https://github.com/reid41/qa-pilot/blob/main/app.py"
click node_config "https://github.com/reid41/qa-pilot/blob/main/utils/runtime_config.py"
click node_models "https://github.com/reid41/qa-pilot/blob/main/qa_model_apis.py"
click node_sources "https://github.com/reid41/qa-pilot/blob/main/utils/local_sources.py"
click node_handler "https://github.com/reid41/qa-pilot/blob/main/utils/helper.py"
click node_vector "https://github.com/reid41/qa-pilot/blob/main/utils/helper.py"
click node_pygraph "https://github.com/reid41/qa-pilot/blob/main/utils/codegraph.py"
click node_gograph "https://github.com/reid41/qa-pilot/blob/main/utils/go_codegraph.py"
click node_parser "https://github.com/reid41/qa-pilot/blob/main/parser.go"

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_appui,node_chatui,node_sourceui,node_settingsui,node_apikeyui,node_promptui,node_deleteui,node_modelui,node_confirmui,node_user toneBlue
class node_backend,node_postgres,node_config,node_models toneAmber
class node_sources,node_handler,node_vector toneMint
class node_pygraph,node_gograph,node_parser toneRose
```

## Components

### Web interface

- [Session workspace](https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/App.svelte): `svelte-app/src/App.svelte`
- [Chat panel](https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/Chat.svelte): `svelte-app/src/Chat.svelte`
- [Source upload dialog](https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/NewSourceModal.svelte): `svelte-app/src/NewSourceModal.svelte`
- [Settings and models](https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/ConfigEditor.svelte): `svelte-app/src/ConfigEditor.svelte`
- [API key settings](https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/ApiKeyModal.svelte): `svelte-app/src/ApiKeyModal.svelte`
- [Prompt templates](https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/PromptTemplatesModal.svelte): `svelte-app/src/PromptTemplatesModal.svelte`
- [Template deletion](https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/DeleteTemplateModal.svelte): `svelte-app/src/DeleteTemplateModal.svelte`
- [Local model manager](https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/LlamaCppModelsModal.svelte): `svelte-app/src/LlamaCppModelsModal.svelte`
- [Session deletion](https://github.com/reid41/qa-pilot/blob/main/svelte-app/src/DeleteConfirmationModal.svelte): `svelte-app/src/DeleteConfirmationModal.svelte`

### Application backend

- [HTTP API](https://github.com/reid41/qa-pilot/blob/main/app.py): `app.py`
- **PostgreSQL sessions**
- [Runtime configuration](https://github.com/reid41/qa-pilot/blob/main/utils/runtime_config.py): `utils/runtime_config.py`
- [Model adapters](https://github.com/reid41/qa-pilot/blob/main/qa_model_apis.py): `qa_model_apis.py`

### Source and retrieval

- [Upload validation](https://github.com/reid41/qa-pilot/blob/main/utils/local_sources.py): `utils/local_sources.py`
- [Repository data handler](https://github.com/reid41/qa-pilot/blob/main/utils/helper.py): `utils/helper.py`
- [Vector retrieval store](https://github.com/reid41/qa-pilot/blob/main/utils/helper.py): `utils/helper.py`

### Code navigation

- [Python codegraph](https://github.com/reid41/qa-pilot/blob/main/utils/codegraph.py): `utils/codegraph.py`
- [Go codegraph](https://github.com/reid41/qa-pilot/blob/main/utils/go_codegraph.py): `utils/go_codegraph.py`
- [Go parser](https://github.com/reid41/qa-pilot/blob/main/parser.go): `parser.go`

### Other components

- **User**

## Connections

- User → Session workspace: uses (evidence: `README.md`)
- Session workspace → Chat panel: renders (evidence: `svelte-app/src/App.svelte`)
- Session workspace → Source upload dialog: opens (evidence: `svelte-app/src/App.svelte`)
- Session workspace → Settings and models: renders (evidence: `svelte-app/src/App.svelte`)
- Session workspace → API key settings: renders (evidence: `svelte-app/src/App.svelte`)
- Session workspace → Local model manager: renders (evidence: `svelte-app/src/App.svelte`)
- Session workspace → Prompt templates: renders (evidence: `svelte-app/src/App.svelte`)
- Session workspace → Session deletion: renders (evidence: `svelte-app/src/App.svelte`)
- Prompt templates → Template deletion: opens (evidence: `svelte-app/src/PromptTemplatesModal.svelte`)
- Session workspace → HTTP API: loads sessions (evidence: `svelte-app/src/App.svelte`)
- Chat panel → HTTP API: sends chat (evidence: `svelte-app/src/Chat.svelte`)
- Source upload dialog → HTTP API: uploads sources
- HTTP API → Upload validation: validates uploads (evidence: `app.py`)
- HTTP API → Repository data handler: loads repository data (evidence: `app.py`)
- HTTP API → Model adapters: selects models (evidence: `app.py`)
- HTTP API → PostgreSQL sessions: reads sessions (evidence: `app.py`)
- Repository data handler → Vector retrieval store: indexes and retrieves (evidence: `utils/helper.py`)
- HTTP API → Python codegraph: serves graph data (evidence: `app.py`)
- HTTP API → Go codegraph: serves Go graph
- Go codegraph → Go parser: uses parser
- HTTP API → Runtime configuration: loads configuration (evidence: `app.py`)
- Settings and models → HTTP API: edits settings
- API key settings → HTTP API: manages keys
- Prompt templates → HTTP API: manages templates (evidence: `svelte-app/src/PromptTemplatesModal.svelte`)
- Local model manager → HTTP API: manages models
