1
0
mirror of synced 2026-08-31 20:14:59 +00:00
Files

26 lines
943 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
require_relative "../support/sentiment_inference_stubs"
2025-05-16 09:40:08 +01:00
RSpec.describe "ai:sentiment:backfill" do
before do
Rake::Task.clear
Discourse::Application.load_tasks
end
2025-05-16 09:40:08 +01:00
before do
SiteSetting.ai_sentiment_model_configs =
"[{\"model_name\":\"SamLowe/roberta-base-go_emotions\",\"endpoint\":\"http://samlowe-emotion.com\",\"api_key\":\"123\"},{\"model_name\":\"j-hartmann/emotion-english-distilroberta-base\",\"endpoint\":\"http://jhartmann-emotion.com\",\"api_key\":\"123\"},{\"model_name\":\"cardiffnlp/twitter-roberta-base-sentiment-latest\",\"endpoint\":\"http://cardiffnlp-sentiment.com\",\"api_key\":\"123\"}]"
end
2025-05-16 09:40:08 +01:00
it "does nothing if the topic is soft-deleted" do
target = Fabricate(:post)
SentimentInferenceStubs.stub_classification(target)
target.topic.trash!
2025-05-16 09:40:08 +01:00
Rake::Task["ai:sentiment:backfill"].invoke
2025-05-16 09:40:08 +01:00
expect(ClassificationResult.count).to be_zero
end
end