1
0
mirror of synced 2026-08-04 14:56:54 +00:00
Files

29 lines
899 B
Ruby
Raw Permalink Normal View History

# frozen_string_literal: true
module DiscourseAi
module Sentiment
class EntryPoint
2023-02-23 15:50:10 -03:00
def inject_into(plugin)
sentiment_analysis_cb =
Proc.new do |post|
if SiteSetting.ai_sentiment_enabled
Jobs.enqueue(:post_sentiment_analysis, post_id: post.id)
end
end
2023-02-23 15:50:10 -03:00
plugin.on(:post_edited, &sentiment_analysis_cb)
plugin.add_to_serializer(:current_user, :can_see_sentiment_reports) do
ClassificationResult.has_sentiment_classification? && SiteSetting.ai_sentiment_enabled
end
2025-03-06 11:19:14 +11:00
# TODO we need new interfaces to conditionally register depending on site in the multisite
EmotionFilterOrder.register!(plugin)
EmotionDashboardReport.register!(plugin)
SentimentDashboardReport.register!(plugin)
SentimentAnalysisReport.register!(plugin)
end
end
end
end