Skip to content

Commit 5897d3a

Browse files
committed
dots are not commas
1 parent 627fcaa commit 5897d3a

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

lib/inferred_concepts/finder.rb

+18-17
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ def self.identify_concepts(content)
1111
# Use the ConceptFinder persona to identify concepts
1212
llm = DiscourseAi::Completions::Llm.default_llm
1313
persona = DiscourseAi::Personas::ConceptFinder.new
14-
context = DiscourseAi::Personas::BotContext.new(
15-
messages: [{ type: :user, content: content }],
16-
user: Discourse.system_user.
14+
context =
15+
DiscourseAi::Personas::BotContext.new(
16+
messages: [{ type: :user, content: content }],
17+
user: Discourse.system_user,
1718
inferred_concepts: DiscourseAi::InferredConcepts::Manager.list_concepts,
18-
)
19+
)
1920

2021
prompt = persona.craft_prompt(context)
2122
response = llm.completion(prompt, extract_json: true)
@@ -31,9 +32,7 @@ def self.identify_concepts(content)
3132
def self.create_or_find_concepts(concept_names)
3233
return [] if concept_names.blank?
3334

34-
concept_names.map do |name|
35-
InferredConcept.find_or_create_by(name: name)
36-
end
35+
concept_names.map { |name| InferredConcept.find_or_create_by(name: name) }
3736
end
3837

3938
# Finds candidate topics to use for concept generation
@@ -55,12 +54,13 @@ def self.find_candidate_topics(
5554
category_ids: nil,
5655
created_after: 30.days.ago
5756
)
58-
query = Topic.where(
59-
"topics.posts_count >= ? AND topics.views >= ? AND topics.like_count >= ?",
60-
min_posts,
61-
min_views,
62-
min_likes
63-
)
57+
query =
58+
Topic.where(
59+
"topics.posts_count >= ? AND topics.views >= ? AND topics.like_count >= ?",
60+
min_posts,
61+
min_views,
62+
min_likes,
63+
)
6464

6565
# Apply additional filters
6666
query = query.where("topics.id NOT IN (?)", exclude_topic_ids) if exclude_topic_ids.present?
@@ -79,10 +79,11 @@ def self.find_candidate_topics(
7979
query = query.where("topics.id NOT IN (#{topics_with_concepts})")
8080

8181
# Score and order topics by engagement (combination of views, likes, and posts)
82-
query = query.select(
83-
"topics.*,
84-
(topics.like_count * 2 + topics.posts_count * 3 + topics.views * 0.1) AS engagement_score"
85-
).order("engagement_score DESC")
82+
query =
83+
query.select(
84+
"topics.*,
85+
(topics.like_count * 2 + topics.posts_count * 3 + topics.views * 0.1) AS engagement_score",
86+
).order("engagement_score DESC")
8687

8788
# Return limited number of topics
8889
query.limit(limit)

0 commit comments

Comments
 (0)