Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit d93ce0d

Browse files
committed
FEATURE: New sentiment analysis visualization report
WIP
1 parent 7ad9223 commit d93ce0d

File tree

5 files changed

+33
-0
lines changed

5 files changed

+33
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import Component from "@glimmer/component";
2+
3+
export default class AdminReportSentimentAnalysis extends Component {
4+
<template>
5+
<div>
6+
{{! TODO }}
7+
</div>
8+
</template>
9+
}

assets/javascripts/initializers/admin-reports.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { withPluginApi } from "discourse/lib/plugin-api";
22
import AdminReportEmotion from "discourse/plugins/discourse-ai/discourse/components/admin-report-emotion";
3+
import AdminReportSentimentAnalysis from "../discourse/components/admin-report-sentiment-analysis";
34

45
export default {
56
name: "discourse-ai-admin-reports",
@@ -12,6 +13,10 @@ export default {
1213

1314
withPluginApi("2.0.1", (api) => {
1415
api.registerReportModeComponent("emotion", AdminReportEmotion);
16+
api.registerReportModeComponent(
17+
"sentiment-analysis",
18+
AdminReportSentimentAnalysis
19+
);
1520
});
1621
},
1722
};

config/locales/server.en.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ en:
104104
flagged_by_nsfw: The AI plugin flagged this after classifying at least one of the attached images as NSFW.
105105

106106
reports:
107+
sentiment_analysis:
108+
title: "Sentiment analysis"
109+
description: "todo"
107110
overall_sentiment:
108111
title: "Overall sentiment"
109112
description: 'The chart compares the number of posts classified as either positive or negative. These are calculated when positive or negative scores > the set threshold score. This means neutral posts are not shown. Personal messages (PMs) are also excluded. Classified with "cardiffnlp/twitter-roberta-base-sentiment-latest"'

lib/sentiment/entry_point.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ def inject_into(plugin)
1717
EmotionFilterOrder.register!(plugin)
1818
EmotionDashboardReport.register!(plugin)
1919
SentimentDashboardReport.register!(plugin)
20+
SentimentAnalysisReport.register!(plugin)
2021
end
2122
end
2223
end
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# frozen_string_literal: true
2+
3+
module DiscourseAi
4+
module Sentiment
5+
class SentimentAnalysisReport
6+
def self.register!(plugin)
7+
plugin.add_report("sentiment_analysis") do |report|
8+
# TODO: Implement the report
9+
# report.modes = []
10+
# reprot.data = {}
11+
end
12+
end
13+
end
14+
end
15+
end

0 commit comments

Comments
 (0)