FIX: Hide summarization button from anons (#70)

This commit is contained in:
Roman Rizzi 2023-05-18 12:34:49 -03:00 committed by GitHub
parent 261fe13599
commit ba65d42940
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 25 additions and 9 deletions

View File

@ -33,12 +33,16 @@ export default {
name: "discourse-ai-topic-summary",
initialize(container) {
const settings = container.lookup("service:site-settings");
const summarizationEnabled =
settings.discourse_ai_enabled && settings.ai_summarization_enabled;
const user = container.lookup("service:current-user");
if (summarizationEnabled) {
withPluginApi("1.6.0", initializeTopicSummary);
if (user) {
const settings = container.lookup("service:site-settings");
const summarizationEnabled =
settings.discourse_ai_enabled && settings.ai_summarization_enabled;
if (summarizationEnabled) {
withPluginApi("1.6.0", initializeTopicSummary);
}
}
},
};

View File

@ -8,7 +8,3 @@
min-height: 200px;
}
}
.topic-ai-summarization {
margin-left: 10px;
}

View File

@ -0,0 +1,3 @@
.topic-ai-summarization {
margin-left: 10px;
}

View File

@ -0,0 +1,9 @@
.toggle-summary {
button {
width: 100%;
}
.topic-ai-summarization {
margin-top: 10px;
}
}

View File

@ -13,7 +13,11 @@ gem "tiktoken_ruby", "0.0.5", platform: RUBY_PLATFORM
enabled_site_setting :discourse_ai_enabled
register_asset "stylesheets/modules/ai-helper/common/ai-helper.scss"
register_asset "stylesheets/modules/summarization/common/summarization.scss"
register_asset "stylesheets/modules/summarization/desktop/summarization.scss", :desktop
register_asset "stylesheets/modules/summarization/mobile/summarization.scss", :mobile
register_asset "stylesheets/modules/ai-bot/common/bot-replies.scss"
module ::DiscourseAi