mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-07-13 09:33:28 +00:00
DEV: Add multiple appEvents trigger on AI Chatbot (#1324)
* DEV: Add appEvents trigger on AI Chatbot header icon * update event name * stop-forcing-custom-sidebar appevents trigger * add force stop custom sidebar appEvents * trigger name update * trigger name update
This commit is contained in:
parent
b2fbab9fad
commit
925949de47
@ -10,6 +10,7 @@ import { composeAiBotMessage } from "../lib/ai-bot-helper";
|
||||
import { AI_CONVERSATIONS_PANEL } from "../services/ai-conversations-sidebar-manager";
|
||||
|
||||
export default class AiBotHeaderIcon extends Component {
|
||||
@service appEvents;
|
||||
@service composer;
|
||||
@service currentUser;
|
||||
@service navigationMenu;
|
||||
@ -51,6 +52,7 @@ export default class AiBotHeaderIcon extends Component {
|
||||
}
|
||||
|
||||
if (this.siteSettings.ai_bot_enable_dedicated_ux) {
|
||||
this.appEvents.trigger("discourse-ai:bot-header-icon-clicked");
|
||||
return this.router.transitionTo("discourse-ai-bot-conversations");
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,7 @@ import { ADMIN_PANEL, MAIN_PANEL } from "discourse/lib/sidebar/panels";
|
||||
export const AI_CONVERSATIONS_PANEL = "ai-conversations";
|
||||
|
||||
export default class AiConversationsSidebarManager extends Service {
|
||||
@service appEvents;
|
||||
@service sidebarState;
|
||||
|
||||
@tracked newTopicForceSidebar = false;
|
||||
@ -26,6 +27,7 @@ export default class AiConversationsSidebarManager extends Service {
|
||||
|
||||
this.sidebarState.isForcingSidebar = true;
|
||||
document.body.classList.add("has-ai-conversations-sidebar");
|
||||
this.appEvents.trigger("discourse-ai:force-conversations-sidebar");
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -41,5 +43,7 @@ export default class AiConversationsSidebarManager extends Service {
|
||||
this.sidebarState.setPanel(MAIN_PANEL); // Return to main sidebar panel
|
||||
this.sidebarState.isForcingSidebar = false;
|
||||
}
|
||||
|
||||
this.appEvents.trigger("discourse-ai:stop-forcing-conversations-sidebar");
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user