Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions changelogs/fragments/10924.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Add close button for chatbot header ([#10924](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/10924))
3 changes: 3 additions & 0 deletions src/plugins/chat/public/components/chat_header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ interface ChatHeaderProps {
isStreaming: boolean;
onToggleLayout?: () => void;
onNewChat: () => void;
onClose: () => void;
}

export const ChatHeader: React.FC<ChatHeaderProps> = ({
layoutMode,
isStreaming,
onToggleLayout,
onNewChat,
onClose,
}) => {
return (
<div className="chatHeader">
Expand Down Expand Up @@ -56,6 +58,7 @@ export const ChatHeader: React.FC<ChatHeaderProps> = ({
aria-label="New chat"
size="m"
/>
<EuiButtonIcon iconType="cross" onClick={onClose} aria-label="Close chatbot" size="m" />
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ export const ChatHeaderButton = React.forwardRef<ChatHeaderButtonInstance, ChatH
layoutMode={layoutMode}
onToggleLayout={toggleLayoutMode}
ref={chatWindowRef}
onClose={closeSidecar}
/>
</ChatProvider>
</GlobalAssistantProvider>
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/chat/public/components/chat_window.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export interface ChatWindowInstance{
interface ChatWindowProps {
layoutMode?: ChatLayoutMode;
onToggleLayout?: () => void;
onClose: ()=>void;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit nit: seems a formatter problem here?

}

/**
Expand All @@ -53,6 +54,7 @@ export const ChatWindow = React.forwardRef<ChatWindowInstance, ChatWindowProps>(
const ChatWindowContent = React.forwardRef<ChatWindowInstance, ChatWindowProps>(({
layoutMode = ChatLayoutMode.SIDECAR,
onToggleLayout,
onClose,
}, ref) => {
const service = AssistantActionService.getInstance();
const [availableTools, setAvailableTools] = useState<ToolDefinition[]>([]);
Expand Down Expand Up @@ -288,6 +290,7 @@ const ChatWindowContent = React.forwardRef<ChatWindowInstance, ChatWindowProps>(
isStreaming={isStreaming}
onToggleLayout={onToggleLayout}
onNewChat={handleNewChat}
onClose={onClose}
/>

<ChatMessages
Expand Down
Loading