# k31ner/asistente-de-ficha-tecnica architecture

> Architecture diagram of the GitHub repository k31ner/asistente-de-ficha-tecnica, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/k31ner/asistente-de-ficha-tecnica
- Repository: https://github.com/k31ner/asistente-de-ficha-tecnica

## Overview

##### Main Components
- Frontend/UI:
- The HTML templates (found in the templates folder: index.html, form.html, chatbot.html) form the user interface.
- The static directory (with images and potentially CSS/JS files) serves the frontend assets.
- Backend/API Layer:
- The FastAPI application is likely initialized in main.py.
- chatbot.py and prompt.py appear to handle the chatbot interactions and prompt handling, encapsulating the business logic.
- Database / Data Store:
- The db directory contains a sqlite3 database (chroma.sqlite3) and additional binary files inside a subfolder (likely used for managing vector data or related assets for the LLM).
- LLM Integration:
- Although the specific LLM details are “por definir”, the chatbot and prompt modules suggest a dedicated module for integrating the LLM functionality.
- Configuration & Dependency Management:
- The requirements.txt file will list the Python package dependencies for FastAPI and other libraries.
- Version Control & Miscellaneous:
- The .gitignore is used for managing source control exclusions.

##### Understand Component Relationships and Data Flow
- Users interact with the system via a web browser that loads the frontend (templates and static assets).
- When a user engages with the chatbot or submits a query (through the form), the request is sent via HTTP to the FastAPI backend.
- The FastAPI endpoints (likely defined or routed in main.py and associated modules) handle the requests and delegate to:
- The chatbot.py module for LLM-driven interactions.
- The prompt.py module for preparing or managing prompts.
- The backend may query the local database in the db folder (using the sqlite3 database and binary vector data) to retrieve or store context data, which supports the LLM’s operation.
- Finally, after processing the information (possibly calling an external LLM service or internal module), the response is rendered back on the frontend.

## Diagram (Mermaid)

```mermaid
graph TD
    A["User Browser"]:::user

    subgraph "Frontend/UI"
        FE1["index.html"]:::frontend
        FE2["form.html"]:::frontend
        FE3["chatbot.html"]:::frontend
        FE4["Static Assets"]:::frontend
    end

    subgraph "API Backend"
        BE1["FastAPI Server (main.py)"]:::backend
        BE2["Chatbot (chatbot.py)"]:::backend
        BE3["Prompt (prompt.py)"]:::backend
        BE4["LLM Integration (por definir)"]:::llm
    end

    subgraph "Database/Vector Store"
        DB1["SQLite Database (chroma.sqlite3)"]:::database
        DB2["Vector Files (binary)"]:::database
    end

    subgraph "Configuration"
        CFG1["requirements.txt"]:::configuration
        CFG2[".gitignore"]:::configuration
    end

    A -->|"HTTP_Request"| FE1
    FE1 -->|"HTTP_Request/Response"| BE1
    BE1 -->|"Delegates"| BE2
    BE1 -->|"Delegates"| BE3
    BE2 -->|"Calls_LLM"| BE4
    BE3 -->|"Calls_LLM"| BE4
    BE1 -->|"DB_Query"| DB1
    DB1 -->|"DB_Response"| BE1

    click FE1 "https://github.com/k31ner/asistente-de-ficha-tecnica/blob/main/templates/index.html"
    click FE2 "https://github.com/k31ner/asistente-de-ficha-tecnica/blob/main/templates/form.html"
    click FE3 "https://github.com/k31ner/asistente-de-ficha-tecnica/blob/main/templates/chatbot.html"
    click FE4 "https://github.com/k31ner/asistente-de-ficha-tecnica/tree/main/static/"
    click BE1 "https://github.com/k31ner/asistente-de-ficha-tecnica/blob/main/main.py"
    click BE2 "https://github.com/k31ner/asistente-de-ficha-tecnica/blob/main/chatbot.py"
    click BE3 "https://github.com/k31ner/asistente-de-ficha-tecnica/blob/main/prompt.py"
    click DB1 "https://github.com/k31ner/asistente-de-ficha-tecnica/blob/main/db/chroma.sqlite3"
    click DB2 "https://github.com/k31ner/asistente-de-ficha-tecnica/tree/main/db/d533d9f2-c71b-4ed6-9701-32b958817249/"
    click CFG1 "https://github.com/k31ner/asistente-de-ficha-tecnica/blob/main/requirements.txt"
    click CFG2 "https://github.com/k31ner/asistente-de-ficha-tecnica/blob/main/.gitignore"

    classDef user fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef database fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef configuration fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef llm fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
