40 lines
1.4 KiB
Markdown
40 lines
1.4 KiB
Markdown
```mermaid
|
|
sequenceDiagram
|
|
participant U as Usuario (App/WA)
|
|
participant O as Orquestador (Spring Boot)
|
|
participant DLP as Cloud DLP
|
|
participant DB as Caché (Redis/Firestore)
|
|
participant LLM as Vertex AI (Gemini)
|
|
participant DFCX as Dialogflow CX Agent
|
|
|
|
U->>O: POST /api/v1/dialogflow/detect-intent
|
|
|
|
Note over O: Capa de Seguridad (PII)
|
|
O->>DLP: Ofusca mensaje (Ej: Reemplaza Tarjeta por ****)
|
|
DLP-->>O: Mensaje seguro
|
|
|
|
O->>DB: Busca sesión activa por teléfono
|
|
|
|
Note over O: Clasificación de Intención (Routing)
|
|
O->>LLM: ¿Es seguimiento a notificación o conversación? (MessageEntryFilter)
|
|
LLM-->>O: Resultado: "CONVERSATION"
|
|
|
|
alt Sesión > 30 minutos (Context Injection)
|
|
O->>DB: Recupera historial de Firestore (Largo Plazo)
|
|
Note over O: Trunca historial (60 msgs / 50KB)
|
|
O->>O: Inyecta historial en parámetro 'conversation_history'
|
|
else Sesión Reciente
|
|
O->>DB: Usa contexto de Redis (Corto Plazo)
|
|
end
|
|
|
|
O->>DFCX: Envia DetectIntentRequest (Texto + Parámetros)
|
|
|
|
Note over DFCX: El Agente (Beto) procesa RAG/Playbook
|
|
DFCX-->>O: Devuelve QueryResult (Respuesta + Parámetros)
|
|
|
|
Note over O: Persistencia Write-Back
|
|
O->>DB: Guarda mensaje en Redis (Síncrono)
|
|
O-->>DB: Guarda en Firestore (Asíncrono/Background)
|
|
|
|
O-->>U: Respuesta final (JSON con texto amigable)
|
|
``` |