2023-11-28 10:28:36 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
desc "Backfill sentiment for all posts"
|
|
|
|
task "ai:sentiment:backfill", [:start_post] => [:environment] do |_, args|
|
2024-12-03 08:27:03 -05:00
|
|
|
DiscourseAi::Sentiment::PostClassification
|
|
|
|
.backfill_query(from_post_id: args[:start_post].to_i)
|
2024-11-28 13:38:23 -05:00
|
|
|
.find_in_batches do |batch|
|
2023-11-28 10:28:36 -05:00
|
|
|
print "."
|
2024-11-28 13:38:23 -05:00
|
|
|
DiscourseAi::Sentiment::PostClassification.new.bulk_classify!(batch)
|
2023-11-28 10:28:36 -05:00
|
|
|
end
|
|
|
|
end
|