topsapp: adicionado opção de abrir suporte

Signed-off-by: Rodrigo B. de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
rodrigo committed 2025-08-12 21:04:27 -03:00
1 parent 1337e1c2d0
commit 3d35fc24cc
9 files changed
+1600 -1

No files matched your search

+44 -1
View File
@@ -27,7 +27,10 @@ class NLPProcessor {
'status_onu': ['status onu', 'verificar onu', 'onu status', 'check onu', 'status ont', 'ont status'],
'fiberhome_status': ['fiberhome status', 'status fiberhome', 'conexões fiberhome', 'fiberhome conexoes'],
'dados_cliente': ['dados cliente', 'dados cadastrais', 'cadastro cliente', 'informações cliente', 'info cliente'],
'listar_servicos': ['listar serviços', 'servicos cliente', 'planos cliente', 'contratos cliente', 'ver servicos']
'listar_servicos': ['listar serviços', 'servicos cliente', 'planos cliente', 'contratos cliente', 'ver servicos'],
'abrir_suporte': ['abrir suporte', 'criar suporte', 'adicionar suporte', 'novo suporte', 'suporte', 'atendimento', 'chamado', 'ticket'],
'adicionar_suporte': ['abrir suporte', 'criar suporte', 'adicionar suporte', 'novo suporte', 'suporte tecnico', 'atendimento tecnico'],
'abrir_suporte': ['abrir suporte', 'criar suporte', 'adicionar suporte', 'novo suporte', 'suporte', 'chamado', 'ticket', 'atendimento']
};
// Padrões de comandos
@@ -41,6 +44,9 @@ class NLPProcessor {
/^(status|verificar)\s+(topsapp)$/i,
/^(dados|cadastro|informações|info)\s+(cliente|cadastrais?)\s+(.+)$/i,
/^(listar|ver)\s+(serviços?|servicos|planos|contratos)\s+(.+)$/i,
// Padrões específicos para suporte
/^(abrir|criar|adicionar|novo)\s+(suporte|chamado|ticket|atendimento)(?:\s+(.+))?$/i,
/^(suporte|chamado|ticket|atendimento)(?:\s+(.+))?$/i,
// Padrões específicos para Fiberhome
/^(status|verificar|check)\s+(onu|ont)\s+([A-Z0-9]+)$/i,
/^(onu|ont)\s+(status|verificar|check)\s+([A-Z0-9]+)$/i,
@@ -192,6 +198,19 @@ class NLPProcessor {
};
}
// Detectar comandos de suporte
if (/abrir|criar|adicionar|novo|suporte|chamado|ticket|atendimento/i.test(action) &&
/suporte|chamado|ticket|atendimento/i.test(fullMatch)) {
let query = match[3] || match[2] || ''; // Nome/CPF do cliente (opcional)
return {
action: 'abrir_suporte',
target: query ? query.trim() : null,
confidence: 0.95,
type: 'suporte_pattern'
};
}
// Detectar comandos TopSapp - bloquear cliente/serviço
if (/bloquear|suspender|cortar/i.test(action)) {
let clienteId = match[3] || match[2]; // ID/CPF/Nome do cliente
@@ -367,6 +386,30 @@ class NLPProcessor {
};
}
// Detectar comandos de suporte
if (/abrir|criar|adicionar|novo/i.test(action) && /suporte|chamado|ticket|atendimento/i.test(fullMatch)) {
let clienteQuery = match[3] || null; // Cliente opcional
return {
action: 'abrir_suporte',
target: clienteQuery ? clienteQuery.trim() : null,
confidence: 0.95,
type: 'suporte_pattern'
};
}
// Detectar comando simples de suporte
if (/suporte|chamado|ticket|atendimento/i.test(action)) {
let clienteQuery = match[2] || null; // Cliente opcional
return {
action: 'abrir_suporte',
target: clienteQuery ? clienteQuery.trim() : null,
confidence: 0.9,
type: 'suporte_simple_pattern'
};
}
// Padrões gerais
const normalizedAction = this.normalizeAction(action);
const target = match[match.length - 1]; // Último grupo capturado