Arquitectura, componentes y flujo lógico de
Vicente el Agente Presuntamente Inteligente
graph TD
%% Componentes Principales
User((Usuario))
subgraph Frontend ["Frontend (HTML5/JS/CSS) Port: 8000"]
UI[Interfaz de Usuario]
Mic[Captura de Micrófono]
AudioPlayer[Reproductor de Audio]
SSE_Rec[Receptor de Eventos SSE]
end
subgraph Backend ["Proxy Central (Node.js / Express) Port: 3000"]
Orchestrator[Orquestador de Diálogo]
ToolManager[Gestor de Herramientas]
Persistence[Persistencia de Perfiles]
TTS_Buffer[Gestor de Fragmentos TTS]
end
subgraph Service_STT ["Servicio STT (Python / FastAPI) Port: 5001"]
FasterWhisper[Faster-Whisper]
FFmpeg[Procesado de Audio]
end
subgraph Service_LLM ["LM Studio (Inferencia) Port: 1234"]
Gemma4[Gemma 4 26b A4B]
end
subgraph Service_TTS ["Piper TTS (HTTP Server) Port: 7860"]
Piper[Sintetizador de Voz]
end
subgraph External_APIs ["Herramientas Externas"]
Brave[Brave Search API]
Weather[OpenWeather API]
Jina[Readability / Jina.ai]
FileSystem[Sandbox File System]
end
%% Flujo 1: Voz a Texto
User -- "Habla" --> Mic
Mic -- "Audio (WebSocket)" --> Service_STT
FasterWhisper -- "Texto Parcial/Final" --> UI
%% Flujo 2: Petición al Orquestador
UI -- "Prompt de Texto" --> Orchestrator
%% Flujo 3: Inteligencia y Herramientas
Orchestrator -- "Contexto + Historial" --> Service_LLM
Gemma4 -- "Razonamiento / Tool Call" --> Orchestrator
Orchestrator -- "Ejecutar" --> ToolManager
ToolManager -.-> External_APIs
External_APIs -.-> ToolManager
ToolManager -- "Resultados" --> Orchestrator
%% Flujo 4: Respuesta Streaming y Voz
Gemma4 -- "Tokens (Stream)" --> Orchestrator
Orchestrator -- "Texto (SSE)" --> SSE_Rec
SSE_Rec -- "Renderizado" --> UI
Orchestrator -- "Oraciones completas" --> TTS_Buffer
TTS_Buffer -- "Texto Limpio" --> Piper
Piper -- "Audio Bytes" --> TTS_Buffer
TTS_Buffer -- "Audio Snippets (SSE)" --> SSE_Rec
SSE_Rec -- "Reproducción" --> AudioPlayer
AudioPlayer -- "Voz" --> User
%% Estilos
style Backend fill:#f9f,stroke:#333,stroke-width:2px
style Frontend fill:#bbf,stroke:#333,stroke-width:2px
style Service_LLM fill:#bfb,stroke:#333,stroke-width:2px
style Service_TTS fill:#fbb,stroke:#333,stroke-width:2px
style Service_STT fill:#fdb,stroke:#333,stroke-width:2px
Componentes y su función
-
Frontend (UI):
Es la cara visible del agente. Se encarga de capturar tu voz, gestionar la conexión
WebSocket con el servicio STT y recibir el flujo de datos SSE (Server-Sent Events) del Proxy. Procesa Markdown y LaTeX en tiempo real para que las respuestas se vean perfectas.
-
STT Service (Faster-Whisper):
Un servidor de alta velocidad que transforma tus ondas sonoras en texto. Utiliza FFmpeg para normalizar el audio y el modelo Faster-Whisper en tu GPU (CUDA) para darte feedback casi al instante.
-
Proxy Central (Node.js):
Es el cerebro táctico. No solo pasa mensajes, sino que:
- Gestiona tu historial de chat y perfiles.
- Limpia el texto de "pensamientos internos" del modelo.
- Fragmenta la respuesta en oraciones lógicas para la síntesis temprana.
-
LM Studio (Gemma 4):
El motor de inferencia local. El LLM decide cómo responder y si necesita usar herramientas.
-
Piper TTS:
Sintetizador de voz local extremadamente rápido. Permite que el sistema "hable" mientras aún se está generando el texto.
-
Toolbox (Herramientas):
Habilidades "invocables": acceso a sistema de archivos (sandbox), búsquedas en internet, cálculos matemáticos y consultas meteorológicas.