mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-03-07 17:59:56 +00:00
* FEATURE: Backfill posts sentiment. It adds a scheduled job to backfill posts' sentiment, similar to our existing rake task, but with two settings to control the batch size and posts' max-age. * Make sure model_name order is consistent.
12 lines
384 B
Ruby
12 lines
384 B
Ruby
# frozen_string_literal: true
|
|
|
|
desc "Backfill sentiment for all posts"
|
|
task "ai:sentiment:backfill", [:start_post] => [:environment] do |_, args|
|
|
DiscourseAi::Sentiment::PostClassification
|
|
.backfill_query(from_post_id: args[:start_post].to_i)
|
|
.find_in_batches do |batch|
|
|
print "."
|
|
DiscourseAi::Sentiment::PostClassification.new.bulk_classify!(batch)
|
|
end
|
|
end
|