This repository was archived by the owner on Jul 22, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +56
-9
lines changed Expand file tree Collapse file tree 7 files changed +56
-9
lines changed Original file line number Diff line number Diff line change 1+ import { i18n } from " discourse-i18n" ;
2+
3+ <template >
4+ <div class =" ai-bot-sidebar-empty-state" >
5+ {{i18n " discourse_ai.ai_bot.sidebar_empty" }}
6+ </div >
7+ </template >
Original file line number Diff line number Diff line change @@ -9,10 +9,21 @@ export default class AiBotSidebarNewConversation extends Component {
99 @service sidebarState;
1010
1111 get shouldRender () {
12- return (
13- this .router .currentRouteName !== " discourse-ai-bot-conversations" &&
14- this .sidebarState .isCurrentPanel (AI_CONVERSATIONS_PANEL )
15- );
12+ return this .sidebarState .isCurrentPanel (AI_CONVERSATIONS_PANEL );
13+ }
14+
15+ get disabled () {
16+ return this .router .currentRouteName === " discourse-ai-bot-conversations" ;
17+ }
18+
19+ get label () {
20+ return this .disabled
21+ ? " discourse_ai.ai_bot.conversations.enter_question"
22+ : " discourse_ai.ai_bot.conversations.new" ;
23+ }
24+
25+ get icon () {
26+ return this .disabled ? " keyboard" : " plus" ;
1627 }
1728
1829 @action
@@ -24,8 +35,9 @@ export default class AiBotSidebarNewConversation extends Component {
2435 <template >
2536 {{#if this . shouldRender }}
2637 <DButton
27- @ label =" discourse_ai.ai_bot.conversations.new"
28- @ icon =" plus"
38+ @ label ={{this .label }}
39+ @ icon ={{this .icon }}
40+ @ disabled ={{this .disabled }}
2941 @ action ={{this .routeTo }}
3042 class =" ai-new-question-button btn-default"
3143 />
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export default RouteTemplate(
3131 {{on " input" @ controller.updateInputValue}}
3232 {{on " keydown" @ controller.handleKeyDown}}
3333 id =" ai-bot-conversations-input"
34+ autofocus =" true"
3435 placeholder ={{i18n " discourse_ai.ai_bot.conversations.placeholder" }}
3536 minlength =" 10"
3637 disabled ={{@ controller.loading }}
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { bind } from "discourse/lib/decorators";
66import { autoUpdatingRelativeAge } from "discourse/lib/formatter" ;
77import { withPluginApi } from "discourse/lib/plugin-api" ;
88import { i18n } from "discourse-i18n" ;
9+ import AiBotSidebarEmptyState from "../discourse/components/ai-bot-sidebar-empty-state" ;
910import AiBotSidebarNewConversation from "../discourse/components/ai-bot-sidebar-new-conversation" ;
1011import { AI_CONVERSATIONS_PANEL } from "../discourse/services/ai-conversations-sidebar-manager" ;
1112
@@ -121,6 +122,10 @@ export default {
121122 return "ai-conversations-history" ;
122123 }
123124
125+ get emptyStateComponent ( ) {
126+ return AiBotSidebarEmptyState ;
127+ }
128+
124129 get text ( ) {
125130 return i18n (
126131 "discourse_ai.ai_bot.conversations.messages_sidebar_title"
Original file line number Diff line number Diff line change 673673 share : " Copy AI conversation"
674674 conversation_shared : " Conversation copied"
675675 debug_ai : " View raw AI request and response"
676+ sidebar_empty : " Bot conversation history will appear here."
676677 debug_ai_modal :
677678 title : " View AI interaction"
678679 copy_request : " Copy request"
725726 disclaimer : " Generative AI can make mistakes. Verify important information."
726727 placeholder : " Ask a question..."
727728 new : " New Question"
729+ enter_question : " Enter Question"
728730 min_input_length_message : " Message must be longer than 10 characters"
729731 messages_sidebar_title : " Conversations"
730732 today : " Today"
Original file line number Diff line number Diff line change 200200 expect ( header ) . to have_icon_in_bot_button ( icon : "robot" )
201201 end
202202
203- it "displays sidebar and 'new question' on the topic page" do
203+ it "displays 'new question' button on the topic page" do
204204 topic_page . visit_topic ( pm )
205- expect ( sidebar ) . to be_visible
206- expect ( sidebar ) . to have_css ( "button.ai-new-question-button" )
205+ expect ( sidebar ) . to have_css (
206+ "button.ai-new-question-button" ,
207+ text : I18n . t ( "js.discourse_ai.ai_bot.conversations.new" ) ,
208+ )
209+ end
210+
211+ it "displays 'enter question' button on conversations homepage" do
212+ ai_pm_homepage . visit
213+ expect ( sidebar ) . to have_css (
214+ "button.ai-new-question-button" ,
215+ text : I18n . t ( "js.discourse_ai.ai_bot.conversations.enter_question" ) ,
216+ )
207217 end
208218
209219 it "redirect to the homepage when 'new question' is clicked" do
247257 expect ( sidebar ) . to have_no_section_link ( pm . title )
248258 end
249259
260+ it "renders empty state in sidebar with no bot PM history" do
261+ sign_in ( user_2 )
262+ ai_pm_homepage . visit
263+ expect ( ai_pm_homepage ) . to have_empty_state
264+ end
265+
250266 it "Allows choosing persona and LLM" do
251267 ai_pm_homepage . visit
252268
Original file line number Diff line number Diff line change @@ -40,6 +40,10 @@ def click_new_question_button
4040 page . find ( ".ai-new-question-button" ) . click
4141 end
4242
43+ def has_empty_state?
44+ page . has_css? ( ".ai-bot-sidebar-empty-state" )
45+ end
46+
4347 def click_fist_sidebar_conversation
4448 page . find (
4549 ".sidebar-section[data-section-name='ai-conversations-history'] a.sidebar-section-link:not(.date-heading)" ,
You can’t perform that action at this time.
0 commit comments