mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-05-13 11:57:31 +00:00
lint
This commit is contained in:
parent
44391e276d
commit
210d6c4b75
@ -2,7 +2,7 @@
|
||||
|
||||
module Jobs
|
||||
class GenerateInferredConcepts < ::Jobs::Base
|
||||
sidekiq_options queue: 'low'
|
||||
sidekiq_options queue: "low"
|
||||
|
||||
# Process items to generate new concepts
|
||||
#
|
||||
@ -14,7 +14,7 @@ module Jobs
|
||||
def execute(args = {})
|
||||
return if args[:item_ids].blank? || args[:item_type].blank?
|
||||
|
||||
unless ['topics', 'posts'].include?(args[:item_type])
|
||||
unless %w[topics posts].include?(args[:item_type])
|
||||
Rails.logger.error("Invalid item_type for GenerateInferredConcepts: #{args[:item_type]}")
|
||||
return
|
||||
end
|
||||
@ -42,7 +42,9 @@ module Jobs
|
||||
begin
|
||||
process_item(item, item_type, match_only)
|
||||
rescue => e
|
||||
Rails.logger.error("Error generating concepts from #{item_type.singularize} #{item.id}: #{e.message}\n#{e.backtrace.join("\n")}")
|
||||
Rails.logger.error(
|
||||
"Error generating concepts from #{item_type.singularize} #{item.id}: #{e.message}\n#{e.backtrace.join("\n")}",
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -50,13 +52,13 @@ module Jobs
|
||||
def process_item(item, item_type, match_only)
|
||||
# Use the Manager method that handles both identifying and creating concepts
|
||||
if match_only
|
||||
if item_type == 'topics'
|
||||
if item_type == "topics"
|
||||
DiscourseAi::InferredConcepts::Manager.match_topic_to_concepts(item)
|
||||
else # posts
|
||||
DiscourseAi::InferredConcepts::Manager.match_post_to_concepts(item)
|
||||
end
|
||||
else
|
||||
if item_type == 'topics'
|
||||
if item_type == "topics"
|
||||
DiscourseAi::InferredConcepts::Manager.analyze_topic(item)
|
||||
else # posts
|
||||
DiscourseAi::InferredConcepts::Manager.analyze_post(item)
|
||||
|
Loading…
x
Reference in New Issue
Block a user