# 4rqum/its-chatbot architecture

> Architecture diagram of the GitHub repository 4rqum/its-chatbot, 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/4rqum/its-chatbot
- Repository: https://github.com/4rqum/its-chatbot

## Overview

ITS-Chatbot is a terminal-based assistant for diagnosing common IT problems through guided questions and step-by-step troubleshooting, with escalation guidance when appropriate. The principal flow runs from CLI input through normalization and intent matching, then question selection and a troubleshooting response. JSON files supply intent, question, synonym, and troubleshooting knowledge. Conversation memory supports follow-up answers and session resets. The excerpts establish the CLI, knowledge loader, NLP, matcher, and conversation logic; some chatbot implementation is omitted, so uncertain internal wiring is not shown.

Main entry points: [`src/chatbot.cpp`](https://github.com/4rqum/its-chatbot/blob/main/src/chatbot.cpp) (Chatbot), [`src/main.cpp`](https://github.com/4rqum/its-chatbot/blob/main/src/main.cpp) (CLI), [`src/knowledge_base.cpp`](https://github.com/4rqum/its-chatbot/blob/main/src/knowledge_base.cpp) (Knowledge loader), [`src/conversation_state.hpp`](https://github.com/4rqum/its-chatbot/blob/main/src/conversation_state.hpp) (Conversation state)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI interface"]
  node_cli["CLI<br/>[main.cpp]"]
end

subgraph group_conversation["Conversation flow"]
  node_chatbot["Chatbot<br/>[chatbot.cpp]"]
  node_session["Conversation state"]
  node_question_flow["Question selection<br/>[chatbot.cpp]"]
  node_answer_flow["Answer capture<br/>[chatbot.cpp]"]
  node_solution_flow["Troubleshooting response<br/>[chatbot.cpp]"]
end

subgraph group_understanding["Language matching"]
  node_nlp["Text normalization<br/>[nlp.cpp]"]
  node_matcher["Intent matcher<br/>[match.cpp]"]
end

subgraph group_knowledge["Knowledge content"]
  node_kb["Knowledge loader<br/>[knowledge_base.cpp]"]
  node_intents["Intent definitions<br/>[intents.json]"]
  node_synonyms["Synonym maps<br/>[synonyms.json]"]
  node_questions["Diagnostic questions<br/>[questions.json]"]
  node_troubleshooting["Troubleshooting flows"]
end

node_user(("User"))

node_user -->|"enters text"| node_cli
node_cli -->|"initializes"| node_chatbot
node_cli -->|"submits message"| node_chatbot
node_cli -->|"submits answer"| node_chatbot
node_cli -->|"resets session"| node_chatbot
node_chatbot -->|"normalizes text"| node_nlp
node_chatbot -->|"classifies tokens"| node_matcher
node_chatbot -->|"updates state"| node_session
node_chatbot -->|"selects questions"| node_question_flow
node_chatbot -->|"stores answers"| node_answer_flow
node_chatbot -->|"builds response"| node_solution_flow
node_cli -->|"displays response"| node_user
node_kb -->|"loads"| node_intents
node_kb -->|"loads"| node_synonyms
node_kb -->|"loads"| node_questions
node_kb -->|"loads"| node_troubleshooting
node_chatbot -->|"loads and reads"| node_kb

click node_cli "https://github.com/4rqum/its-chatbot/blob/main/src/main.cpp"
click node_chatbot "https://github.com/4rqum/its-chatbot/blob/main/src/chatbot.cpp"
click node_session "https://github.com/4rqum/its-chatbot/blob/main/src/conversation_state.hpp"
click node_question_flow "https://github.com/4rqum/its-chatbot/blob/main/src/chatbot.cpp"
click node_answer_flow "https://github.com/4rqum/its-chatbot/blob/main/src/chatbot.cpp"
click node_solution_flow "https://github.com/4rqum/its-chatbot/blob/main/src/chatbot.cpp"
click node_nlp "https://github.com/4rqum/its-chatbot/blob/main/src/nlp.cpp"
click node_matcher "https://github.com/4rqum/its-chatbot/blob/main/src/match.cpp"
click node_kb "https://github.com/4rqum/its-chatbot/blob/main/src/knowledge_base.cpp"
click node_intents "https://github.com/4rqum/its-chatbot/blob/main/data/intents.json"
click node_synonyms "https://github.com/4rqum/its-chatbot/blob/main/data/synonyms.json"
click node_questions "https://github.com/4rqum/its-chatbot/blob/main/data/questions.json"
click node_troubleshooting "https://github.com/4rqum/its-chatbot/blob/main/data/troubleshooting.json"

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_cli,node_user toneBlue
class node_chatbot,node_session,node_question_flow,node_answer_flow,node_solution_flow toneAmber
class node_nlp,node_matcher toneMint
class node_kb,node_intents,node_synonyms,node_questions,node_troubleshooting toneRose
```

## Components

### CLI interface

- [CLI](https://github.com/4rqum/its-chatbot/blob/main/src/main.cpp): `src/main.cpp`

### Conversation flow

- [Chatbot](https://github.com/4rqum/its-chatbot/blob/main/src/chatbot.cpp): `src/chatbot.cpp`
- [Conversation state](https://github.com/4rqum/its-chatbot/blob/main/src/conversation_state.hpp): `src/conversation_state.hpp`
- [Question selection](https://github.com/4rqum/its-chatbot/blob/main/src/chatbot.cpp): `src/chatbot.cpp`
- [Answer capture](https://github.com/4rqum/its-chatbot/blob/main/src/chatbot.cpp): `src/chatbot.cpp`
- [Troubleshooting response](https://github.com/4rqum/its-chatbot/blob/main/src/chatbot.cpp): `src/chatbot.cpp`

### Language matching

- [Text normalization](https://github.com/4rqum/its-chatbot/blob/main/src/nlp.cpp): `src/nlp.cpp`
- [Intent matcher](https://github.com/4rqum/its-chatbot/blob/main/src/match.cpp): `src/match.cpp`

### Knowledge content

- [Knowledge loader](https://github.com/4rqum/its-chatbot/blob/main/src/knowledge_base.cpp): `src/knowledge_base.cpp`
- [Intent definitions](https://github.com/4rqum/its-chatbot/blob/main/data/intents.json): `data/intents.json`
- [Synonym maps](https://github.com/4rqum/its-chatbot/blob/main/data/synonyms.json): `data/synonyms.json`
- [Diagnostic questions](https://github.com/4rqum/its-chatbot/blob/main/data/questions.json): `data/questions.json`
- [Troubleshooting flows](https://github.com/4rqum/its-chatbot/blob/main/data/troubleshooting.json): `data/troubleshooting.json`

### Other components

- **User**

## Connections

- User → CLI: enters text
- CLI → Chatbot: initializes
- CLI → Chatbot: submits message
- CLI → Chatbot: submits answer
- CLI → Chatbot: resets session
- Chatbot → Text normalization: normalizes text
- Chatbot → Intent matcher: classifies tokens
- Chatbot → Conversation state: updates state
- Chatbot → Question selection: selects questions
- Chatbot → Answer capture: stores answers
- Chatbot → Troubleshooting response: builds response
- CLI → User: displays response
- Knowledge loader → Intent definitions: loads
- Knowledge loader → Synonym maps: loads
- Knowledge loader → Diagnostic questions: loads
- Knowledge loader → Troubleshooting flows: loads
- Chatbot → Knowledge loader: loads and reads
