FIX: Show related topics when scrolling long topics (#111)
* FIX: Show related topics when scrolling long topics * Update assets/javascripts/initializers/related-topics.js Co-authored-by: Roman Rizzi <roman@discourse.org> --------- Co-authored-by: Roman Rizzi <roman@discourse.org>
This commit is contained in:
parent
e3b4a73267
commit
f34094f6cc
|
@ -0,0 +1,29 @@
|
|||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
|
||||
export default {
|
||||
name: "discourse-ai-related-topics",
|
||||
|
||||
initialize(container) {
|
||||
const settings = container.lookup("service:site-settings");
|
||||
|
||||
if (settings.ai_embeddings_semantic_related_topics_enabled) {
|
||||
withPluginApi("1.1.0", (api) => {
|
||||
api.modifyClass("model:post-stream", {
|
||||
pluginId: "discourse-ai",
|
||||
|
||||
_setSuggestedTopics(result) {
|
||||
this._super(...arguments);
|
||||
|
||||
if (!result.related_topics) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.topic.setProperties({
|
||||
related_topics: result.related_topics,
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
Loading…
Reference in New Issue