DEV: Move jobs undear each module lib directory
This commit is contained in:
parent
1afa274b99
commit
ef6c785aca
|
@ -5,7 +5,7 @@ module DiscourseAI
|
||||||
class EntryPoint
|
class EntryPoint
|
||||||
def inject_into(plugin)
|
def inject_into(plugin)
|
||||||
require_relative "evaluation.rb"
|
require_relative "evaluation.rb"
|
||||||
require_relative "../../../app/jobs/regular/modules/nsfw/evaluate_content.rb"
|
require_relative "jobs/regular/evaluate_content.rb"
|
||||||
|
|
||||||
plugin.add_model_callback(Upload, :after_create) do
|
plugin.add_model_callback(Upload, :after_create) do
|
||||||
Jobs.enqueue(:evaluate_content, upload_id: self.id)
|
Jobs.enqueue(:evaluate_content, upload_id: self.id)
|
||||||
|
|
|
@ -5,7 +5,7 @@ module DiscourseAI
|
||||||
def inject_into(plugin)
|
def inject_into(plugin)
|
||||||
require_relative "event_handler.rb"
|
require_relative "event_handler.rb"
|
||||||
require_relative "post_classifier.rb"
|
require_relative "post_classifier.rb"
|
||||||
require_relative "../../../app/jobs/regular/modules/sentiment/sentiment_classify_post.rb"
|
require_relative "jobs/regular/sentiment_classify_post.rb"
|
||||||
|
|
||||||
plugin.on(:post_created) do |post|
|
plugin.on(:post_created) do |post|
|
||||||
DiscourseAI::Sentiment::EventHandler.handle_post_async(post)
|
DiscourseAI::Sentiment::EventHandler.handle_post_async(post)
|
||||||
|
|
|
@ -8,10 +8,8 @@ module DiscourseAI
|
||||||
require_relative "post_classifier.rb"
|
require_relative "post_classifier.rb"
|
||||||
require_relative "chat_message_classifier.rb"
|
require_relative "chat_message_classifier.rb"
|
||||||
|
|
||||||
jobs_base_path = "../../../app/jobs/regular/modules/toxicity"
|
require_relative "jobs/regular/toxicity_classify_post.rb"
|
||||||
|
require_relative "jobs/regular/toxicity_classify_chat_message.rb"
|
||||||
require_relative "#{jobs_base_path}/toxicity_classify_post.rb"
|
|
||||||
require_relative "#{jobs_base_path}/toxicity_classify_chat_message.rb"
|
|
||||||
|
|
||||||
plugin.on(:post_created) do |post|
|
plugin.on(:post_created) do |post|
|
||||||
DiscourseAI::Toxicity::EventHandler.handle_post_async(post)
|
DiscourseAI::Toxicity::EventHandler.handle_post_async(post)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
require_relative "../../../../support/nsfw_inference_stubs"
|
require_relative "../../../../../support/nsfw_inference_stubs"
|
||||||
|
|
||||||
describe Jobs::EvaluateContent do
|
describe Jobs::EvaluateContent do
|
||||||
fab!(:image) { Fabricate(:s3_image_upload) }
|
fab!(:image) { Fabricate(:s3_image_upload) }
|
|
@ -1,4 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class NSFWInferenceStubs
|
class NSFWInferenceStubs
|
||||||
class << self
|
class << self
|
||||||
def endpoint
|
def endpoint
|
||||||
|
|
Loading…
Reference in New Issue