feat: ensure captain limits
This commit is contained in:
@@ -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...
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user