diff --git a/config/settings.yml b/config/settings.yml index 55f8392f..a3589abe 100644 --- a/config/settings.yml +++ b/config/settings.yml @@ -6,8 +6,9 @@ discourse_ai: ai_toxicity_enabled: default: false client: true + hidden: true ai_toxicity_inference_service_api_endpoint: - default: "https://disorder-testing.demo-by-discourse.com" + default: "" ai_toxicity_inference_service_api_endpoint_srv: default: "" hidden: true @@ -72,9 +73,11 @@ discourse_ai: - sentiment - emotion - ai_nsfw_detection_enabled: false + ai_nsfw_detection_enabled: + default: false + hidden: true ai_nsfw_inference_service_api_endpoint: - default: "https://nsfw-testing.demo-by-discourse.com" + default: "" ai_nsfw_inference_service_api_endpoint_srv: default: "" hidden: true diff --git a/spec/lib/modules/toxicity/jobs/regular/toxicity_classify_chat_message_spec.rb b/spec/lib/modules/toxicity/jobs/regular/toxicity_classify_chat_message_spec.rb index 78c50504..47014b11 100644 --- a/spec/lib/modules/toxicity/jobs/regular/toxicity_classify_chat_message_spec.rb +++ b/spec/lib/modules/toxicity/jobs/regular/toxicity_classify_chat_message_spec.rb @@ -7,6 +7,7 @@ describe Jobs::ToxicityClassifyChatMessage do before do SiteSetting.ai_toxicity_enabled = true SiteSetting.ai_toxicity_flag_automatically = true + SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com" end fab!(:chat_message) diff --git a/spec/lib/modules/toxicity/jobs/regular/toxicity_classify_post_spec.rb b/spec/lib/modules/toxicity/jobs/regular/toxicity_classify_post_spec.rb index 9f11ad2a..e23cb2db 100644 --- a/spec/lib/modules/toxicity/jobs/regular/toxicity_classify_post_spec.rb +++ b/spec/lib/modules/toxicity/jobs/regular/toxicity_classify_post_spec.rb @@ -8,6 +8,7 @@ describe Jobs::ToxicityClassifyPost do before do SiteSetting.ai_toxicity_enabled = true SiteSetting.ai_toxicity_flag_automatically = true + SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com" end fab!(:post) diff --git a/spec/lib/modules/toxicity/toxicity_classification_spec.rb b/spec/lib/modules/toxicity/toxicity_classification_spec.rb index 7f0449d2..9a722a20 100644 --- a/spec/lib/modules/toxicity/toxicity_classification_spec.rb +++ b/spec/lib/modules/toxicity/toxicity_classification_spec.rb @@ -5,6 +5,8 @@ require_relative "../../../support/toxicity_inference_stubs" describe DiscourseAi::Toxicity::ToxicityClassification do fab!(:target) { Fabricate(:post) } + before { SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com" } + describe "#request" do it "returns the classification and the model used for it" do ToxicityInferenceStubs.stub_post_classification(target, toxic: false) diff --git a/spec/plugin_spec.rb b/spec/plugin_spec.rb index fa01219e..a0adec53 100644 --- a/spec/plugin_spec.rb +++ b/spec/plugin_spec.rb @@ -3,7 +3,10 @@ require_relative "support/toxicity_inference_stubs" describe Plugin::Instance do - before { SiteSetting.discourse_ai_enabled = true } + before do + SiteSetting.discourse_ai_enabled = true + SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com" + end describe "on reviewable_transitioned_to event" do fab!(:post) diff --git a/spec/shared/chat_message_classificator_spec.rb b/spec/shared/chat_message_classificator_spec.rb index 763473f6..fb7da8bb 100644 --- a/spec/shared/chat_message_classificator_spec.rb +++ b/spec/shared/chat_message_classificator_spec.rb @@ -8,6 +8,8 @@ describe DiscourseAi::ChatMessageClassificator do let(:model) { DiscourseAi::Toxicity::ToxicityClassification.new } let(:classification) { described_class.new(model) } + before { SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com" } + describe "#classify!" do before { ToxicityInferenceStubs.stub_chat_message_classification(chat_message, toxic: true) } diff --git a/spec/shared/post_classificator_spec.rb b/spec/shared/post_classificator_spec.rb index 575ed256..3ef42d53 100644 --- a/spec/shared/post_classificator_spec.rb +++ b/spec/shared/post_classificator_spec.rb @@ -8,6 +8,8 @@ describe DiscourseAi::PostClassificator do let(:model) { DiscourseAi::Toxicity::ToxicityClassification.new } let(:classification) { described_class.new(model) } + before { SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com" } + describe "#classify!" do before { ToxicityInferenceStubs.stub_post_classification(post, toxic: true) } diff --git a/spec/system/toxicity/reviewable_ai_chat_message_spec.rb b/spec/system/toxicity/reviewable_ai_chat_message_spec.rb index 40add4fe..82f7d2ec 100644 --- a/spec/system/toxicity/reviewable_ai_chat_message_spec.rb +++ b/spec/system/toxicity/reviewable_ai_chat_message_spec.rb @@ -10,6 +10,7 @@ RSpec.describe "Toxicity-flagged chat messages", type: :system, js: true do sign_in(admin) SiteSetting.ai_toxicity_enabled = true SiteSetting.ai_toxicity_flag_automatically = true + SiteSetting.ai_toxicity_inference_service_api_endpoint = "http://example.com" ToxicityInferenceStubs.stub_chat_message_classification(chat_message, toxic: true)