Files
leadchat/enterprise/app/services/captain/tools/copilot/get_article_service.rb
Aakash Bakhle eed2eaceb0 feat: Migrate ruby llm captain (#12981)
Co-authored-by: aakashb95 <aakash@chatwoot.com>
Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
2025-12-04 18:26:10 +05:30

19 lines
548 B
Ruby

class Captain::Tools::Copilot::GetArticleService < Captain::Tools::BaseTool
def self.name
'get_article'
end
description 'Get details of an article including its content and metadata'
param :article_id, type: :number, desc: 'The ID of the article to retrieve', required: true
def execute(article_id:)
article = Article.find_by(id: article_id, account_id: @assistant.account_id)
return 'Article not found' if article.nil?
article.to_llm_text
end
def active?
user_has_permission('knowledge_base_manage')
end
end