Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { AI_CONVERSATIONS_PANEL } from "../services/ai-conversations-sidebar-man
export default class AiBotHeaderIcon extends Component {
@service composer;
@service currentUser;
@service navigationMenu;
@service router;
@service sidebarState;
@service siteSettings;
Expand All @@ -35,6 +36,7 @@ export default class AiBotHeaderIcon extends Component {

get clickShouldRouteOutOfConversations() {
return (
!this.navigationMenu.isHeaderDropdownMode &&
this.siteSettings.ai_enable_experimental_bot_ux &&
this.sidebarState.currentPanel?.key === AI_CONVERSATIONS_PANEL
);
Expand Down
3 changes: 2 additions & 1 deletion assets/javascripts/initializers/ai-conversations-sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,14 @@ export default {
);
const appEvents = api.container.lookup("service:app-events");
const messageBus = api.container.lookup("service:message-bus");
const navigationMenu = api.container.lookup("service:navigationMenu");

api.addSidebarPanel(
(BaseCustomSidebarPanel) =>
class AiConversationsSidebarPanel extends BaseCustomSidebarPanel {
key = AI_CONVERSATIONS_PANEL;
hidden = true;
displayHeader = true;
displayHeader = !navigationMenu.isHeaderDropdownMode;
expandActiveSection = true;
}
);
Expand Down
35 changes: 26 additions & 9 deletions spec/system/ai_bot/homepage_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@

SiteSetting.ai_enable_experimental_bot_ux = true
SiteSetting.ai_bot_enabled = true
SiteSetting.navigation_mode = "sidebar"
Jobs.run_immediately!
SiteSetting.ai_bot_allowed_groups = "#{Group::AUTO_GROUPS[:trust_level_0]}"
sign_in(user)
Expand All @@ -123,15 +124,6 @@
expect(composer).to be_closed
end

it "renders sidebar even when navigation menu is set to header" do
SiteSetting.navigation_menu = "header dropdown"
visit "/"
header.click_bot_button
expect(ai_pm_homepage).to have_homepage
expect(sidebar).to be_visible
expect(header_dropdown).to be_visible
end

it "hides default content in the sidebar" do
visit "/"
header.click_bot_button
Expand Down Expand Up @@ -266,6 +258,31 @@
ai_pm_homepage.llm_selector.select_row_by_name(claude_2_dup.display_name)
ai_pm_homepage.llm_selector.collapse
end

it "renders back to forum link" do
ai_pm_homepage.visit
expect(ai_pm_homepage).to have_sidebar_back_link
end

context "with hamburger menu" do
before { SiteSetting.navigation_menu = "header dropdown" }
it "keeps robot icon in the header and doesn't display sidebar back link" do
visit "/"
expect(header).to have_icon_in_bot_button(icon: "robot")
header.click_bot_button
expect(ai_pm_homepage).to have_homepage
expect(header).to have_icon_in_bot_button(icon: "robot")
expect(ai_pm_homepage).to have_no_sidebar_back_link
end

it "still renders the sidebar" do
visit "/"
header.click_bot_button
expect(ai_pm_homepage).to have_homepage
expect(sidebar).to be_visible
expect(header_dropdown).to be_visible
end
end
end

context "when `ai_enable_experimental_bot_ux` is disabled" do
Expand Down
8 changes: 8 additions & 0 deletions spec/system/page_objects/components/ai_pm_homepage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ def persona_selector
def llm_selector
PageObjects::Components::SelectKit.new(".persona-llm-selector__llm-dropdown")
end

def has_sidebar_back_link?
page.has_css?(".sidebar-sections__back-to-forum")
end

def has_no_sidebar_back_link?
page.has_no_css?(".sidebar-sections__back-to-forum")
end
end
end
end
Loading