This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Expand file tree Collapse file tree 2 files changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -20,7 +20,7 @@ def inject_into(plugin)
2020 plugin . register_modifier ( :topic_query_create_list_topics ) do |topics , options |
2121 if Discourse . filters . include? ( options [ :filter ] ) && SiteSetting . ai_summarization_enabled &&
2222 SiteSetting . ai_summarize_max_hot_topics_gists_per_batch > 0
23- topics . includes ( :ai_summaries )
23+ topics . includes ( :ai_gist_summary )
2424 else
2525 topics
2626 end
@@ -32,11 +32,7 @@ def inject_into(plugin)
3232 include_condition : -> { scope . can_see_gists? } ,
3333 ) do
3434 return if !Discourse . filters . include? ( options [ :filter ] )
35- summaries = object . ai_summaries . to_a
36-
37- # Summaries should always have one or zero elements here.
38- # This is an extra safeguard to avoid including regular summaries.
39- summaries . find { |s | s . summary_type == "gist" } &.summarized_text
35+ object . ai_gist_summary &.summarized_text
4036 end
4137
4238 # To make sure hot topic gists are inmediately up to date, we rely on this event
Original file line number Diff line number Diff line change @@ -4,6 +4,13 @@ module DiscourseAi
44 module TopicExtensions
55 extend ActiveSupport ::Concern
66
7- prepended { has_many :ai_summaries , as : :target }
7+ prepended do
8+ has_many :ai_summaries , as : :target
9+
10+ has_one :ai_gist_summary ,
11+ -> { where ( summary_type : AiSummary . summary_types [ :gist ] ) } ,
12+ class_name : "AiSummary" ,
13+ as : :target
14+ end
815 end
916end
You can’t perform that action at this time.
0 commit comments