Release v4928.1.4.2 stable

This commit is contained in:
2026-06-09 22:55:58 +01:00
commit 6445044ac6
280 changed files with 41775 additions and 0 deletions

115
app/action_catalog.py Normal file
View File

@@ -0,0 +1,115 @@
"""Catálogo único de ações atuais do ClientFlow.
O LLM só pode produzir `TRIAGE_ACTION_CODES`. Códigos operacionais
antigos foram removidos da triagem e substituídos por eventos/operações
internas (`business_events` e `operation_links`).
"""
TRIAGE_ACTION_CODES = {
"SEND_INFO",
"SEND_QUOTE",
"SEND_PROFORMA",
"SEND_INVOICE",
"CONFIRM_PAYMENT",
"SUPPORT",
"REMOVE_FROM_LIST",
"IGNORE_SPAM",
"REVIEW_MANUALLY",
"NO_ACTION",
"MARK_NO_INTEREST",
"IGNORE_BOUNCE",
}
ACTION_CODES = TRIAGE_ACTION_CODES
ACTION_MAP = {
"SEND_QUOTE": {
"route": "vendas",
"action_required": True,
"action": "Enviar proposta/cotação",
"safe_to_post": True,
"business_event_on_done": "quote_sent",
},
"SEND_INFO": {
"route": "vendas",
"action_required": True,
"action": "Enviar informação ao cliente",
"safe_to_post": True,
"business_event_on_done": "info_sent",
},
"SEND_PROFORMA": {
"route": "financeiro",
"action_required": True,
"action": "Emitir fatura pró-forma",
"safe_to_post": True,
"business_event_on_done": "proforma_sent",
},
"SEND_INVOICE": {
"route": "financeiro",
"action_required": True,
"action": "Enviar fatura ao cliente",
"safe_to_post": True,
"business_event_on_done": "invoice_sent",
},
"CONFIRM_PAYMENT": {
"route": "financeiro",
"action_required": True,
"action": "Confirmar pagamento",
"safe_to_post": True,
"business_event_on_done": "payment_confirmed",
},
"SUPPORT": {
"route": "suporte",
"action_required": True,
"action": "Responder ao pedido de suporte",
"safe_to_post": True,
"business_event_on_done": "support_handled",
},
"REMOVE_FROM_LIST": {
"route": "marketing",
"action_required": True,
"action": "Remover contacto da lista",
"safe_to_post": True,
"business_event_on_done": "contact_removed_from_list",
},
"IGNORE_SPAM": {
"route": "spam",
"action_required": False,
"action": "Ignorar spam",
"safe_to_post": False,
"business_event_on_done": None,
},
"IGNORE_BOUNCE": {
"route": "sistema",
"action_required": False,
"action": "Ignorar email devolvido/bounce",
"safe_to_post": False,
"business_event_on_done": None,
},
"REVIEW_MANUALLY": {
"route": "rever",
"action_required": True,
"action": "Rever manualmente",
"safe_to_post": False,
"business_event_on_done": None,
},
"NO_ACTION": {
"route": "rever",
"action_required": False,
"action": "Sem ação necessária",
"safe_to_post": False,
"business_event_on_done": None,
},
"MARK_NO_INTEREST": {
"route": "vendas",
"action_required": True,
"action": "Marcar sem interesse",
"safe_to_post": False,
"business_event_on_done": "opportunity_no_interest",
},
}
def get_action_config(action_code: str) -> dict:
code = str(action_code or "").strip().upper()
return ACTION_MAP.get(code, ACTION_MAP["REVIEW_MANUALLY"])