# veera180/sc_chatbot architecture

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

- Interactive diagram: https://gitdiagram.com/veera180/sc_chatbot
- Repository: https://github.com/veera180/sc_chatbot

## Overview

Scorechatbot is a web chat interface backed by a Python RAG service. The main workflow is a user question through the frontend and API to orchestration, where conversation memory, search, embeddings, and LLM generation support an answer with sources. The repository also includes document extraction and search-index preparation tooling. Several backend service relationships are supported by the source index; the README provides no workflow detail, and some frontend-to-backend wiring is not shown, so that link is marked unverified.

Main entry points: [`backend/rag_orchestrator.py`](https://github.com/veera180/sc_chatbot/blob/main/backend/rag_orchestrator.py) (RAG orchestrator), [`frontendMain/src/App.js`](https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/App.js) (Chat app), [`frontendMain/src/components/ChatContainer.jsx`](https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/components/ChatContainer.jsx) (Chat interface), [`frontendMain/src/components/ChatInput.jsx`](https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/components/ChatInput.jsx) (Question input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Chat client"]
  node_app["Chat app<br/>[App.js]"]
  node_chatui["Chat interface<br/>[ChatContainer.jsx]"]
  node_input["Question input<br/>[ChatInput.jsx]"]
  node_message["Answer display<br/>[MessageBubble.jsx]"]
  node_sidebar["Chat sidebar<br/>[Sidebar.jsx]"]
  node_sources["Source cards<br/>[SourceCard.jsx]"]
  node_webapi["Chat API client<br/>[api.js]"]
end

subgraph group_backend["RAG backend"]
  node_api["Backend API<br/>[api.py]"]
  node_orchestrator["RAG orchestrator"]
  node_memory[("Session memory<br/>[memory_service.py]")]
  node_search["Hybrid search<br/>[search_service.py]"]
  node_embedding["Embedding service"]
  node_llm["LLM service<br/>[llm_service.py]"]
  node_auth["Azure authentication<br/>[auth_services.py]"]
  node_main["CLI application<br/>[main.py]"]
end

subgraph group_indexing["Index preparation"]
  node_indexbuild["Index creation<br/>[create_index.py]"]
  node_schema["Search index schema<br/>[index_schema.py]"]
  node_upload["Document upload"]
end

subgraph group_extraction["Document extraction"]
  node_extract["LLM document extraction"]
  node_fixurls["URL repair<br/>[fix_urls.py]"]
  node_fixtitles["Title repair"]
end

subgraph group_integrations["External services"]
  node_searchsvc[("Azure AI Search")]
  node_embeddingapi["Embedding endpoint"]
  node_llmapi["LLM endpoint"]
  node_azuread["Azure AD"]
end

node_user(("Chat user"))

node_user -->|"asks"| node_input
node_input -->|"submits"| node_app
node_app -->|"sends message"| node_webapi
node_webapi -.->|"calls API"| node_api
node_app -->|"renders"| node_chatui
node_app -->|"renders"| node_sidebar
node_chatui -->|"renders"| node_message
node_message -.->|"renders"| node_sources
node_api -->|"dispatches questions"| node_orchestrator
node_main -->|"initializes"| node_orchestrator
node_orchestrator -->|"manages sessions"| node_memory
node_orchestrator -->|"searches documents"| node_search
node_orchestrator -->|"generates embeddings"| node_embedding
node_orchestrator -->|"generates answers"| node_llm
node_orchestrator -->|"uses authentication"| node_auth
node_search -->|"queries index"| node_searchsvc
node_embedding -->|"requests vectors"| node_embeddingapi
node_llm -->|"requests completion"| node_llmapi
node_auth -->|"requests token"| node_azuread
node_indexbuild -->|"uses schema"| node_schema

click node_app "https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/App.js"
click node_chatui "https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/components/ChatContainer.jsx"
click node_input "https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/components/ChatInput.jsx"
click node_message "https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/components/MessageBubble.jsx"
click node_sidebar "https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/components/Sidebar.jsx"
click node_sources "https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/components/SourceCard.jsx"
click node_webapi "https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/services/api.js"
click node_api "https://github.com/veera180/sc_chatbot/blob/main/backend/api.py"
click node_orchestrator "https://github.com/veera180/sc_chatbot/blob/main/backend/rag_orchestrator.py"
click node_memory "https://github.com/veera180/sc_chatbot/blob/main/backend/services/memory_service.py"
click node_search "https://github.com/veera180/sc_chatbot/blob/main/backend/services/search_service.py"
click node_embedding "https://github.com/veera180/sc_chatbot/blob/main/backend/services/embedding_service.py"
click node_llm "https://github.com/veera180/sc_chatbot/blob/main/backend/services/llm_service.py"
click node_auth "https://github.com/veera180/sc_chatbot/blob/main/backend/services/auth_services.py"
click node_main "https://github.com/veera180/sc_chatbot/blob/main/backend/main.py"
click node_indexbuild "https://github.com/veera180/sc_chatbot/blob/main/CreateIndex/create_index.py"
click node_schema "https://github.com/veera180/sc_chatbot/blob/main/CreateIndex/index_schema.py"
click node_upload "https://github.com/veera180/sc_chatbot/blob/main/CreateIndex/upload_documents.py"
click node_extract "https://github.com/veera180/sc_chatbot/blob/main/LLMExtraction/llm_extractor_optimized.py"
click node_fixurls "https://github.com/veera180/sc_chatbot/blob/main/LLMExtraction/fix_urls.py"
click node_fixtitles "https://github.com/veera180/sc_chatbot/blob/main/LLMExtraction/fix_parent_title.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_app,node_chatui,node_input,node_message,node_sidebar,node_sources,node_webapi,node_user toneBlue
class node_api,node_orchestrator,node_memory,node_search,node_embedding,node_llm,node_auth,node_main toneAmber
class node_indexbuild,node_schema,node_upload toneMint
class node_extract,node_fixurls,node_fixtitles toneRose
class node_searchsvc,node_embeddingapi,node_llmapi,node_azuread toneIndigo
```

## Components

### Chat client

- [Chat app](https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/App.js): `frontendMain/src/App.js`
- [Chat interface](https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/components/ChatContainer.jsx): `frontendMain/src/components/ChatContainer.jsx`
- [Question input](https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/components/ChatInput.jsx): `frontendMain/src/components/ChatInput.jsx`
- [Answer display](https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/components/MessageBubble.jsx): `frontendMain/src/components/MessageBubble.jsx`
- [Chat sidebar](https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/components/Sidebar.jsx): `frontendMain/src/components/Sidebar.jsx`
- [Source cards](https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/components/SourceCard.jsx): `frontendMain/src/components/SourceCard.jsx`
- [Chat API client](https://github.com/veera180/sc_chatbot/blob/main/frontendMain/src/services/api.js): `frontendMain/src/services/api.js`

### RAG backend

- [Backend API](https://github.com/veera180/sc_chatbot/blob/main/backend/api.py): `backend/api.py`
- [RAG orchestrator](https://github.com/veera180/sc_chatbot/blob/main/backend/rag_orchestrator.py): `backend/rag_orchestrator.py`
- [Session memory](https://github.com/veera180/sc_chatbot/blob/main/backend/services/memory_service.py): `backend/services/memory_service.py`
- [Hybrid search](https://github.com/veera180/sc_chatbot/blob/main/backend/services/search_service.py): `backend/services/search_service.py`
- [Embedding service](https://github.com/veera180/sc_chatbot/blob/main/backend/services/embedding_service.py): `backend/services/embedding_service.py`
- [LLM service](https://github.com/veera180/sc_chatbot/blob/main/backend/services/llm_service.py): `backend/services/llm_service.py`
- [Azure authentication](https://github.com/veera180/sc_chatbot/blob/main/backend/services/auth_services.py): `backend/services/auth_services.py`
- [CLI application](https://github.com/veera180/sc_chatbot/blob/main/backend/main.py): `backend/main.py`

### Index preparation

- [Index creation](https://github.com/veera180/sc_chatbot/blob/main/CreateIndex/create_index.py): `CreateIndex/create_index.py`
- [Search index schema](https://github.com/veera180/sc_chatbot/blob/main/CreateIndex/index_schema.py): `CreateIndex/index_schema.py`
- [Document upload](https://github.com/veera180/sc_chatbot/blob/main/CreateIndex/upload_documents.py): `CreateIndex/upload_documents.py`

### Document extraction

- [LLM document extraction](https://github.com/veera180/sc_chatbot/blob/main/LLMExtraction/llm_extractor_optimized.py): `LLMExtraction/llm_extractor_optimized.py`
- [URL repair](https://github.com/veera180/sc_chatbot/blob/main/LLMExtraction/fix_urls.py): `LLMExtraction/fix_urls.py`
- [Title repair](https://github.com/veera180/sc_chatbot/blob/main/LLMExtraction/fix_parent_title.py): `LLMExtraction/fix_parent_title.py`

### External services

- **Azure AI Search**
- **Embedding endpoint**
- **LLM endpoint**
- **Azure AD**

### Other components

- **Chat user**

## Connections

- Chat user → Question input: asks
- Question input → Chat app: submits (evidence: `frontendMain/src/App.js`)
- Chat app → Chat API client: sends message (evidence: `frontendMain/src/App.js`)
- Chat API client → Backend API: calls API
- Chat app → Chat interface: renders (evidence: `frontendMain/src/App.js`)
- Chat app → Chat sidebar: renders (evidence: `frontendMain/src/App.js`)
- Chat interface → Answer display: renders (evidence: `frontendMain/src/components/ChatContainer.jsx`)
- Answer display → Source cards: renders
- Backend API → RAG orchestrator: dispatches questions (evidence: `backend/api.py`)
- CLI application → RAG orchestrator: initializes (evidence: `backend/main.py`)
- RAG orchestrator → Session memory: manages sessions (evidence: `backend/rag_orchestrator.py`)
- RAG orchestrator → Hybrid search: searches documents (evidence: `backend/rag_orchestrator.py`)
- RAG orchestrator → Embedding service: generates embeddings (evidence: `backend/rag_orchestrator.py`)
- RAG orchestrator → LLM service: generates answers (evidence: `backend/rag_orchestrator.py`)
- RAG orchestrator → Azure authentication: uses authentication (evidence: `backend/rag_orchestrator.py`)
- Hybrid search → Azure AI Search: queries index (evidence: `backend/services/search_service.py`)
- Embedding service → Embedding endpoint: requests vectors (evidence: `backend/services/embedding_service.py`)
- LLM service → LLM endpoint: requests completion (evidence: `backend/services/llm_service.py`)
- Azure authentication → Azure AD: requests token (evidence: `backend/services/auth_services.py`)
- Index creation → Search index schema: uses schema (evidence: `CreateIndex/create_index.py`)
