# trang3205/ai-assistant architecture

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

- Interactive diagram: https://gitdiagram.com/trang3205/ai-assistant
- Repository: https://github.com/trang3205/ai-assistant

## Overview

AI-Assistant is a local chat application: a user enters a message in the React interface, which sends it to a Spring Boot chat endpoint and displays the reply. The frontend also keeps conversation history and supports clearing the chat. The tree identifies RAG and LM Studio services, and the build declares local embedding and document-parser dependencies, but the README and sampled backend source do not show how these are wired. Those uncertain connections are therefore omitted.

Main entry points: [`frontend/src/components/ChatBox.jsx`](https://github.com/trang3205/ai-assistant/blob/main/frontend/src/components/ChatBox.jsx) (Chat state), [`frontend/src/api/chatApi.js`](https://github.com/trang3205/ai-assistant/blob/main/frontend/src/api/chatApi.js) (Chat API client), [`frontend/src/components/MessageInput.jsx`](https://github.com/trang3205/ai-assistant/blob/main/frontend/src/components/MessageInput.jsx) (Message input), [`src/main/java/com/example/aiassistant/controller/ChatController.java`](https://github.com/trang3205/ai-assistant/blob/main/src/main/java/com/example/aiassistant/controller/ChatController.java) (Chat endpoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Chat interface"]
  node_input["Message input<br/>[MessageInput.jsx]"]
  node_chatbox["Chat state<br/>[ChatBox.jsx]"]
  node_messages["Message display<br/>[MessageList.jsx]"]
  node_api["Chat API client<br/>[chatApi.js]"]
end

subgraph group_backend["Chat backend"]
  node_controller["Chat endpoint"]
end

subgraph group_ai["AI services"]
  node_rag["RAG service<br/>[RagService.java]"]
  node_lmservice["LM Studio service"]
end

node_user(("User"))
node_lmstudio["LM Studio"]
node_documents["Project documents"]

node_user -->|"enters message"| node_input
node_input -->|"sends text"| node_chatbox
node_chatbox -->|"sends message and history"| node_api
node_api -->|"POSTs chat request"| node_controller
node_controller -->|"returns reply"| node_api
node_api -->|"returns reply"| node_chatbox
node_chatbox -->|"renders conversation"| node_messages
node_lmservice -.->|"calls model"| node_lmstudio

click node_input "https://github.com/trang3205/ai-assistant/blob/main/frontend/src/components/MessageInput.jsx"
click node_chatbox "https://github.com/trang3205/ai-assistant/blob/main/frontend/src/components/ChatBox.jsx"
click node_messages "https://github.com/trang3205/ai-assistant/blob/main/frontend/src/components/MessageList.jsx"
click node_api "https://github.com/trang3205/ai-assistant/blob/main/frontend/src/api/chatApi.js"
click node_controller "https://github.com/trang3205/ai-assistant/blob/main/src/main/java/com/example/aiassistant/controller/ChatController.java"
click node_rag "https://github.com/trang3205/ai-assistant/blob/main/src/main/java/com/example/aiassistant/service/RagService.java"
click node_lmservice "https://github.com/trang3205/ai-assistant/blob/main/src/main/java/com/example/aiassistant/service/LmStudioService.java"
click node_documents "https://github.com/trang3205/ai-assistant/tree/main/data"

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_input,node_chatbox,node_messages,node_api,node_user toneBlue
class node_controller toneAmber
class node_rag,node_lmservice toneMint
class node_lmstudio toneIndigo
class node_documents toneTeal
```

## Components

### Chat interface

- [Message input](https://github.com/trang3205/ai-assistant/blob/main/frontend/src/components/MessageInput.jsx): `frontend/src/components/MessageInput.jsx`
- [Chat state](https://github.com/trang3205/ai-assistant/blob/main/frontend/src/components/ChatBox.jsx): `frontend/src/components/ChatBox.jsx`
- [Message display](https://github.com/trang3205/ai-assistant/blob/main/frontend/src/components/MessageList.jsx): `frontend/src/components/MessageList.jsx`
- [Chat API client](https://github.com/trang3205/ai-assistant/blob/main/frontend/src/api/chatApi.js): `frontend/src/api/chatApi.js`

### Chat backend

- [Chat endpoint](https://github.com/trang3205/ai-assistant/blob/main/src/main/java/com/example/aiassistant/controller/ChatController.java): `src/main/java/com/example/aiassistant/controller/ChatController.java`

### AI services

- [RAG service](https://github.com/trang3205/ai-assistant/blob/main/src/main/java/com/example/aiassistant/service/RagService.java): `src/main/java/com/example/aiassistant/service/RagService.java`
- [LM Studio service](https://github.com/trang3205/ai-assistant/blob/main/src/main/java/com/example/aiassistant/service/LmStudioService.java): `src/main/java/com/example/aiassistant/service/LmStudioService.java`

### Other components

- **User**
- **LM Studio**
- [Project documents](https://github.com/trang3205/ai-assistant/tree/main/data): `data`

## Connections

- User → Message input: enters message
- Message input → Chat state: sends text
- Chat state → Chat API client: sends message and history
- Chat API client → Chat endpoint: POSTs chat request
- Chat endpoint → Chat API client: returns reply
- Chat API client → Chat state: returns reply
- Chat state → Message display: renders conversation
- LM Studio service → LM Studio: calls model
