Class: Assistant::TechnicalArticleManagementToolBuilder::ReplacementTool
- Inherits:
-
ManagementTool
- Object
- RubyLLM::Tool
- ManagementTool
- Assistant::TechnicalArticleManagementToolBuilder::ReplacementTool
- Defined in:
- app/services/assistant/technical_article_management_tool_builder.rb
Overview
Creates a genuinely new Article identity. Ordinary editorial updates must
use CreateRevisionTool instead.
Instance Method Summary collapse
-
#execute(id:, reason:, confirm_identity_change:) ⇒ String
JSON replacement snapshot.
-
#name ⇒ String
Stable tool name.
Methods inherited from ManagementTool
Constructor Details
This class inherits a constructor from Assistant::TechnicalArticleManagementToolBuilder::ManagementTool
Instance Method Details
#execute(id:, reason:, confirm_identity_change:) ⇒ String
Returns JSON replacement snapshot.
618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 |
# File 'app/services/assistant/technical_article_management_tool_builder.rb', line 618 def execute(id:, reason:, confirm_identity_change:, **) safely('replacement') do raise ToolError, 'Set confirm_identity_change=true only for a real decommissioning or canonical identity change.' unless confirm_identity_change == true raise ToolError, 'Explain why a new Article identity is required.' if reason.blank? source = find_article!(id) (:update, source) (:create, ArticleTechnical) replacement = source.create_replacement_draft!(author: require_actor!) response( replacement, message: "New-identity successor created because: #{reason}. Source ##{source.id} remains #{source.state} until approval." ) end end |
#name ⇒ String
Returns stable tool name.
614 |
# File 'app/services/assistant/technical_article_management_tool_builder.rb', line 614 def name = 'create_technical_article_replacement' |