diff --git a/config/locales/en.yml b/config/locales/en.yml index 310235d5e..872f80249 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -231,6 +231,7 @@ en: description: 'Create issues in Linear directly from your conversation window. Alternatively, link existing Linear issues for a more streamlined and efficient issue tracking process.' captain: copilot_error: 'Please connect an assistant to this inbox to use copilot' + copilot_limit: 'You are out of copilot credits. You can buy more credits from the billing section.' public_portal: search: search_placeholder: Search for article by title or body... diff --git a/enterprise/app/controllers/enterprise/api/v1/accounts/conversations_controller.rb b/enterprise/app/controllers/enterprise/api/v1/accounts/conversations_controller.rb index 95c807931..5e01b431e 100644 --- a/enterprise/app/controllers/enterprise/api/v1/accounts/conversations_controller.rb +++ b/enterprise/app/controllers/enterprise/api/v1/accounts/conversations_controller.rb @@ -7,6 +7,7 @@ module Enterprise::Api::V1::Accounts::ConversationsController def copilot assistant = @conversation.inbox.captain_assistant return render json: { message: I18n.t('captain.copilot_error') } unless assistant + return render json: { message: I18n.t('captain.copilot_limit') } unless @conversation.inbox.captain_active? response = Captain::Copilot::ChatService.new( assistant, diff --git a/enterprise/app/services/enterprise/message_templates/hook_execution_service.rb b/enterprise/app/services/enterprise/message_templates/hook_execution_service.rb index 858b5e903..17515b628 100644 --- a/enterprise/app/services/enterprise/message_templates/hook_execution_service.rb +++ b/enterprise/app/services/enterprise/message_templates/hook_execution_service.rb @@ -10,6 +10,6 @@ module Enterprise::MessageTemplates::HookExecutionService end def should_process_captain_response? - conversation.pending? && message.incoming? && inbox.captain_assistant.present? + conversation.pending? && message.incoming? && inbox.captain_active? end end