FIX: Make sure that topic gists are displayed ONLY on the hot list. (#873)

This commit is contained in:
Roman Rizzi 2024-10-28 15:15:53 -03:00 committed by GitHub
parent 820b506910
commit 37b6461d68
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 38 additions and 15 deletions

View File

@ -0,0 +1,24 @@
import Component from "@glimmer/component";
import { service } from "@ember/service";
export default class AiTopicGist extends Component {
@service router;
get showGist() {
return (
this.router.currentRoute.attributes?.filterType === "hot" &&
this.args.topic?.ai_topic_gist &&
!this.args.topic?.excerpt
);
}
<template>
{{#if this.showGist}}
<div class="ai-topic-gist">
<div class="ai-topic-gist__text">
{{@topic.ai_topic_gist}}
</div>
</div>
{{/if}}
</template>
}

View File

@ -0,0 +1,13 @@
import Component from "@glimmer/component";
import AiTopicGist from "../../components/ai-topic-gist";
export default class AiTopicGistPlacement extends Component {
static shouldRender(_outletArgs, helper) {
const settings = helper.siteSettings;
return settings.discourse_ai_enabled && settings.ai_summarization_enabled;
}
<template>
<AiTopicGist @topic={{@outletArgs.topic}} />
</template>
}

View File

@ -1,15 +0,0 @@
import Component from "@glimmer/component";
export default class AiTopicGist extends Component {
static shouldRender(outletArgs) {
return outletArgs?.topic?.ai_topic_gist && !outletArgs.topic.excerpt;
}
<template>
<div class="ai-topic-gist">
<div class="ai-topic-gist__text">
{{@outletArgs.topic.ai_topic_gist}}
</div>
</div>
</template>
}

View File

@ -354,6 +354,7 @@ discourse_ai:
hidden: true
ai_summarization_enabled:
default: false
client: true
validator: "DiscourseAi::Configuration::LlmDependencyValidator"
ai_summarization_model:
default: ""