DEV: Add appEvents trigger when Ai search results toggled (#1052)

This PR adds appEvents triggers when Ai search results are toggled.
This commit is contained in:
Guhyoun Nam 2025-01-08 12:17:25 -06:00 committed by GitHub
parent 327adbde29
commit 404092a68c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 0 deletions

View File

@ -13,6 +13,8 @@ import { i18n } from "discourse-i18n";
import DTooltip from "float-kit/components/d-tooltip";
import AiIndicatorWave from "./ai-indicator-wave";
const AI_RESULTS_TOGGLED = "full-page-search:ai-results-toggled";
export default class AiFullPageSearch extends Component {
@service appEvents;
@service router;
@ -131,6 +133,9 @@ export default class AiFullPageSearch extends Component {
@action
toggleAiResults() {
this.appEvents.trigger(AI_RESULTS_TOGGLED, {
enabled: !this.showingAiResults,
});
if (this.showingAiResults) {
this.args.addSearchResults([], "topic_id");
} else {
@ -144,6 +149,9 @@ export default class AiFullPageSearch extends Component {
this.AiResults = [];
this.showingAiResults = false;
this.args.addSearchResults([], "topic_id");
this.appEvents.trigger(AI_RESULTS_TOGGLED, {
enabled: false,
});
}
performHyDESearch() {