mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-02-16 08:24:45 +00:00
FIX: Reduce scope of topic gists inclusion. (#925)
The topic query is used differently, and we can't assume the modifier will always receive an AR relation. Let's scope it to `Discourse#filters` instead of most lists.
This commit is contained in:
parent
3c91f374ac
commit
dcde94a393
@ -18,9 +18,7 @@ module DiscourseAi
|
|||||||
end
|
end
|
||||||
|
|
||||||
plugin.register_modifier(:topic_query_create_list_topics) do |topics, options|
|
plugin.register_modifier(:topic_query_create_list_topics) do |topics, options|
|
||||||
skipped_filters = %i[suggested semantic_related private_messages]
|
if Discourse.filters.include?(options[:filter]) && SiteSetting.ai_summarization_enabled &&
|
||||||
|
|
||||||
if !skipped_filters.include?(options[:filter]) && SiteSetting.ai_summarization_enabled &&
|
|
||||||
SiteSetting.ai_summarize_max_hot_topics_gists_per_batch > 0
|
SiteSetting.ai_summarize_max_hot_topics_gists_per_batch > 0
|
||||||
topics.includes(:ai_summaries).where(
|
topics.includes(:ai_summaries).where(
|
||||||
"ai_summaries.id IS NULL OR ai_summaries.summary_type = ?",
|
"ai_summaries.id IS NULL OR ai_summaries.summary_type = ?",
|
||||||
@ -36,7 +34,7 @@ module DiscourseAi
|
|||||||
:ai_topic_gist,
|
:ai_topic_gist,
|
||||||
include_condition: -> { scope.can_see_gists? },
|
include_condition: -> { scope.can_see_gists? },
|
||||||
) do
|
) do
|
||||||
return if %i[suggested semantic_related private_messages].include?(options[:filter])
|
return if !Discourse.filters.include?(options[:filter])
|
||||||
summaries = object.ai_summaries.to_a
|
summaries = object.ai_summaries.to_a
|
||||||
|
|
||||||
# Summaries should always have one or zero elements here.
|
# Summaries should always have one or zero elements here.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user