iachat/enterprise/app/services/captain/llm
Rodribm10 cfffea9c16 feat(captain): semantic memory fixes + roleta + reclamações + analytics
Consolida o trabalho desta branch de abril/2026 em um bloco pronto pra
testar em staging antes do merge pra main.

## Correções de memória semântica
- ExtractionService: Princípio Zero + Regra de Ouro (ação consumada vs intenção).
- Cenário Daniela_Reservas: Passo 0 de classificação (consulta/intenção/fora).

## Roleta da Sorte (end-to-end)
- Schema Supabase + 7 RPCs atômicas (server-side, idempotentes).
- Services: Offer, Redeem, WeeklyReport.
- Jobs: OfferRouletteJob (hook em ConfirmationService após Pix pago),
  NotifyRevealed + Scheduler de fallback.
- Tool manual GenerateRoletaLinkTool + endpoint público /roleta/notify.
- Dashboard /captain/roleta com Resgate + Relatório + anomaly detection.

## Cenário Reclamacoes_Ouvidoria
- Triagem P1-P4, framework LAST, Three-level listening, Self-check.
- Sem compensação material, detecção de cliente frustrado eleva prioridade.

## Analytics
- Funil de conversão /captain/funnel: 5 etapas via regex, zero LLM.
- Detector de churn via ChurnOutreach* (cron dias úteis 10h-17h BRT).

## Trabalho pré-existente incluído
- Captain Executive Reports (ceo_digest, mattermost_delivery).
- get_reserva_preco_tool, Lifecycle ajustes, Reservations UI polimentos.

## Outros
- .gitignore: patterns pra credenciais.
- Migrations de scenarios idempotentes.
- i18n completa pt_BR+en pra roleta/funnel.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-21 15:36:25 -03:00
..
assistant_chat_service.rb feat: Migrate ruby llm captain (#12981) 2025-12-04 18:26:10 +05:30
contact_attributes_service.rb feat: legacy features to ruby llm (#12994) 2025-12-11 14:17:28 +05:30
contact_notes_service.rb fix: consistent instrumentation with conversation.display_id (#13194) 2026-01-08 12:27:44 +05:30
conversation_faq_service.rb fix: consistent instrumentation with conversation.display_id (#13194) 2026-01-08 12:27:44 +05:30
conversation_insight_service.rb feat(captain): semantic memory fixes + roleta + reclamações + analytics 2026-04-21 15:36:25 -03:00
embedding_service.rb feat: legacy features to ruby llm (#12994) 2025-12-11 14:17:28 +05:30
faq_generator_service.rb feat: legacy features to ruby llm (#12994) 2025-12-11 14:17:28 +05:30
paginated_faq_generator_service.rb fix: PDF errors not loading in CI (#13236) 2026-01-12 15:22:15 +05:30
pdf_processing_service.rb fix: PDF errors not loading in CI (#13236) 2026-01-12 15:22:15 +05:30
system_prompts_service.rb feat(captain): semantic memory fixes + roleta + reclamações + analytics 2026-04-21 15:36:25 -03:00
translate_query_service.rb fix: search faqs in account language (#13428) 2026-02-09 17:25:11 +05:30