nlp: fix abrir e fechar suporte
Signed-off-by: Rodrigo Bertoldo de Sousa Martins <rodrigo.sousa.577@gmail.com>
This commit is contained in:
1 parent
6dc11e1ffe
commit
1ab39c20bb
1 file changed
+27
-2
+27
-2
@@ -52,7 +52,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
|
||||
// Padrões específicos para fechar suporte (deve vir ANTES de abrir)
|
||||
/^(fechar|finalizar|encerrar|concluir)\s+(suporte|chamado|ticket|atendimento)(?:\s+(.+))?$/i,
|
||||
// Padrões específicos para abrir suporte
|
||||
/^(abrir|criar|adicionar|novo)\s+(suporte|chamado|ticket|atendimento)(?:\s+(.+))?$/i,
|
||||
/^(suporte|chamado|ticket|atendimento)(?:\s+(.+))?$/i,
|
||||
// Padrões específicos para Fiberhome
|
||||
@@ -289,7 +291,19 @@ class NLPProcessor {
|
||||
};
|
||||
}
|
||||
|
||||
// Detectar comandos de suporte
|
||||
// Detectar comandos de fechar suporte
|
||||
if (/fechar|finalizar|encerrar|concluir/i.test(action) &&
|
||||
/suporte|chamado|ticket|atendimento/i.test(fullMatch)) {
|
||||
let query = match[3] || null;
|
||||
return {
|
||||
action: 'fechar_suporte',
|
||||
target: query ? query.trim() : null,
|
||||
confidence: 0.95,
|
||||
type: 'fechar_suporte_pattern'
|
||||
};
|
||||
}
|
||||
|
||||
// Detectar comandos de abrir 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)
|
||||
@@ -706,6 +720,17 @@ class NLPProcessor {
|
||||
}
|
||||
}
|
||||
|
||||
// Detectar fechar / finalizar / encerrar suporte → fechar_suporte (antes do loop de synonyms)
|
||||
if (/fechar|finalizar|encerrar|concluir/i.test(text) && /suporte|chamado|ticket|atendimento/i.test(text)) {
|
||||
const fmatch = text.match(/(?:fechar|finalizar|encerrar|concluir)\s+(?:suporte|chamado|ticket|atendimento)\s*(.*)/i);
|
||||
return {
|
||||
action: 'fechar_suporte',
|
||||
target: fmatch && fmatch[1] ? fmatch[1].trim() : null,
|
||||
confidence: 0.95,
|
||||
type: 'keyword_fechar_suporte'
|
||||
};
|
||||
}
|
||||
|
||||
// Detectar reativar / religar / desbloquear → liberar_cliente
|
||||
if (/reativar|religar|desbloquear|tirar\s+bloqueio/i.test(text)) {
|
||||
const rlMatch = text.match(/(?:reativar|religar|desbloquear)\s+(.+)/i);
|
||||
|
||||
Reference in new issue
Block a user