mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-06-19 07:03:42 +08:00
17 lines
441 B
Ruby
Vendored
17 lines
441 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
module Jobs
|
|
class PostSentimentAnalysis < ::Jobs::Base
|
|
sidekiq_options queue: "low"
|
|
|
|
def execute(args)
|
|
return unless SiteSetting.ai_sentiment_enabled
|
|
return if (post_id = args[:post_id]).blank?
|
|
|
|
post = Post.find_by(id: post_id, post_type: Post.types[:regular])
|
|
return if post&.raw.blank?
|
|
|
|
DiscourseAi::Sentiment::PostClassification.new.classify!(post)
|
|
end
|
|
end
|
|
end
|