Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit f5baa25

Browse files
Merge branch 'main' into ux/apply-more-admin-ui-guidelines
2 parents 60e83fe + 7a094cd commit f5baa25

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+467
-388
lines changed

app/jobs/regular/update_hot_topic_gist.rb renamed to app/jobs/regular/fast_track_topic_gist.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
# frozen_string_literal: true
22

33
module ::Jobs
4-
class UpdateHotTopicGist < ::Jobs::Base
4+
class FastTrackTopicGist < ::Jobs::Base
55
sidekiq_options retry: false
66

77
def execute(args)
88
return if !SiteSetting.discourse_ai_enabled
99
return if !SiteSetting.ai_summarization_enabled
10-
return if SiteSetting.ai_summarize_max_hot_topics_gists_per_batch.zero?
10+
return if !SiteSetting.ai_summary_gists_enabled
1111

1212
topic = Topic.find_by(id: args[:topic_id])
1313
return if topic.blank?
1414

15-
return if !TopicHotScore.where(topic: topic).exists?
16-
1715
summarizer = DiscourseAi::Summarization.topic_gist(topic)
1816
gist = summarizer.existing_summary
19-
return if gist.blank?
20-
return if !gist.outdated
17+
return if gist.present? && !gist.outdated
2118

2219
summarizer.force_summarize(Discourse.system_user)
2320
end

app/jobs/regular/hot_topics_gist_batch.rb

Lines changed: 0 additions & 22 deletions
This file was deleted.

app/jobs/scheduled/embeddings_backfill.rb

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,15 @@ def execute(args)
7070
Post
7171
.joins("LEFT JOIN #{table_name} ON #{table_name}.post_id = posts.id")
7272
.where(deleted_at: nil)
73+
.where(post_type: Post.types[:regular])
7374
.limit(limit - rebaked)
7475

7576
# First, we'll try to backfill embeddings for posts that have none
7677
posts
7778
.where("#{table_name}.post_id IS NULL")
78-
.find_each do |t|
79-
vector_rep.generate_representation_from(t)
80-
rebaked += 1
79+
.find_in_batches do |batch|
80+
vector_rep.gen_bulk_reprensentations(batch)
81+
rebaked += batch.size
8182
end
8283

8384
return if rebaked >= limit
@@ -90,24 +91,28 @@ def execute(args)
9091
OR
9192
#{table_name}.strategy_version < #{strategy.version}
9293
SQL
93-
.find_each do |t|
94-
vector_rep.generate_representation_from(t)
95-
rebaked += 1
94+
.find_in_batches do |batch|
95+
vector_rep.gen_bulk_reprensentations(batch)
96+
rebaked += batch.size
9697
end
9798

9899
return if rebaked >= limit
99100

100101
# Finally, we'll try to backfill embeddings for posts that have outdated
101102
# embeddings due to edits. Here we only do 10% of the limit
102-
posts
103-
.where("#{table_name}.updated_at < ?", 7.days.ago)
104-
.order("random()")
105-
.limit((limit - rebaked) / 10)
106-
.pluck(:id)
107-
.each do |id|
108-
vector_rep.generate_representation_from(Post.find_by(id: id))
109-
rebaked += 1
110-
end
103+
posts_batch_size = 1000
104+
105+
outdated_post_ids =
106+
posts
107+
.where("#{table_name}.updated_at < ?", 7.days.ago)
108+
.order("random()")
109+
.limit((limit - rebaked) / 10)
110+
.pluck(:id)
111+
112+
outdated_post_ids.each_slice(posts_batch_size) do |batch|
113+
vector_rep.gen_bulk_reprensentations(Post.where(id: batch).order("topics.bumped_at DESC"))
114+
rebaked += batch.length
115+
end
111116

112117
rebaked
113118
end
@@ -120,14 +125,13 @@ def populate_topic_embeddings(vector_rep, topics, force: false)
120125
topics = topics.where("#{vector_rep.topic_table_name}.topic_id IS NULL") if !force
121126

122127
ids = topics.pluck("topics.id")
128+
batch_size = 1000
123129

