Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions assets/javascripts/discourse/components/ai-topic-gist.gjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export default class AiTopicGist extends Component {

get showGist() {
return (
this.router.currentRoute.attributes?.filterType === "hot" &&
this.args.topic?.ai_topic_gist &&
!this.args.topic?.excerpt &&
this.prefersGist &&
!this.args.topic?.excerpt
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not removing this yet.

);
Expand Down
8 changes: 4 additions & 4 deletions lib/summarization/entry_point.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ def inject_into(plugin)
end

plugin.register_modifier(:topic_query_create_list_topics) do |topics, options|
if options[:filter] == :hot && SiteSetting.ai_summarization_enabled &&
skipped_filters = %i[suggested semantic_related]

if !skipped_filters.include?(options[:filter]) && SiteSetting.ai_summarization_enabled &&
SiteSetting.ai_summarize_max_hot_topics_gists_per_batch > 0
topics.includes(:ai_summaries).where(
"ai_summaries.id IS NULL OR ai_summaries.summary_type = ?",
Expand All @@ -34,9 +36,7 @@ def inject_into(plugin)
:ai_topic_gist,
include_condition: -> { scope.can_see_gists? },
) do
# Options is defined at the instance level so we cannot run this check inside "include_condition".
return if options[:filter] != :hot

return if %i[suggested semantic_related].include?(options[:filter])
summaries = object.ai_summaries.to_a

# Summaries should always have one or zero elements here.
Expand Down
14 changes: 0 additions & 14 deletions spec/lib/modules/summarization/entry_point_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -71,20 +71,6 @@
expect(serialized[:ai_topic_gist]).to be_present
end

it "doesn't include the summary when looking at other topic lists" do
gist_topic = topic_query.list_hot.topics.find { |t| t.id == topic_ai_gist.target_id }

serialized =
TopicListItemSerializer.new(
gist_topic,
scope: Guardian.new(user),
root: false,
filter: :latest,
).as_json

expect(serialized[:ai_topic_gist]).to be_nil
end

it "doesn't include the summary when the user is not a member of the opt-in group" do
SiteSetting.ai_hot_topic_gists_allowed_groups = ""

Expand Down