# etw-bank/ririsagentfrontend architecture

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

- Interactive diagram: https://gitdiagram.com/etw-bank/ririsagentfrontend
- Repository: https://github.com/etw-bank/ririsagentfrontend

## Overview

StudentAssist is a React chat frontend for asking questions about uploaded study documents. A user starts or selects a session conversation, chooses an optional subject and document ID, and sends a question; App manages session state and calls the API client, which returns an answer and citations for display. The interface also exposes retry, conversation history, and document/subject selection. The API client includes an upload helper, but the README says document upload is not part of this chat interface. Conversation history is memory-only. The map follows the shown source and README; it does not infer unsampled behavior.

Main entry points: [`src/App.tsx`](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/App.tsx) (Session coordinator), [`src/components/ChatWindow.tsx`](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/components/ChatWindow.tsx) (Chat workspace), [`src/types/chat.ts`](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/types/chat.ts) (Conversation types), [`src/services/studentAssistApi.ts`](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/services/studentAssistApi.ts) (StudentAssist API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application state"]
  node_entry["React entry<br/>[main.tsx]"]
  node_appstate["Session coordinator<br/>[App.tsx]"]
end

subgraph group_interface["Chat interface"]
  node_sidebar["Conversation history"]
  node_chatwindow["Chat workspace<br/>[ChatWindow.tsx]"]
  node_documents["Document selector"]
  node_subjects["Subject selector"]
  node_messages["Message display<br/>[MessageBubble.tsx]"]
end

subgraph group_client["API client"]
  node_api["StudentAssist API client"]
end

subgraph group_domain["Chat data"]
  node_chattypes["Conversation types<br/>[chat.ts]"]
end

node_user(("Student"))
node_browser(("Browser UI"))
node_backend["StudentAssist API"]

node_browser -->|"opens"| node_entry
node_entry -->|"renders"| node_appstate
node_user -->|"interacts"| node_appstate
node_appstate -->|"renders"| node_sidebar
node_appstate -->|"renders"| node_chatwindow
node_chatwindow -->|"renders"| node_documents
node_chatwindow -->|"renders"| node_subjects
node_chatwindow -->|"renders"| node_messages
node_chatwindow -->|"sends choices"| node_appstate
node_appstate -->|"requests chat"| node_api
node_api -->|"posts chat"| node_backend
node_backend -->|"returns answer"| node_api
node_appstate -->|"uses models"| node_chattypes
node_chatwindow -->|"uses models"| node_chattypes
node_sidebar -->|"uses models"| node_chattypes
node_messages -->|"uses models"| node_chattypes

click node_entry "https://github.com/etw-bank/ririsagentfrontend/blob/main/src/main.tsx"
click node_appstate "https://github.com/etw-bank/ririsagentfrontend/blob/main/src/App.tsx"
click node_sidebar "https://github.com/etw-bank/ririsagentfrontend/blob/main/src/components/ConversationSidebar.tsx"
click node_chatwindow "https://github.com/etw-bank/ririsagentfrontend/blob/main/src/components/ChatWindow.tsx"
click node_documents "https://github.com/etw-bank/ririsagentfrontend/blob/main/src/components/DocumentSelector.tsx"
click node_subjects "https://github.com/etw-bank/ririsagentfrontend/blob/main/src/components/SubjectSelector.tsx"
click node_messages "https://github.com/etw-bank/ririsagentfrontend/blob/main/src/components/MessageBubble.tsx"
click node_api "https://github.com/etw-bank/ririsagentfrontend/blob/main/src/services/studentAssistApi.ts"
click node_chattypes "https://github.com/etw-bank/ririsagentfrontend/blob/main/src/types/chat.ts"

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_entry,node_appstate,node_browser toneBlue
class node_sidebar,node_chatwindow,node_documents,node_subjects,node_messages toneAmber
class node_api,node_backend toneMint
class node_chattypes toneRose
class node_user toneIndigo
```

## Components

### Application state

- [React entry](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/main.tsx): `src/main.tsx`
- [Session coordinator](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/App.tsx): `src/App.tsx`

### Chat interface

- [Conversation history](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/components/ConversationSidebar.tsx): `src/components/ConversationSidebar.tsx`
- [Chat workspace](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/components/ChatWindow.tsx): `src/components/ChatWindow.tsx`
- [Document selector](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/components/DocumentSelector.tsx): `src/components/DocumentSelector.tsx`
- [Subject selector](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/components/SubjectSelector.tsx): `src/components/SubjectSelector.tsx`
- [Message display](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/components/MessageBubble.tsx): `src/components/MessageBubble.tsx`

### API client

- [StudentAssist API client](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/services/studentAssistApi.ts): `src/services/studentAssistApi.ts`

### Chat data

- [Conversation types](https://github.com/etw-bank/ririsagentfrontend/blob/main/src/types/chat.ts): `src/types/chat.ts`

### Other components

- **Student**
- **Browser UI**
- **StudentAssist API**

## Connections

- Browser UI → React entry: opens (evidence: `src/main.tsx`)
- React entry → Session coordinator: renders (evidence: `src/main.tsx`)
- Student → Session coordinator: interacts (evidence: `src/App.tsx`)
- Session coordinator → Conversation history: renders (evidence: `src/App.tsx`)
- Session coordinator → Chat workspace: renders (evidence: `src/App.tsx`)
- Chat workspace → Document selector: renders (evidence: `src/components/ChatWindow.tsx`)
- Chat workspace → Subject selector: renders (evidence: `src/components/ChatWindow.tsx`)
- Chat workspace → Message display: renders (evidence: `src/components/ChatWindow.tsx`)
- Chat workspace → Session coordinator: sends choices (evidence: `src/App.tsx`)
- Session coordinator → StudentAssist API client: requests chat (evidence: `src/App.tsx`)
- StudentAssist API client → StudentAssist API: posts chat (evidence: `src/services/studentAssistApi.ts`)
- StudentAssist API → StudentAssist API client: returns answer (evidence: `README.md`)
- Session coordinator → Conversation types: uses models (evidence: `src/App.tsx`)
- Chat workspace → Conversation types: uses models (evidence: `src/components/ChatWindow.tsx`)
- Conversation history → Conversation types: uses models (evidence: `src/components/ConversationSidebar.tsx`)
- Message display → Conversation types: uses models (evidence: `src/components/MessageBubble.tsx`)