124-
ids.each do |id|
125-
topic = Topic.find_by(id: id)
126-
if topic
127-
vector_rep.generate_representation_from(topic)
128-
done += 1
129-
end
130+
ids.each_slice(batch_size) do |batch|
131+
vector_rep.gen_bulk_reprensentations(Topic.where(id: batch).order("topics.bumped_at DESC"))
132+
done += batch.length
130133
end
134+
131135
done
132136
end
133137
end

app/jobs/scheduled/summaries_backfill.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ def execute(_args)
1919
DiscourseAi::Summarization.topic_summary(topic).force_summarize(system_user)
2020
end
2121

22+
return unless SiteSetting.ai_summary_gists_enabled
23+
2224
gist_t = AiSummary.summary_types[:gist]
2325
backfill_candidates(gist_t)
2426
.limit(current_budget(gist_t))
@@ -29,9 +31,9 @@ def backfill_candidates(summary_type)
2931
Topic
3032
.where("topics.word_count >= ?", SiteSetting.ai_summary_backfill_minimum_word_count)
3133
.joins(<<~SQL)
32-
LEFT OUTER JOIN ai_summaries ais ON
33-
topics.id = ais.target_id AND
34-
ais.target_type = 'Topic' AND
34+
LEFT OUTER JOIN ai_summaries ais ON
35+
topics.id = ais.target_id AND
36+
ais.target_type = 'Topic' AND
3537
ais.summary_type = '#{summary_type}'
3638
SQL
3739
.where(

config/locales/client.de.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ de:
1717
categories:
1818
discourse_ai: "Discourse-KI"
1919
dashboard:
20-
emotion: "Emotion"
20+
emotion:
21+
title: "Emotion"
22+
description: "Die Tabelle listet die Anzahl der Beiträge auf, die mit einer bestimmten Emotion klassifiziert wurden. Klassifiziert mit dem Modell 'SamLowe/roberta-base-go_emotions'."
2123
js:
2224
discourse_automation:
2325
scriptables:
@@ -463,6 +465,11 @@ de:
463465
topic:
464466
title: "Zusammenfassung des Themas"
465467
close: "Zusammenfassungspanel schließen"
468+
topic_list_layout:
469+
button:
470+
compact: "Kompakt"
471+
expanded: "Erweitert"
472+
expanded_description: "mit KI-Zusammenfassungen"
466473
review:
467474
types:
468475
reviewable_ai_post:

config/locales/client.he.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ he:
1616
site_settings:
1717
categories:
1818
discourse_ai: "בינה מלאכותית ב־Discourse"
19+
dashboard:
20+
emotion:
21+
title: "רגש"
22+
description: "הטבלה מפרטת את כמות הפוסטים שסווגו עם רגש שנקבע. הסיווג נעשה בעזרת המודל ‚SamLowe/roberta-base-go_emotions’."
1923
js:
2024
discourse_automation:
2125
scriptables:
@@ -168,6 +172,7 @@ he:
168172
saved: "הדמות נשמרה"
169173
enabled: "מאופשר?"
170174
tools: "כלים פעילים"
175+
forced_tools: "כלים נאכפים"
171176
allowed_groups: "קבוצות מורשות"
172177
confirm_delete: "למחוק את הדמות?"
173178
new: "דמות חדשה"
@@ -271,6 +276,11 @@ he:
271276
ai_persona: "דמות (%{persona})"
272277
ai_summarization: "סיכום"
273278
ai_embeddings_semantic_search: "חיפוש בינה מלאכותית"
279+
in_use_warning:
280+
one: "המודל הזה משמש את %{settings}. אם לא מוגדר כראוי, היכולת לא תעבוד כמצופה."
281+
two: "המודל הזה משמש את: %{settings}. אם ההגדרות שגויות היכולת לא תעבודנה כמצופה."
282+
many: "המודל הזה משמש את: %{settings}. אם ההגדרות שגויות היכולת לא תעבודנה כמצופה."
283+
other: "המודל הזה משמש את: %{settings}. אם ההגדרות שגויות היכולת לא תעבודנה כמצופה."
274284
model_description:
275285
none: "הגדרות כלליות שעובדות עבור רוב המודלים של השפות"
276286
anthropic-claude-3-5-sonnet: "המודל החכם ביותר של Anthropic"
@@ -281,6 +291,12 @@ he:
281291
open_ai-gpt-4-turbo: "מודל חכם מאוד מהדור הקודם"
282292
open_ai-gpt-4o: "מודל חכם במיוחד למשימות מורכבות, רבות שלבים"
283293
open_ai-gpt-4o-mini: "מודל חסכוני, קטן ומהיר למשימות קלילות"
294+
open_ai-o1-mini: "מודל הגיון חסכוני"
295+
open_ai-o1-preview: "מודל ההיגיון החזק ביותר מבית OpenAI"
296+
samba_nova-Meta-Llama-3-1-8B-Instruct: "דגם רב־לשוני, קליל ויעיל"
297+
samba_nova-Meta-Llama-3-1-70B-Instruct": "מודל רב־תכליתי חזק"
298+
mistral-mistral-large-latest: "המודל החזק ביותר של Mistral"
299+
mistral-pixtral-large-latest: "המודל החזק ביותר של Mistral שבנוי לעיבוד חזותי"
284300
configured:
285301
title: "LLMs (מודלי שפה גדולים) מוגדרים"
286302
preconfigured_llms: "בחירת ה־LLM שלך"
@@ -313,6 +329,7 @@ he:
313329
ollama: "Ollama"
314330
CDCK: "CDCK"
315331
samba_nova: "SambaNova"
332+
mistral: "Mistral"
316333
fake: "מותאם"
317334
provider_fields:
318335
access_key_id: "מזהה מפתח גישה ל־AWS Bedrock"
@@ -385,6 +402,10 @@ he:
385402
ai_generated_result: "תוצאות חיפוש שנמצאו באמצעות בינה מלאכותית"
386403
quick_search:
387404
suffix: "בכל הנושאים והפוסטים עם בינה מלאכותית"
405+
ai_artifact:
406+
expand_view_label: "הרחבת תצוגה"
407+
collapse_view_label: "יציאה ממסך מלא (ESC)"
408+
click_to_run_label: "הרצת תוצר"
388409
ai_bot:
389410
pm_warning: "הודעות בוט שיח בינה מלאכותית לא נאכפות דרך קבע על ידי המפקחים."
390411
cancel_streaming: "עצירת התגובה"
@@ -450,6 +471,11 @@ he:
450471
topic:
451472
title: "תקציר הנושא"
452473
close: "סגירת חלונית תקציר"
474+
topic_list_layout:
475+
button:
476+
compact: "מצומצם"
477+
expanded: "מורחב"
478+
expanded_description: "עם סיכוי בינה מלאכותית"
453479
review:
454480
types:
455481
reviewable_ai_post:

config/locales/server.ar.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,19 +96,19 @@ ar:
9696
xaxis: "إيجابية (%)"
9797
yaxis: "التاريخ"
9898
emotion_anger:
99-
title: الغضب
99+
title: "\U0001F620 الغضب"
100100
emotion_disgust:
101-
title: الاشمئزاز
101+
title: "\U0001F922 الاشمئزاز"
102102
emotion_fear:
103-
title: الخوف
103+
title: "\U0001F628 الخوف"
104104
emotion_joy:
105-
title: المرح
105+
title: "\U0001F60A المرح"
106106
emotion_neutral:
107-
title: محايدة
107+
title: "\U0001F610 محايدة"
108108
emotion_sadness:
109-
title: الحزن
109+
title: "\U0001F62D الحزن"
110110
emotion_surprise:
111-
title: المفاجأة
111+
title: "\U0001F632 المفاجأة"
112112
discourse_ai:
113113
unknown_model: "نموذج ذكاء اصطناعي غير معروف"
114114
tools:

config/locales/server.be.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
be:
88
reports:
99
emotion_neutral:
10-
title: нейтральны
10+
title: "\U0001F610 нейтральны"
1111
discourse_ai:
1212
ai_bot:
1313
tool_summary:

config/locales/server.ca.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ ca:
99
overall_sentiment:
1010
yaxis: "Data"
1111
emotion_neutral:
12-
title: Neutre
12+
title: "\U0001F610 Neutre"
1313
discourse_ai:
1414
ai_bot:
1515
tool_summary:

config/locales/server.da.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ da:
99
overall_sentiment:
1010
yaxis: "Dato"
1111
emotion_neutral:
12-
title: Neutral
12+
title: "\U0001F610 Neutral"
1313
discourse_ai:
1414
ai_bot:
1515
tool_summary:

0 commit comments

Comments
 (0)