Class: Collavre::Comments::CompressCommand

Inherits:
Object
  • Object
show all
Defined in:
app/services/collavre/comments/compress_command.rb

Constant Summary collapse

COMMAND_PATTERN =
/\A\/compress\b/i.freeze
SYSTEM_PROMPT =
<<~PROMPT.freeze
  You are summarizing a conversation thread in a project management tool.
  Preserve key decisions, action items, important context, and any conclusions.
  Be concise but thorough. Respond in the same language as the conversation.
  Use markdown formatting for readability.
PROMPT

Instance Method Summary collapse

Constructor Details

#initialize(comment:, user:) ⇒ CompressCommand

Returns a new instance of CompressCommand.



13
14
15
16
17
# File 'app/services/collavre/comments/compress_command.rb', line 13

def initialize(comment:, user:)
  @comment = comment
  @user = user
  @creative = comment.creative
end

Instance Method Details

#callObject



19
20
21
22
23
24
25
26
27
28
# File 'app/services/collavre/comments/compress_command.rb', line 19

def call
  return unless compress_command?

  validate!
  authorize!
  enqueue_compress_job
rescue StandardError => e
  Rails.logger.error("Compress command failed: #{e.message}")
  e.message
end