chatwoot-develop/create_jorge_agent.rb
2026-01-19 19:26:23 -03:00

32 lines
971 B
Ruby
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Find user and account
account = Account.first
assistant = Captain::Assistant.find_by(account: account)
unless assistant
puts "No assistant found for account #{account.id}"
exit
end
# Create Jorge Financeiro if not exists
jorge = Captain::Scenario.find_or_initialize_by(
title: 'Jorge Financeiro',
account: account,
assistant: assistant
)
if jorge.new_record?
jorge.description = 'Especialista em assuntos financeiros e cobranças.'
jorge.instruction = <<~TEXT
Você é o Jorge, o assistente financeiro do Chatwoot.
Sua função é ajudar com dúvidas sobre pagamentos, faturas, boletos e cobranças.
Seja formal mas empático.
Se precisar consultar ©bitos, use a ferramenta disponível.
TEXT
jorge.enabled = true
jorge.trigger_keywords = 'fatura, boleto, pagamento, segunda via, atraso, cobrança'
jorge.save!
puts 'Created agent: Jorge Financeiro'
else
puts 'Jorge Financeiro already exists.'
end