# vincenttd1402/chatbot---literature architecture

> Architecture diagram of the GitHub repository vincenttd1402/chatbot---literature, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vincenttd1402/chatbot---literature
- Repository: https://github.com/vincenttd1402/chatbot---literature

## Overview

a. Data Flow
- User Input → Speech-to-Text → NLP Engine
- NLP Engine → Vector Database/External Search
- Response Generation → Text-to-Speech → User Output

b. System Integration
- Connections between core processing components
- Data transformation flow
- API endpoints and service boundaries

##### Technical Stack Indicators

- Python 3.10 as base runtime
- Flask for web framework
- Chroma DB for vector storage
- Speech recognition services
- Text-to-Speech services

##### The modular architecture allowing for
- Independent speech processing
- Separate search mechanisms
- Flexible storage solutions

##### The pipeline flow from
- Input processing
- Query understanding
- Knowledge retrieval
- Response generation
- Output synthesis

##### The integration points between
- Voice and text processing
- Search and retrieval systems
- Storage and query systems

Keep the abstraction level focused on the major components while showing the key interactions that make this literary chatbot unique, especially its voice capabilities and multiple search mechanisms.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef ui fill:#e1f5fe,stroke:#01579b
    classDef core fill:#f3e5f5,stroke:#4a148c
    classDef storage fill:#e8f5e9,stroke:#1b5e20
    classDef knowledge fill:#fff3e0,stroke:#e65100
    classDef config fill:#f5f5f5,stroke:#212121

    %% User Interface Layer
    subgraph UI
        WebApp["Flask Web Application"]:::ui
        Templates["Template System"]:::ui
    end
    click WebApp "https://github.com/VincentTD1402/Chatbot---Literature/blob/main/app.py"
    click Templates "https://github.com/VincentTD1402/Chatbot---Literature/tree/main//templates"

    %% Core Processing Layer
    subgraph CoreProcessing
        STT["Speech-to-Text Module"]:::core
        TTS["Text-to-Speech Module"]:::core
        NLP["NLP Engine"]:::core
    end
    click STT "https://github.com/VincentTD1402/Chatbot---Literature/blob/main/audio.wav"
    click TTS "https://github.com/VincentTD1402/Chatbot---Literature/blob/main/output.mp3"
    click NLP "https://github.com/VincentTD1402/Chatbot---Literature/blob/main/model.py"

    %% Knowledge Base Layer
    subgraph KnowledgeBase
        VectorDB["Chroma Vector Database"]:::knowledge
        EmbeddingSearch["Embedding Search System"]:::knowledge
        ExternalSearch["External Search System"]:::knowledge
        WebCrawler["Web Crawler"]:::knowledge
        QueryProcessor["User Query Processor"]:::knowledge
    end
    click VectorDB "https://github.com/VincentTD1402/Chatbot---Literature/tree/main//vanhoc_db"
    click EmbeddingSearch "https://github.com/VincentTD1402/Chatbot---Literature/tree/main//embedding_search"
    click ExternalSearch "https://github.com/VincentTD1402/Chatbot---Literature/tree/main//external_search"
    click WebCrawler "https://github.com/VincentTD1402/Chatbot---Literature/blob/main//external_search/web_crawler.py"
    click QueryProcessor "https://github.com/VincentTD1402/Chatbot---Literature/blob/main//external_search/user_query.py"

    %% Data Storage Layer
    subgraph DataStorage
        LitData["Literature Dataset"]:::storage
        TempStorage["Temporary Storage"]:::storage
        Config["Configuration Files"]:::config
        DBCreation["Database Creation"]:::storage
    end
    click LitData "https://github.com/VincentTD1402/Chatbot---Literature/tree/main//collections"
    click TempStorage "https://github.com/VincentTD1402/Chatbot---Literature/tree/main//temp"
    click Config "https://github.com/VincentTD1402/Chatbot---Literature/blob/main/config.py"
    click DBCreation "https://github.com/VincentTD1402/Chatbot---Literature/blob/main/create_chroma_db.py"

    %% Relationships
    WebApp --> STT
    WebApp --> TTS
    STT --> NLP
    NLP --> VectorDB
    NLP --> EmbeddingSearch
    NLP --> ExternalSearch
    ExternalSearch --> WebCrawler
    ExternalSearch --> QueryProcessor
    VectorDB --> DBCreation
    LitData --> DBCreation
    NLP --> TTS
    TTS --> WebApp
    Config -.-> WebApp
    Templates -.-> WebApp

    %% Legend
    subgraph Legend
        UI_L["UI Components"]:::ui
        Core_L["Core Processing"]:::core
        Knowledge_L["Knowledge Base"]:::knowledge
        Storage_L["Storage Systems"]:::storage
        Config_L["Configuration"]:::config
    end
```
