# david15barrera/ia1_proyecto_14 architecture

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

- Interactive diagram: https://gitdiagram.com/david15barrera/ia1_proyecto_14
- Repository: https://github.com/david15barrera/ia1_proyecto_14

## Overview

##### Main Components
- Chatbot Core Engine: This is where the chatbot logic lives. It includes files related to model training and prediction (e.g., chatbot_model.h5, train_chatbot.py, chat.py, and related data like classes.pkl, words.pkl, faqdata.json/faqdataEn.json). Also, shared modules under directories like “src/models” and files in “appEscritorio” contribute to this core.
- Desktop/CLI Application: Located in “app-desktop” and “appEscritorio,” these components handle a standalone Python-based interface. They may include a GUI (references to gui.py) and command-line entry points. The setup.py and entry_points in the egg-info directory hint that this package can be installed and run as a console command (chatbot).
- Web Application: Under “app-web”, you have a modern frontend stack likely built with React (files like App.jsx, Chat.jsx, Header.jsx, Sidebar.jsx) and configuration files (e.g., vite.config.js, tailwind.config.js). This interface is responsible for presenting the chatbot through a browser, handling user interactions, and submitting queries to the chatbot engine.
- Configuration & Packaging: Files like setup.py, requirements.txt, and the egg-info directory indicate that the project is packaged for installation. The README instructions further describe virtual environments and dependency management.

##### Relationships and Interactions
- Deployment & Packaging: Although not central to daily functionality, the packaging workflow (setup.py, dist, entry_points) can be represented as an ancillary component that shows how the project is built and installed (thus facilitating the “chatbot” command availability).

##### Architectural Patterns and Design Principles
- Extensibility via Package Installation: The entry_points configuration in setup.py is critical for enabling command-line invocation. This ensures that the chatbot can be easily launched once installed.

##### Additional Details
- Packaging life cycle by showing how the setup.py and egg-info are used to generate the installable package (leading to installation via pip and making the “chatbot” command available).
- On potential integration points: if the system later supports API-based communication between the web interface and backend, this can be anticipated by drawing an “API layer” between the Chatbot Core and the Web Front-End.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Packaging & Deployment
    subgraph "Configuration & Packaging"
        Pack("Packaging & Deployment"):::pack
    end

    %% Chatbot Core Engine
    subgraph "Chatbot Core Engine"
        Engine("Chatbot Core Engine"):::core
        subgraph "Engine Details"
            Train("train_chatbot.py"):::core
            Chat("chat.py"):::core
            Data("Model & Data Resources (chatbot_model.h5, classes.pkl, words.pkl, faqdata.json, faqdataEn.json)"):::data
            Shared("Shared Modules (faqData.js)"):::core
        end
        Engine --> Train
        Engine --> Chat
        Engine --> Data
        Engine --> Shared
    end

    %% Desktop/CLI Interface
    subgraph "Desktop/CLI Interface"
        DesktopMain("Desktop App Scripts (main.py)"):::desktop
        DesktopGUI("GUI Component (gui.py)"):::desktop
    end

    %% Web Front-End
    subgraph "Web Front-End"
        WebCore("Web Front-End Core (index.html, App.jsx, main.jsx)"):::web
        WebComponents("Web Components (Chat.jsx, Header.jsx, Sidebar.jsx)"):::web
        WebConfig("Web Configs & Models (vite.config.js, tailwind.config.js, faqData.js, textModel.js)"):::web
    end

    %% Connections
    Pack --> Engine
    DesktopMain -->|"calls"| Engine
    DesktopGUI -->|"calls"| Engine
    WebCore -->|"queries"| Engine
    WebComponents -->|"queries"| Engine
    WebConfig -->|"queries"| Engine

    %% Click Events for Chatbot Core Engine
    click Train "https://github.com/david15barrera/ia1_proyecto_14/blob/main/appEscritorio/train_chatbot.py"
    click Chat "https://github.com/david15barrera/ia1_proyecto_14/blob/main/appEscritorio/chat.py"
    click Data "https://github.com/david15barrera/ia1_proyecto_14/blob/main/appEscritorio/chatbot_model.h5"
    click Shared "https://github.com/david15barrera/ia1_proyecto_14/blob/main/src/models/faqData.js"

    %% Click Events for Desktop/CLI Interface
    click DesktopMain "https://github.com/david15barrera/ia1_proyecto_14/blob/main/app-desktop/main.py"
    click DesktopGUI "https://github.com/david15barrera/ia1_proyecto_14/blob/main/appEscritorio/gui.py"

    %% Click Events for Web Front-End
    click WebCore "https://github.com/david15barrera/ia1_proyecto_14/blob/main/app-web/index.html"
    click WebComponents "https://github.com/david15barrera/ia1_proyecto_14/blob/main/app-web/src/components/Chat.jsx"
    click WebConfig "https://github.com/david15barrera/ia1_proyecto_14/blob/main/app-web/vite.config.js"

    %% Click Event for Packaging & Deployment
    click Pack "https://github.com/david15barrera/ia1_proyecto_14/blob/main/appEscritorio/setup.py"

    %% Styles
    classDef core fill:#ffefd5,stroke:#ff8c00,stroke-width:2px;
    classDef data fill:#ffe4b5,stroke:#cd853f,stroke-width:2px;
    classDef desktop fill:#d0f0c0,stroke:#3cb371,stroke-width:2px;
    classDef web fill:#add8e6,stroke:#1e90ff,stroke-width:2px;
    classDef pack fill:#e6e6fa,stroke:#9370db,stroke-width:2px;
```
