MGMT-21123: Add option to start a new chat from scratch#3050
Conversation
|
@celdrake: This pull request references MGMT-21123 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.20.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
WalkthroughA header was added to the chatbot window with "New chat" and "Close chat" buttons. The "New chat" button resets the conversation, while the "Close chat" button invokes a callback to close the window and reset state. Component props and types were updated to support these actions. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ChatBot
participant ChatBotWindow
User->>ChatBotWindow: Clicks "New chat"
ChatBotWindow->>ChatBot: setConversationId(undefined), clearMessages()
User->>ChatBotWindow: Clicks "Close chat"
ChatBotWindow->>ChatBot: onClose()
ChatBot->>ChatBot: setVisible(false), clearMessages(), setConversationId(undefined)
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
libs/chatbot/lib/components/ChatBot/ChatBot.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the config "@openshift-assisted/eslint-config" to extend from. Please check that the name of the config is correct. The config "@openshift-assisted/eslint-config" was referenced from the config file in "/libs/chatbot/.eslintrc.cjs". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. libs/chatbot/lib/components/ChatBot/ChatBotWindow.tsxOops! Something went wrong! :( ESLint: 8.57.1 ESLint couldn't find the config "@openshift-assisted/eslint-config" to extend from. Please check that the name of the config is correct. The config "@openshift-assisted/eslint-config" was referenced from the config file in "/libs/chatbot/.eslintrc.cjs". If you still have problems, please stop by https://eslint.org/chat/help to chat with the team. ✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
|
@celdrake: This pull request references MGMT-21123 which is a valid jira issue. Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.20.0" version, but no target version was set. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository. |
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
libs/chatbot/lib/components/ChatBot/ChatBotWindow.tsx (1)
191-221: Consider improving accessibility and visual consistency.The header implementation is functional but could benefit from some improvements:
- Icon size consistency: The icons use
size={40}which might be too large for a header context- Flex layout: Consider using
alignItemsfor better vertical alignment- Header title: The header appears to only contain buttons - consider adding an actual title
<ChatbotHeader> <ChatbotHeaderTitle> + AI Assistant <Flex justifyContent={{ default: 'justifyContentSpaceBetween' }} + alignItems={{ default: 'alignItemsCenter' }} className="pf-v6-u-w-100" > <FlexItem> <Tooltip content="New chat"> <Button variant="plain" aria-label="New chat" id="new-chat-button" - icon={<PlusIcon size={40} />} + icon={<PlusIcon />} onClick={handleNewChat} /> </Tooltip> </FlexItem> <FlexItem> <Tooltip content="Close chat"> <Button variant="plain" aria-label="Close chat" id="close-chat-button" - icon={<TimesIcon size={40} />} + icon={<TimesIcon />} onClick={onClose} /> </Tooltip> </FlexItem> </Flex> </ChatbotHeaderTitle> </ChatbotHeader>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
libs/chatbot/lib/components/ChatBot/ChatBot.tsx(1 hunks)libs/chatbot/lib/components/ChatBot/ChatBotWindow.tsx(5 hunks)
🔇 Additional comments (4)
libs/chatbot/lib/components/ChatBot/ChatBotWindow.tsx (3)
10-11: LGTM: Import additions are appropriate.The new imports are correctly added to support the header functionality with proper PatternFly components and icons.
Also applies to: 17-24, 26-26
52-52: LGTM: Props updated correctly for new functionality.The type change for
setConversationIdto acceptstring | undefinedproperly supports the reset functionality, and the newonCloseprop follows React callback conventions.Also applies to: 57-57
77-80: LGTM: Clean implementation of new chat functionality.The
handleNewChatfunction correctly resets both the conversation ID and messages array, providing a clean slate for new conversations.libs/chatbot/lib/components/ChatBot/ChatBot.tsx (1)
27-31: LGTM: Proper state cleanup on close.The
onClosecallback correctly handles all necessary state cleanup when the chat is closed:
- Hides the chatbot UI
- Clears message history
- Resets conversation ID
This ensures a clean slate for the next chat session and prevents any state leakage between sessions.
|
/cherry-pick releases/v2.43 |
|
@ammont82: once the present PR merges, I will cherry-pick it on top of DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: ammont82, celdrake The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@ammont82: new pull request created: #3053 DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Adds the ChatbotHeader with two actions:
new-chat-header.mp4
Summary by CodeRabbit
New Features
Bug Fixes