trading-platform/docs/02-definicion-modulos/OQI-007-llm-agent/historias-usuario/US-LLM-001-enviar-mensaje.md
rckrdmrd c1b5081208 feat(ml): Complete FASE 11 - BTCUSD update and comprehensive documentation alignment
ML Engine Updates:
- Updated BTCUSD with Polygon API data (2024-2025): 215,699 new records
- Re-trained all ML models: Attention (R²: 0.223), Base, Metamodel (87.3% confidence)
- Backtest results: +176.71R profit with aggressive_filter strategy

Documentation Consolidation:
- Created docs/99-analisis/_MAP.md index with 13 new analysis documents
- Consolidated inventories: removed duplicates from orchestration/inventarios/
- Updated ML_INVENTORY.yml with BTCUSD metrics and training results
- Added execution reports: FASE11-BTCUSD, correction issues, alignment validation

Architecture & Integration:
- Updated all module documentation with NEXUS v3.4 frontmatter
- Fixed _MAP.md indexes across all folders
- Updated orchestration plans and traces

Files: 229 changed, 5064 insertions(+), 1872 deletions(-)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 09:31:29 -06:00

149 lines
5.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

---
id: "US-LLM-001"
title: "Enviar Mensaje al Copilot"
type: "User Story"
status: "Done"
priority: "Media"
epic: "OQI-007"
project: "trading-platform"
story_points: 3
created_date: "2025-12-05"
updated_date: "2026-01-04"
---
# US-LLM-001: Enviar Mensaje al Copilot
**Épica:** OQI-007 - LLM Strategy Agent
**Sprint:** TBD
**Story Points:** 5
**Prioridad:** P0 - Crítico
---
## Historia de Usuario
**Como** usuario autenticado de Trading Platform
**Quiero** poder enviar mensajes al Copilot de trading
**Para** recibir análisis, recomendaciones y asistencia personalizada
---
## Criterios de Aceptación
### AC-1: Envío básico de mensaje
```gherkin
Given estoy autenticado en la plataforma
And estoy en la página del Copilot
When escribo un mensaje en el campo de texto
And presiono Enter o el botón "Enviar"
Then mi mensaje aparece en el chat
And veo un indicador de "Pensando..."
And recibo una respuesta del agente
```
### AC-2: Streaming de respuesta
```gherkin
Given envié un mensaje al Copilot
When el agente comienza a responder
Then veo las palabras aparecer progresivamente
And el texto se va completando en tiempo real
And al finalizar el mensaje queda completo
```
### AC-3: Validación de mensaje vacío
```gherkin
Given estoy en el campo de mensaje
When intento enviar un mensaje vacío
Then el mensaje no se envía
And el botón de enviar está deshabilitado
```
### AC-4: Límite de caracteres por plan
```gherkin
Given soy usuario con plan <plan>
When escribo un mensaje
Then veo un contador de caracteres
And el límite es <limite> caracteres
And no puedo escribir más del límite
Examples:
| plan | limite |
| Free | 500 |
| Pro | 2000 |
| Premium | 4000 |
```
### AC-5: Cancelar respuesta en progreso
```gherkin
Given el agente está generando una respuesta
And veo el indicador de streaming
When hago clic en el botón "Cancelar"
Then la generación se detiene
And veo el mensaje parcial generado
And puedo enviar un nuevo mensaje
```
---
## Diseño UI/UX
### Wireframe
```
┌─────────────────────────────────────────────────────────────┐
│ Trading Platform Copilot [+] [⚙️] [×] │
├─────────────────────────────────────────────────────────────┤
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ 🤖 ¡Hola! Soy tu asistente de trading. ¿En qué │ │
│ │ puedo ayudarte? │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ 👤 ¿Cuál es tu análisis de AAPL? │ │
│ └─────────────────────────────────────────────────┘ │
│ │
│ ┌─────────────────────────────────────────────────────┐ │
│ │ 🤖 Analizando AAPL... │ │
│ │ ████████████░░░░░░░░ 60% │ │
│ │ [Cancelar] │ │
│ └─────────────────────────────────────────────────────┘ │
│ │
├─────────────────────────────────────────────────────────────┤
│ │ Escribe tu mensaje... │ 45/500 │ [Enviar] │ │
└─────────────────────────────────────────────────────────────┘
```
---
## Notas Técnicas
- WebSocket para comunicación bidireccional
- Implementar debounce en input (500ms)
- Guardar mensaje en DB antes de enviar a LLM
- Timeout de respuesta: 60 segundos
- Reconexión automática de WebSocket
---
## Dependencias
- RF-LLM-001.1: Envío de Mensajes
- RF-LLM-001.2: Streaming de Respuestas
- ET-LLM-001: Arquitectura del Chat
---
## Definición de Done
- [ ] Código implementado y revisado
- [ ] Tests unitarios (>80% coverage)
- [ ] Tests E2E para flujo completo
- [ ] Documentación actualizada
- [ ] QA aprobado
- [ ] Desplegado en staging
---
*Historia de usuario - Sistema NEXUS*
*Trading Platform*