discourse/spec/support/dummy_custom_summarization.rb
Roman Rizzi 75e2c6b506
DEV: Pass the user who requested the summary to the strategy. (#24489)
This change allows the `discourse-ai` plugin to log the user who requested the summary in the `AiApiAuditLog`.
2023-11-21 13:27:27 -03:00

28 lines
461 B
Ruby

# frozen_string_literal: true
class DummyCustomSummarization < Summarization::Base
def initialize(summarization_result)
@summarization_result = summarization_result
end
def display_name
"dummy"
end
def correctly_configured?
true
end
def configuration_hint
"hint"
end
def model
"dummy"
end
def summarize(_content, _user)
@summarization_result.tap { |result| yield(result[:summary]) if block_given? }
end
end