feat: log increments

This commit is contained in:
Shivam Mishra
2025-01-20 15:48:17 +05:30
parent eae8159936
commit ab955d34e5
3 changed files with 10 additions and 2 deletions
@@ -26,6 +26,7 @@ class Captain::Conversation::ResponseBuilderJob < ApplicationJob
return process_action('handoff') if handoff_requested?
create_messages
Rails.logger.info("[CAPTAIN][ResponseBuilderJob] Incrementing response usage for #{account.id}")
account.increment_response_usage
end
@@ -9,6 +9,7 @@ class Captain::Copilot::ChatService
def execute(input)
@agent.execute(input, conversation_history_context)
Rails.logger.info("[CAPTAIN][CopilotChatService] Incrementing response usage for #{account.id}")
@assistant.account.increment_response_usage
end
+8 -2
View File
@@ -14,11 +14,17 @@ class CaptainListener < BaseListener
def generate_notes(assistant, conversation)
Captain::Llm::ContactNotesService.new(assistant, conversation).generate_and_update_notes
conversation.account.increment_response_usage
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
conversation.account.increment_response_usage
account = conversation.account
Rails.logger.info("[CAPTAIN][ConversationFaqService] Incrementing response usage for #{account.id}")
account.increment_response_usage
end
end