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