Hermes Insights — Dashboard Funcional (2026-06-25)
Diagnóstico: RPCs no Supabase Self-Hosted
API: https://api.rochasalesseguros.com.br/rest/v1/
Anon Key: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6InJvY2hhc2FsZXMiLCJyb2xlIjoiYW5vbiIsImlhdCI6MTc4MjE0MDAxMiwiZXhwIjoxODEzNjc2MDEyfQ.zSTyXFB2i9xsPJQ0rTCEhEL0JnMTj0brfExdqa85VWU
Banco: chatwoot_production (Chatwoot PostgreSQL)
Status das RPCs
| RPC | Status | Retorno |
| ----- | -------- | --------- |
get_dashboard_summary | ✅ FUNCIONAL | {total_conversations, open, resolved, pending, total_messages, total_agents, resolution_rate, avg_score} |
get_agents_ranking | ✅ FUNCIONAL | Lista de agentes com scores, conversas |
get_hourly_messages(p_days) | ✅ FUNCIONAL | {day, hour, count} — agregar por hora |
get_conversations_for_audit | ✅ FUNCIONAL | Conversas com dados de auditoria |
get_critical_alerts | ❌ NÃO EXISTE | — |
get_flagged_messages | ❌ NÃO EXISTE | — |
get_daily_report_summary | ❌ NÃO EXISTE | — |
get_dashboard_stats | ❌ NÃO EXISTE (era o nome errado) | Substituída por get_dashboard_summary |
| Métrica | Fonte | Status |
| --------- | ------- | -------- |
| Total Conversas | get_dashboard_summary | ✅ real |
| Tempo Médio | — | ❌ placeholder (0m) |
| Taxa Resolução | get_dashboard_summary.resolution_rate | ✅ real |
| Score Médio | get_dashboard_summary.avg_score | ✅ real |
| Gráfico "Conversas por Hora" | get_hourly_messages | ✅ real (agregado por hora) |
| Ranking Corretores | get_agents_ranking | ✅ real |
| Alertas Críticos | get_agents_ranking (fallback) | ⚠️ mostra agentes com conversas abertas |
Pending: Criar RPCs Faltantes
Se quiser, posso criar no banco (via docker exec no Postgres):
get_critical_alerts()
Retornar conversas abertas há mais de X horas sem resposta.
get_daily_report_summary(date)
Agregar score, conversas, flags por dia para a página de relatórios.
get_flagged_messages(conversation_id)
Mensagens com flags de risco/objeção.
Arquivos Modificados
- -
src/lib/supabase.ts—getDashboardStatsreescrito paraget_dashboard_summary - -
src/pages/Dashboard.tsx— polling 10s implementado
Deploy
`bash
npm run build
rsync -az --delete dist/ root@31.97.243.106:/var/www/hermes-insights/
`
Status: ✅ Dashboard Funcional em Produção
URL: https://insights.rochasalesseguros.com.br
Salvo: 2026-06-25