@@ -13,6 +13,8 @@ import I18n, { i18n } from "discourse-i18n";
1313import DTooltip from " float-kit/components/d-tooltip" ;
1414import AiIndicatorWave from " ./ai-indicator-wave" ;
1515
16+ const AI_RESULTS_TOGGLED = " full-page-search:ai-results-toggled" ;
17+
1618export default class AiFullPageSearch extends Component {
1719 @service appEvents;
1820 @service router;
@@ -123,15 +125,12 @@ export default class AiFullPageSearch extends Component {
123125
124126 @action
125127 toggleAiResults () {
128+ this .appEvents .trigger (AI_RESULTS_TOGGLED , {
129+ enabled: ! this .showingAiResults ,
130+ });
126131 if (this .showingAiResults ) {
127- this .appEvents .trigger (" full-page-search:ai-results-toggled" , {
128- enabled: false ,
129- });
130132 this .args .addSearchResults ([], " topic_id" );
131133 } else {
132- this .appEvents .trigger (" full-page-search:ai-results-toggled" , {
133- enabled: true ,
134- });
135134 this .args .addSearchResults (this .AiResults , " topic_id" );
136135 }
137136 this .showingAiResults = ! this .showingAiResults ;
@@ -142,7 +141,7 @@ export default class AiFullPageSearch extends Component {
142141 this .AiResults = [];
143142 this .showingAiResults = false ;
144143 this .args .addSearchResults ([], " topic_id" );
145- this .appEvents .trigger (" full-page-search:ai-results-toggled " , {
144+ this .appEvents .trigger (AI_RESULTS_TOGGLED , {
146145 enabled: false ,
147146 });
148147 }
0 commit comments