diff --git a/app/jobs/regular/update_hot_topic_gist.rb b/app/jobs/regular/fast_track_topic_gist.rb similarity index 66% rename from app/jobs/regular/update_hot_topic_gist.rb rename to app/jobs/regular/fast_track_topic_gist.rb index f4a2d3b3e..0470c9a25 100644 --- a/app/jobs/regular/update_hot_topic_gist.rb +++ b/app/jobs/regular/fast_track_topic_gist.rb @@ -1,23 +1,20 @@ # frozen_string_literal: true module ::Jobs - class UpdateHotTopicGist < ::Jobs::Base + class FastTrackTopicGist < ::Jobs::Base sidekiq_options retry: false def execute(args) return if !SiteSetting.discourse_ai_enabled return if !SiteSetting.ai_summarization_enabled - return if SiteSetting.ai_summarize_max_hot_topics_gists_per_batch.zero? + return if !SiteSetting.ai_summary_gists_enabled topic = Topic.find_by(id: args[:topic_id]) return if topic.blank? - return if !TopicHotScore.where(topic: topic).exists? - summarizer = DiscourseAi::Summarization.topic_gist(topic) gist = summarizer.existing_summary - return if gist.blank? - return if !gist.outdated + return if gist.present? && !gist.outdated summarizer.force_summarize(Discourse.system_user) end diff --git a/app/jobs/regular/hot_topics_gist_batch.rb b/app/jobs/regular/hot_topics_gist_batch.rb deleted file mode 100644 index aef230a75..000000000 --- a/app/jobs/regular/hot_topics_gist_batch.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -module ::Jobs - class HotTopicsGistBatch < ::Jobs::Base - def execute(_args) - return if !SiteSetting.discourse_ai_enabled - return if !SiteSetting.ai_summarization_enabled - return if SiteSetting.ai_summarize_max_hot_topics_gists_per_batch.zero? - - Topic - .joins("JOIN topic_hot_scores on topics.id = topic_hot_scores.topic_id") - .order("topic_hot_scores.score DESC") - .limit(SiteSetting.ai_summarize_max_hot_topics_gists_per_batch) - .each do |topic| - summarizer = DiscourseAi::Summarization.topic_gist(topic) - gist = summarizer.existing_summary - - summarizer.force_summarize(Discourse.system_user) if gist.blank? || gist.outdated - end - end - end -end diff --git a/app/jobs/scheduled/summaries_backfill.rb b/app/jobs/scheduled/summaries_backfill.rb index a21726081..2d9a3fdf4 100644 --- a/app/jobs/scheduled/summaries_backfill.rb +++ b/app/jobs/scheduled/summaries_backfill.rb @@ -19,6 +19,8 @@ def execute(_args) DiscourseAi::Summarization.topic_summary(topic).force_summarize(system_user) end + return unless SiteSetting.ai_summary_gists_enabled + gist_t = AiSummary.summary_types[:gist] backfill_candidates(gist_t) .limit(current_budget(gist_t)) @@ -29,9 +31,9 @@ def backfill_candidates(summary_type) Topic .where("topics.word_count >= ?", SiteSetting.ai_summary_backfill_minimum_word_count) .joins(<<~SQL) - LEFT OUTER JOIN ai_summaries ais ON - topics.id = ais.target_id AND - ais.target_type = 'Topic' AND + LEFT OUTER JOIN ai_summaries ais ON + topics.id = ais.target_id AND + ais.target_type = 'Topic' AND ais.summary_type = '#{summary_type}' SQL .where( diff --git a/config/locales/server.de.yml b/config/locales/server.de.yml index a4b13a889..2802b520a 100644 --- a/config/locales/server.de.yml +++ b/config/locales/server.de.yml @@ -85,8 +85,8 @@ de: ai_summarization_model: "Modell, das für die Zusammenfassung verwendet werden soll." ai_custom_summarization_allowed_groups: "Gruppen, die neue Zusammenfassungen erstellen dürfen." ai_pm_summarization_allowed_groups: "Gruppen können Zusammenfassungen in PMs erstellen und ansehen." - ai_summarize_max_hot_topics_gists_per_batch: "Nach der Aktualisierung der Themen in der angesagten Liste erstellen wir kurze Zusammenfassungen der ersten N Themen. (Deaktiviert, wenn 0)" - ai_hot_topic_gists_allowed_groups: "Gruppen, die die wichtigsten Themen in der Liste der aktuellen Themen sehen dürfen." + ai_summary_gists_enabled: "Nach der Aktualisierung der Themen in der angesagten Liste erstellen wir kurze Zusammenfassungen der ersten N Themen. (Deaktiviert, wenn 0)" + ai_summary_gists_allowed_groups: "Gruppen, die die wichtigsten Themen in der Liste der aktuellen Themen sehen dürfen." ai_summary_backfill_maximum_topics_per_hour: "Anzahl der Themenzusammenfassungen, die pro Stunde aufgefüllt werden müssen." ai_bot_enabled: "Aktiviere das KI-Bot-Modul." ai_bot_enable_chat_warning: "Zeigt eine Warnung an, wenn der PN-Chat initiiert wird. Kann durch Bearbeiten der Übersetzungszeichenfolge überschrieben werden: discourse_ai.ai_bot.pm_warning" @@ -372,7 +372,7 @@ de: endpoints: not_configured: "%{display_name} (nicht konfiguriert)" configuration_hint: - one: "Vergewissere dich, dass die Einstellung \"%{settings}\" konfiguriert wurde." + one: 'Vergewissere dich, dass die Einstellung "%{settings}" konfiguriert wurde.' other: "Vergewissere dich, dass diese Einstellungen konfiguriert wurden: %{settings}" delete_failed: one: "Wir konnten dieses Modell nicht löschen, weil es von %{settings} verwendet wird. Aktualisiere die Einstellung und versuche es erneut." diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 286a7dbb2..7640e4fd1 100644 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -86,8 +86,8 @@ en: ai_summarization_model: "Model to use for summarization." ai_custom_summarization_allowed_groups: "Groups allowed to use create new summaries." ai_pm_summarization_allowed_groups: "Groups allowed to create and view summaries in PMs." - ai_summarize_max_hot_topics_gists_per_batch: "After updating topics in the hot list, we'll generate brief summaries of the first N ones. (Disabled when 0)" - ai_hot_topic_gists_allowed_groups: "Groups allowed to see gists in the hot topics list." + ai_summary_gists_enabled: "Generate brief summaries of latest replies in topics automatically." + ai_summary_gists_allowed_groups: "Groups allowed to see gists in the hot topics list." ai_summary_backfill_maximum_topics_per_hour: "Number of topic summaries to backfill per hour." ai_bot_enabled: "Enable the AI Bot module." diff --git a/config/locales/server.he.yml b/config/locales/server.he.yml index 3abf4cd8b..1e125b624 100644 --- a/config/locales/server.he.yml +++ b/config/locales/server.he.yml @@ -84,8 +84,8 @@ he: ai_summarization_model: "מודל לשימוש לסיכום." ai_custom_summarization_allowed_groups: "קבוצות שמורשות להשתמש ליצירת סיכומים חדשים." ai_pm_summarization_allowed_groups: "קבוצות שמורשות ליצור ולצפות בתקצירים בהודעות פרטיות." - ai_summarize_max_hot_topics_gists_per_batch: "לאחר עדכון הנושאים ברשימה החמה, נייצר תקצירים של N הראשונים. (0 להשבתה)" - ai_hot_topic_gists_allowed_groups: "קבוצות שמורשות לראות gists ברשימת הנושאים החמים." + ai_summary_gists_enabled: "לאחר עדכון הנושאים ברשימה החמה, נייצר תקצירים של N הראשונים. (0 להשבתה)" + ai_summary_gists_allowed_groups: "קבוצות שמורשות לראות gists ברשימת הנושאים החמים." ai_summary_backfill_maximum_topics_per_hour: "מספר תקצירי הנושאים למילוי חוזר בשעה." ai_bot_enabled: "הפעלת מודול בוט הבינה המלאכותית." ai_bot_enable_chat_warning: "הצגת אזהרה עם פתיחת שיח הודעות פרטיות. אפשר לדרוס את זה על ידי עריכת מחרוזת התרגום: discourse_ai.ai_bot.pm_warning" @@ -106,7 +106,7 @@ he: reports: overall_sentiment: title: "רגש כללי" - description: 'התרשים משווה את מספר הפוסטים שמסווגים כחיוביים או שליליים. אלו מחושבים כאשר ניקוד חיובי או שלילי הוא גדול מהדף הניוקוד המוגדר. משמעות הדבר היא שפוסטים נייטרליים לא מופיעים. הודעות פרטיות מוחרגות גם כן. מסווגות עם „cardiffnlp/twitter-roberta-base-sentiment-latest”' + description: "התרשים משווה את מספר הפוסטים שמסווגים כחיוביים או שליליים. אלו מחושבים כאשר ניקוד חיובי או שלילי הוא גדול מהדף הניוקוד המוגדר. משמעות הדבר היא שפוסטים נייטרליים לא מופיעים. הודעות פרטיות מוחרגות גם כן. מסווגות עם „cardiffnlp/twitter-roberta-base-sentiment-latest”" xaxis: "חיובי(%)" yaxis: "תאריך" emotion_anger: diff --git a/config/locales/server.uk.yml b/config/locales/server.uk.yml index ba7cf8ba8..08b1bf667 100644 --- a/config/locales/server.uk.yml +++ b/config/locales/server.uk.yml @@ -84,8 +84,8 @@ uk: ai_summarization_model: "Модель для узагальнення." ai_custom_summarization_allowed_groups: "Групи, яким дозволено створювати нові зведення." ai_pm_summarization_allowed_groups: "Групи дозволили створювати та переглядати підсумки в особистих повідомленнях." - ai_summarize_max_hot_topics_gists_per_batch: "Після оновлення тем у гарячому списку ми згенеруємо короткі підсумки перших N. (Вимкнено, коли 0)" - ai_hot_topic_gists_allowed_groups: "Групи, яким дозволено бачити суть у списку гарячих тем." + ai_summary_gists_enabled: "Після оновлення тем у гарячому списку ми згенеруємо короткі підсумки перших N. (Вимкнено, коли 0)" + ai_summary_gists_allowed_groups: "Групи, яким дозволено бачити суть у списку гарячих тем." ai_summary_backfill_maximum_topics_per_hour: "Кількість підсумків тем для заповнення на годину." ai_bot_enabled: "Увімкніть модуль AI Bot." ai_bot_enable_chat_warning: "Відображати попередження, коли починається чат ПП. Можна змінити, відредагувавши рядок перекладу: discourse_ai.ai_bot.pm_warning" @@ -216,7 +216,7 @@ uk: description: "Максимальна кількість результатів для включення в пошук – якщо порожні, будуть використані правила за замовчуванням, а кількість буде масштабовано залежно від моделі, що використовується. Найвище значення 100." base_query: name: "Базовий пошуковий запит" - description: "Базовий запит для пошуку. Приклад: \"#urgent\" додасть \"#urgent\" до пошукового запиту і знайде лише теми з категорією або тегом \"терміново\"." + description: 'Базовий запит для пошуку. Приклад: "#urgent" додасть "#urgent" до пошукового запиту і знайде лише теми з категорією або тегом "терміново".' tool_summary: web_browser: "Перегляд веб-сторінок" github_search_files: "Пошук файлів на GitHub" @@ -285,17 +285,17 @@ uk: one: "Знайдено %{count} результат для '%{query}'" few: "Знайдено %{count} результати для '%{query}'" many: "Знайдено %{count} результатів для '%{query}'" - other: "Знайдено %{count} результатів для \"%{query}\"" + other: 'Знайдено %{count} результатів для "%{query}"' search_meta_discourse: one: "Знайдено %{count} результат для '%{query}'" few: "Знайдено %{count} результати для '%{query}'" many: "Знайдено %{count} результатів для '%{query}'" - other: "Знайдено %{count} результатів для \"%{query}\"" + other: 'Знайдено %{count} результатів для "%{query}"' google: one: "Знайдено %{count} результат для '%{query}'" few: "Знайдено %{count} результати для '%{query}'" many: "Знайдено %{count} результатів для '%{query}'" - other: "Знайдено %{count} результатів для \"%{query}\"" + other: 'Знайдено %{count} результатів для "%{query}"' setting_context: "Читання контексту для: %{setting_name}" schema: "%{tables}" search_settings: diff --git a/config/settings.yml b/config/settings.yml index bb3e0b752..8741d46e7 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -364,12 +364,10 @@ discourse_ai: type: group_list list_type: compact default: "3|13" # 3: @staff, 13: @trust_level_3 - ai_summarize_max_hot_topics_gists_per_batch: - default: 0 - min: 0 - max: 1000 + ai_summary_gists_enabled: + default: false hidden: true - ai_hot_topic_gists_allowed_groups: + ai_summary_gists_allowed_groups: type: group_list list_type: compact default: "" diff --git a/db/migrate/20241126033812_rename_ai_gist_batch_setting.rb b/db/migrate/20241126033812_rename_ai_gist_batch_setting.rb new file mode 100644 index 000000000..196887e54 --- /dev/null +++ b/db/migrate/20241126033812_rename_ai_gist_batch_setting.rb @@ -0,0 +1,11 @@ +# frozen_string_literal: true + +class RenameAiGistBatchSetting < ActiveRecord::Migration[7.0] + def up + execute "UPDATE site_settings SET name = 'ai_summary_gists_allowed_groups' WHERE name = 'ai_hot_topic_gists_allowed_groups'" + end + + def down + execute "UPDATE site_settings SET name = 'ai_hot_topic_gists_allowed_groups' WHERE name = 'ai_summary_gists_allowed_groups'" + end +end diff --git a/lib/guardian_extensions.rb b/lib/guardian_extensions.rb index d1d293521..0badfa4dd 100644 --- a/lib/guardian_extensions.rb +++ b/lib/guardian_extensions.rb @@ -23,14 +23,14 @@ def can_see_summary?(target) def can_see_gists? return false if !SiteSetting.ai_summarization_enabled - return false if SiteSetting.ai_summarize_max_hot_topics_gists_per_batch.zero? - if SiteSetting.ai_hot_topic_gists_allowed_groups.to_s == Group::AUTO_GROUPS[:everyone].to_s + return false if !SiteSetting.ai_summary_gists_enabled + if SiteSetting.ai_summary_gists_allowed_groups.to_s == Group::AUTO_GROUPS[:everyone].to_s return true end return false if anonymous? - return false if SiteSetting.ai_hot_topic_gists_allowed_groups_map.empty? + return false if SiteSetting.ai_summary_gists_allowed_groups_map.empty? - SiteSetting.ai_hot_topic_gists_allowed_groups_map.any? do |group_id| + SiteSetting.ai_summary_gists_allowed_groups_map.any? do |group_id| user.group_ids.include?(group_id) end end diff --git a/lib/summarization/entry_point.rb b/lib/summarization/entry_point.rb index 476432978..b706eec71 100644 --- a/lib/summarization/entry_point.rb +++ b/lib/summarization/entry_point.rb @@ -19,7 +19,7 @@ def inject_into(plugin) plugin.register_modifier(:topic_query_create_list_topics) do |topics, options| if Discourse.filters.include?(options[:filter]) && SiteSetting.ai_summarization_enabled && - SiteSetting.ai_summarize_max_hot_topics_gists_per_batch > 0 + SiteSetting.ai_summary_gists_enabled topics.includes(:ai_gist_summary) else topics @@ -35,20 +35,12 @@ def inject_into(plugin) object.ai_gist_summary&.summarized_text end - # To make sure hot topic gists are inmediately up to date, we rely on this event - # instead of using a scheduled job. - plugin.on(:topic_hot_scores_updated) { Jobs.enqueue(:hot_topics_gist_batch) } - # As this event can be triggered quite often, let's be overly cautious enqueueing # jobs if the feature is disabled. plugin.on(:post_created) do |post| if SiteSetting.discourse_ai_enabled && SiteSetting.ai_summarization_enabled && - SiteSetting.ai_summarize_max_hot_topics_gists_per_batch > 0 && post.topic - hot_score = TopicHotScore.find_by(topic: post.topic) - - if hot_score.present? && hot_score.updated_at > 1.day.ago - Jobs.enqueue(:update_hot_topic_gist, topic_id: post&.topic_id) - end + SiteSetting.ai_summary_gists_enabled && post.topic + Jobs.enqueue(:fast_track_topic_gist, topic_id: post&.topic_id) end end end diff --git a/spec/jobs/regular/update_hot_topic_gist_spec.rb b/spec/jobs/regular/fast_track_topic_gist_spec.rb similarity index 82% rename from spec/jobs/regular/update_hot_topic_gist_spec.rb rename to spec/jobs/regular/fast_track_topic_gist_spec.rb index b999df67d..74efe6075 100644 --- a/spec/jobs/regular/update_hot_topic_gist_spec.rb +++ b/spec/jobs/regular/fast_track_topic_gist_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -RSpec.describe Jobs::UpdateHotTopicGist do +RSpec.describe Jobs::FastTrackTopicGist do describe "#execute" do fab!(:topic_1) { Fabricate(:topic) } fab!(:post_1) { Fabricate(:post, topic: topic_1, post_number: 1) } @@ -9,11 +9,10 @@ before do assign_fake_provider_to(:ai_summarization_model) SiteSetting.ai_summarization_enabled = true - SiteSetting.ai_summarize_max_hot_topics_gists_per_batch = 100 + SiteSetting.ai_summary_gists_enabled = true end - context "when the hot topic has a gist" do - before { TopicHotScore.create!(topic_id: topic_1.id, score: 0.1) } + context "when the topic has a gist" do fab!(:ai_gist) do Fabricate(:topic_ai_gist, target: topic_1, original_content_sha: AiSummary.build_sha("12")) end @@ -48,22 +47,22 @@ end context "when the topic doesn't have a hot topic score" do - it "does nothing" do - subject.execute({}) + it "creates gist" do + subject.execute(topic_id: topic_1.id) gist = AiSummary.gist.find_by(target: topic_1) - expect(gist).to be_nil + expect(gist).to be_present end end context "when the topic has a hot topic score but no gist" do before { TopicHotScore.create!(topic_id: topic_1.id, score: 0.1) } - it "does nothing" do - subject.execute({}) + it "creates gist" do + subject.execute(topic_id: topic_1.id) gist = AiSummary.gist.find_by(target: topic_1) - expect(gist).to be_nil + expect(gist).to be_present end end end diff --git a/spec/jobs/regular/hot_topics_gist_batch_spec.rb b/spec/jobs/regular/hot_topics_gist_batch_spec.rb deleted file mode 100644 index 2e0e7ee3c..000000000 --- a/spec/jobs/regular/hot_topics_gist_batch_spec.rb +++ /dev/null @@ -1,126 +0,0 @@ -# frozen_string_literal: true - -RSpec.describe Jobs::HotTopicsGistBatch do - fab!(:topic_1) { Fabricate(:topic) } - fab!(:post_1) { Fabricate(:post, topic: topic_1, post_number: 1) } - fab!(:post_2) { Fabricate(:post, topic: topic_1, post_number: 2) } - - before do - assign_fake_provider_to(:ai_summarization_model) - SiteSetting.ai_summarization_enabled = true - SiteSetting.ai_summarize_max_hot_topics_gists_per_batch = 100 - end - - describe "#execute" do - context "when there is a topic with a hot score" do - before { TopicHotScore.create!(topic_id: topic_1.id, score: 0.1) } - - it "does nothing if the plugin is disabled" do - SiteSetting.discourse_ai_enabled = false - - subject.execute({}) - - gist = AiSummary.gist.find_by(target: topic_1) - expect(gist).to be_nil - end - - it "does nothing if the summarization module is disabled" do - SiteSetting.ai_summarization_enabled = false - - subject.execute({}) - - gist = AiSummary.gist.find_by(target: topic_1) - expect(gist).to be_nil - end - - it "does nothing if hot topics summarization is disabled" do - SiteSetting.ai_summarize_max_hot_topics_gists_per_batch = 0 - - subject.execute({}) - - gist = AiSummary.gist.find_by(target: topic_1) - expect(gist).to be_nil - end - - it "creates a gist" do - gist_result = "I'm a gist" - - DiscourseAi::Completions::Llm.with_prepared_responses([gist_result]) { subject.execute({}) } - - gist = AiSummary.gist.find_by(target: topic_1) - expect(gist.summarized_text).to eq(gist_result) - end - - context "when we already generated a gist of it" do - fab!(:ai_gist) do - Fabricate( - :topic_ai_gist, - target: topic_1, - original_content_sha: AiSummary.build_sha("12"), - ) - end - - it "does nothing if the gist is up to date" do - updated_gist = "They updated me :(" - - DiscourseAi::Completions::Llm.with_prepared_responses([updated_gist]) do - subject.execute({}) - end - - gist = AiSummary.gist.find_by(target: topic_1) - expect(AiSummary.gist.where(target: topic_1).count).to eq(1) - expect(gist.summarized_text).not_to eq(updated_gist) - expect(gist.original_content_sha).to eq(ai_gist.original_content_sha) - end - - it "regenerates it if it's outdated" do - Fabricate(:post, topic: topic_1, post_number: 3) - gist_result = "They updated me" - - DiscourseAi::Completions::Llm.with_prepared_responses([gist_result]) do - subject.execute({}) - end - - gist = AiSummary.gist.find_by(target: topic_1) - expect(gist.summarized_text).to eq(gist_result) - expect(gist.original_content_sha).to eq(AiSummary.build_sha("123")) - end - end - end - - context "when there is a topic but it doesn't have a hot score" do - it "does nothing" do - subject.execute({}) - - gist = AiSummary.gist.find_by(target: topic_1) - expect(gist).to be_nil - end - end - - context "when there are multiple hot topics" do - fab!(:topic_2) { Fabricate(:topic) } - fab!(:post_2_1) { Fabricate(:post, topic: topic_2, post_number: 1) } - fab!(:post_2_2) { Fabricate(:post, topic: topic_2, post_number: 2) } - - before do - TopicHotScore.create!(topic_id: topic_1.id, score: 0.2) - TopicHotScore.create!(topic_id: topic_2.id, score: 0.4) - end - - it "processes them by score order" do - topic_1_gist = "I'm gist of topic 1" - topic_2_gist = "I'm gist of topic 2" - - DiscourseAi::Completions::Llm.with_prepared_responses([topic_2_gist, topic_1_gist]) do - subject.execute({}) - end - - gist = AiSummary.gist.find_by(target: topic_1) - expect(gist.summarized_text).to eq(topic_1_gist) - - gist_2 = AiSummary.gist.find_by(target: topic_2) - expect(gist_2.summarized_text).to eq(topic_2_gist) - end - end - end -end diff --git a/spec/jobs/scheduled/summaries_backfill_spec.rb b/spec/jobs/scheduled/summaries_backfill_spec.rb index 46c43a53c..ebf6831f5 100644 --- a/spec/jobs/scheduled/summaries_backfill_spec.rb +++ b/spec/jobs/scheduled/summaries_backfill_spec.rb @@ -9,6 +9,7 @@ assign_fake_provider_to(:ai_summarization_model) SiteSetting.ai_summarization_enabled = true SiteSetting.ai_summary_backfill_maximum_topics_per_hour = limit + SiteSetting.ai_summary_gists_enabled = true end describe "#current_budget" do diff --git a/spec/lib/guardian_extensions_spec.rb b/spec/lib/guardian_extensions_spec.rb index e4cfa897a..589b362a2 100644 --- a/spec/lib/guardian_extensions_spec.rb +++ b/spec/lib/guardian_extensions_spec.rb @@ -9,7 +9,7 @@ group.add(user) assign_fake_provider_to(:ai_summarization_model) SiteSetting.ai_summarization_enabled = true - SiteSetting.ai_summarize_max_hot_topics_gists_per_batch = 1 + SiteSetting.ai_summary_gists_enabled = true end let(:anon_guardian) { Guardian.new } @@ -80,7 +80,7 @@ end describe "#can_see_gists?" do - before { SiteSetting.ai_hot_topic_gists_allowed_groups = group.id } + before { SiteSetting.ai_summary_gists_allowed_groups = group.id } let(:guardian) { Guardian.new(user) } context "when there is no user" do @@ -90,7 +90,7 @@ end context "when setting is set to everyone" do - before { SiteSetting.ai_hot_topic_gists_allowed_groups = Group::AUTO_GROUPS[:everyone] } + before { SiteSetting.ai_summary_gists_allowed_groups = Group::AUTO_GROUPS[:everyone] } it "returns true" do expect(guardian.can_see_gists?).to eq(true) @@ -98,7 +98,7 @@ end context "when there is a user but it's not a member of the allowed groups" do - before { SiteSetting.ai_hot_topic_gists_allowed_groups = "" } + before { SiteSetting.ai_summary_gists_allowed_groups = "" } it "returns false" do expect(guardian.can_see_gists?).to eq(false) diff --git a/spec/lib/modules/summarization/entry_point_spec.rb b/spec/lib/modules/summarization/entry_point_spec.rb index 9fa06b0ab..035e57b36 100644 --- a/spec/lib/modules/summarization/entry_point_spec.rb +++ b/spec/lib/modules/summarization/entry_point_spec.rb @@ -4,7 +4,7 @@ before do assign_fake_provider_to(:ai_summarization_model) SiteSetting.ai_summarization_enabled = true - SiteSetting.ai_summarize_max_hot_topics_gists_per_batch = 100 + SiteSetting.ai_summary_gists_enabled = true end fab!(:user) @@ -62,8 +62,8 @@ before do group.add(user) - SiteSetting.ai_hot_topic_gists_allowed_groups = group.id - SiteSetting.ai_summarize_max_hot_topics_gists_per_batch = 100 + SiteSetting.ai_summary_gists_allowed_groups = group.id + SiteSetting.ai_summary_gists_enabled = true end it "includes the summary" do @@ -81,7 +81,7 @@ 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 = "" + SiteSetting.ai_summary_gists_allowed_groups = "" gist_topic = topic_query.list_hot.topics.find { |t| t.id == topic_ai_gist.target_id } @@ -153,13 +153,4 @@ end end end - - describe "#on topic_hot_scores_updated" do - it "queues a job to generate gists" do - expect { DiscourseEvent.trigger(:topic_hot_scores_updated) }.to change( - Jobs::HotTopicsGistBatch.jobs, - :size, - ).by(1) - end - end end