mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 15:33:43 +08:00
7ca5ee6cd2
When we receive the stream parameter, we'll queue a job that periodically publishes partial updates, and after the summarization finishes, a final one with the completed version, plus metadata. `summary-box` listens to these updates via MessageBus, and updates state accordingly.
14 lines
394 B
Ruby
14 lines
394 B
Ruby
# frozen_string_literal: true
|
|
|
|
class TopicSummarySerializer < ApplicationSerializer
|
|
attributes :summarized_text, :algorithm, :outdated, :can_regenerate, :new_posts_since_summary
|
|
|
|
def can_regenerate
|
|
Summarization::Base.can_request_summary_for?(scope.current_user)
|
|
end
|
|
|
|
def new_posts_since_summary
|
|
object.target.highest_post_number.to_i - object.content_range&.end.to_i
|
|
end
|
|
end
|