Class: Assistant::TechnicalArticleManagementToolBuilder::CreateRevisionTool
- Inherits:
-
ManagementTool
- Object
- RubyLLM::Tool
- ManagementTool
- Assistant::TechnicalArticleManagementToolBuilder::CreateRevisionTool
- Defined in:
- app/services/assistant/technical_article_management_tool_builder.rb
Overview
Creates or returns the one open, identity-preserving content revision for
an approved Technical Article.
Instance Method Summary collapse
-
#execute(id:, change_notes:) ⇒ String
Creates or returns the approved Article's one open content proposal.
-
#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:, change_notes:) ⇒ String
Creates or returns the approved Article's one open content proposal.
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 |
# File 'app/services/assistant/technical_article_management_tool_builder.rb', line 400 def execute(id:, change_notes:, **) safely('create revision') do article = find_article!(id) (:update, article) raise ToolError, 'Use the normal Technical Article draft editor until the new Article is approved.' unless article.state.in?(ArticleTechnical::APPROVED_STATES) revision = article.create_revision_draft!( author: require_actor!, attributes: { change_notes: change_notes } ) revision_response( article, revision, { message: "Revision ##{revision.revision_number} is a proposal; Article ##{article.id} remains live and unchanged." } ) end end |
#name ⇒ String
Returns stable tool name.
393 |
# File 'app/services/assistant/technical_article_management_tool_builder.rb', line 393 def name = 'create_technical_article_revision' |