feat: only check for captain_active

This commit is contained in:
Shivam Mishra
2025-01-20 16:55:42 +05:30
parent 0a4af3592e
commit b1ddcb946e
+2 -20
View File
@@ -3,25 +3,7 @@ class CaptainListener < BaseListener
conversation = extract_conversation_and_account(event)[0]
return unless conversation.inbox.captain_active?
generate_notes(assistant, conversation) if assistant.config['feature_memory'].present?
generate_faqs(assistant, conversation) if assistant.config['feature_faq'].present?
end
private
def generate_notes(assistant, conversation)
Captain::Llm::ContactNotesService.new(assistant, conversation).generate_and_update_notes
# account = conversation.account
# Rails.logger.info("[CAPTAIN][ContactNotesService] Incrementing response usage for #{account.id}")
# account.increment_response_usage
end
def generate_faqs(assistant, conversation)
Captain::Llm::ConversationFaqService.new(assistant, conversation).generate_and_deduplicate
# account = conversation.account
# Rails.logger.info("[CAPTAIN][ConversationFaqService] Incrementing response usage for #{account.id}")
# account.increment_response_usage
Captain::Llm::ContactNotesService.new(assistant, conversation).generate_and_update_notes if assistant.config['feature_memory'].present?
Captain::Llm::ConversationFaqService.new(assistant, conversation).generate_and_deduplicate if assistant.config['feature_faq'].present?
end
end