diff --git a/enterprise/app/jobs/captain/conversation/response_builder_job.rb b/enterprise/app/jobs/captain/conversation/response_builder_job.rb index 2118af2f6..c8c511a57 100644 --- a/enterprise/app/jobs/captain/conversation/response_builder_job.rb +++ b/enterprise/app/jobs/captain/conversation/response_builder_job.rb @@ -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 diff --git a/enterprise/app/services/captain/copilot/chat_service.rb b/enterprise/app/services/captain/copilot/chat_service.rb index d2d221183..ea15ac4e8 100644 --- a/enterprise/app/services/captain/copilot/chat_service.rb +++ b/enterprise/app/services/captain/copilot/chat_service.rb @@ -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 diff --git a/enterprise/listeners/captain_listener.rb b/enterprise/listeners/captain_listener.rb index 1958fb78b..0dc4099b4 100644 --- a/enterprise/listeners/captain_listener.rb +++ b/enterprise/listeners/captain_listener.rb @@ -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