discourse/app/serializers/web_hook_topic_view_serializer.rb
Roman Rizzi 61aeb2da90
FEATURE: Inline topic summary. Cached version accessible to everyone. (#22551)
* FEATURE:  Inline topic summary. Cached version accessible to everyone.

Anons and non-members of the `custom_summarization_allowed_groups_map` groups can see cached summaries for any accessible topic. After the first 12 hours and if the posts to summarize have changed, allowed users clicking on the button will automatically re-generate it.

* Ensure chat summaries work and prevent model hallucinations when there are no messages.
2023-07-12 11:21:51 -03:00

40 lines
805 B
Ruby

# frozen_string_literal: true
class WebHookTopicViewSerializer < TopicViewSerializer
attributes :created_by, :last_poster
%i[
post_stream
timeline_lookup
pm_with_non_human_user
draft
draft_key
draft_sequence
message_bus_last_id
suggested_topics
has_summary
actions_summary
current_post_number
chunk_size
topic_timer
details
image_url
slow_mode_seconds
slow_mode_enabled_until
bookmarks
summarizable
].each { |attr| define_method("include_#{attr}?") { false } }
def include_show_read_indicator?
false
end
def created_by
BasicUserSerializer.new(object.topic.user, scope: scope, root: false)
end
def last_poster
BasicUserSerializer.new(object.topic.last_poster, scope: scope, root: false)
end
end