# dawidnolove/app-chat-cli architecture

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

- Interactive diagram: https://gitdiagram.com/dawidnolove/app-chat-cli
- Repository: https://github.com/dawidnolove/app-chat-cli

## Overview

This is a Python chat application: a user submits text to a Flask endpoint, which delegates to the chat orchestrator. The orchestrator corrects the text, classifies its intent, and generates a response; weather requests additionally query an external weather service and translate its condition. The README describes classification as TF-IDF plus a linear SVM, while the sampled classifier loads a serialized model. The graph reflects that documented model description; other unsampled model internals are not inferred.

Main entry points: [`main.py`](https://github.com/dawidnolove/app-chat-cli/blob/main/main.py) (Chat orchestrator), [`server.py`](https://github.com/dawidnolove/app-chat-cli/blob/main/server.py) (Flask chat API), [`weather.py`](https://github.com/dawidnolove/app-chat-cli/blob/main/weather.py) (Weather lookup), [`error_correction.py`](https://github.com/dawidnolove/app-chat-cli/blob/main/error_correction.py) (Text correction)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Chat interface"]
  node_server["Flask chat API<br/>[server.py]"]
  node_orchestrator["Chat orchestrator<br/>[main.py]"]
end

subgraph group_processing["Text processing"]
  node_correction["Text correction"]
  node_correction_words["Correction vocabulary"]
  node_classifier["TF-IDF SVM classifier"]
  node_model["Serialized model<br/>[model.pkl]"]
end

subgraph group_responses["Response generation"]
  node_answer_generator["Intent responses"]
end

subgraph group_weather["Weather integration"]
  node_weather_lookup["Weather lookup<br/>[weather.py]"]
  node_weather_translation["Condition translations<br/>[weather_dict.py]"]
end

node_user(("Chat user"))
node_weather_service["WeatherAPI"]

node_user -->|"submits text"| node_server
node_server -->|"calls"| node_orchestrator
node_orchestrator -->|"corrects text"| node_correction
node_correction -->|"matches against"| node_correction_words
node_orchestrator -->|"classifies text"| node_classifier
node_classifier -->|"loads"| node_model
node_orchestrator -->|"generates answer"| node_answer_generator
node_answer_generator -->|"requests weather"| node_weather_lookup
node_weather_lookup -->|"queries"| node_weather_service
node_weather_lookup -->|"translates condition"| node_weather_translation
node_server -->|"returns result"| node_user

click node_server "https://github.com/dawidnolove/app-chat-cli/blob/main/server.py"
click node_orchestrator "https://github.com/dawidnolove/app-chat-cli/blob/main/main.py"
click node_correction "https://github.com/dawidnolove/app-chat-cli/blob/main/error_correction.py"
click node_correction_words "https://github.com/dawidnolove/app-chat-cli/blob/main/error_correction_dict.py"
click node_classifier "https://github.com/dawidnolove/app-chat-cli/blob/main/text_classification.py"
click node_model "https://github.com/dawidnolove/app-chat-cli/blob/main/model.pkl"
click node_answer_generator "https://github.com/dawidnolove/app-chat-cli/blob/main/response_generator.py"
click node_weather_lookup "https://github.com/dawidnolove/app-chat-cli/blob/main/weather.py"
click node_weather_translation "https://github.com/dawidnolove/app-chat-cli/blob/main/weather_dict.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_server,node_orchestrator,node_user toneBlue
class node_correction,node_correction_words,node_classifier,node_model toneAmber
class node_answer_generator,node_weather_service toneMint
class node_weather_lookup,node_weather_translation toneRose
```

## Components

### Chat interface

- [Flask chat API](https://github.com/dawidnolove/app-chat-cli/blob/main/server.py): `server.py`
- [Chat orchestrator](https://github.com/dawidnolove/app-chat-cli/blob/main/main.py): `main.py`

### Text processing

- [Text correction](https://github.com/dawidnolove/app-chat-cli/blob/main/error_correction.py): `error_correction.py`
- [Correction vocabulary](https://github.com/dawidnolove/app-chat-cli/blob/main/error_correction_dict.py): `error_correction_dict.py`
- [TF-IDF SVM classifier](https://github.com/dawidnolove/app-chat-cli/blob/main/text_classification.py): `text_classification.py`
- [Serialized model](https://github.com/dawidnolove/app-chat-cli/blob/main/model.pkl): `model.pkl`

### Response generation

- [Intent responses](https://github.com/dawidnolove/app-chat-cli/blob/main/response_generator.py): `response_generator.py`

### Weather integration

- [Weather lookup](https://github.com/dawidnolove/app-chat-cli/blob/main/weather.py): `weather.py`
- [Condition translations](https://github.com/dawidnolove/app-chat-cli/blob/main/weather_dict.py): `weather_dict.py`

### Other components

- **Chat user**
- **WeatherAPI**

## Connections

- Chat user → Flask chat API: submits text
- Flask chat API → Chat orchestrator: calls
- Chat orchestrator → Text correction: corrects text
- Text correction → Correction vocabulary: matches against
- Chat orchestrator → TF-IDF SVM classifier: classifies text
- TF-IDF SVM classifier → Serialized model: loads
- Chat orchestrator → Intent responses: generates answer
- Intent responses → Weather lookup: requests weather
- Weather lookup → WeatherAPI: queries
- Weather lookup → Condition translations: translates condition
- Flask chat API → Chat user: returns result
