Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
380e700
feat(extensions): define the superset.chatbot contribution point (#40…
EnxDev Jun 8, 2026
94e0071
Merge branch 'master' into enxdev/chat-prototype
EnxDev Jun 9, 2026
c65c952
refactor(extensions): remove install/lifecycle/dependency machinery …
EnxDev Jun 9, 2026
09c09f3
refactor: rename chatbot registration location
EnxDev Jun 10, 2026
f170dc1
refactor(chatbot): drop extension settings layer; resolve last-loaded…
EnxDev Jun 11, 2026
568337f
feat(extensions): add dedicated chat contribution type (#41000)
EnxDev Jun 12, 2026
a1eba0f
chore: Cleanup changes in chat feature branch (#41008)
michael-s-molina Jun 12, 2026
715c07b
chore(extensions): remove out-of-scope scaffolding from chat SIP branch
EnxDev Jun 15, 2026
5c1609e
chore(extensions): align naming conventions
EnxDev Jun 15, 2026
395bbb9
chore: More cleanup of chat extension code (#41116)
michael-s-molina Jun 16, 2026
ec623f3
Merge branch 'master' into enxdev/chat-prototype
michael-s-molina Jun 16, 2026
d88a673
chore: Chat extension improvements (#41117)
michael-s-molina Jun 16, 2026
ce0fcf9
Merge branch 'master' into enxdev/chat-prototype
EnxDev Jun 17, 2026
bc3d0af
feat(extensions): add Chat contribution type (SIP-214)
michael-s-molina Jun 18, 2026
43f623c
Merge branch 'master' into chat-contribution-type
michael-s-molina Jun 18, 2026
1847608
Address CodeAnt comments
michael-s-molina Jun 18, 2026
bb9ee35
Fix CI errors
michael-s-molina Jun 18, 2026
0ad3ef2
Remove promise error listener
michael-s-molina Jun 18, 2026
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
23 changes: 20 additions & 3 deletions docs/developer_docs/extensions/contribution-types.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ Frontend contribution types allow extensions to extend Superset's user interface

Extensions can add new views or panels to the host application, such as custom SQL Lab panels, dashboards, or other UI components. Contribution areas are uniquely identified (e.g., `sqllab.panels` for SQL Lab panels), enabling seamless integration into specific parts of the application.

```tsx
import React from 'react';
```typescript
import { views } from '@apache-superset/core';
import MyPanel from './MyPanel';

views.registerView(
{ id: 'my-extension.main', name: 'My Panel Name' },
'sqllab.panels',
() => <MyPanel />,
MyPanel,
);
```

Expand Down Expand Up @@ -112,6 +111,24 @@ editors.registerEditor(

See [Editors Extension Point](./extension-points/editors.md) for implementation details.

### Chat

Extensions can add a chat interface to Superset by registering a trigger component and a panel component. The host owns the layout, open/close state, and display mode — the extension only provides the UI. The panel can be displayed as a floating overlay or docked as a resizable sidebar beside the page content, and the user's preference is persisted across reloads.

```tsx
import { chat } from '@apache-superset/core';
import ChatTrigger from './ChatTrigger';
import ChatPanel from './ChatPanel';

chat.registerChat(
{ id: 'my-org.my-chat', name: 'My Chat' },
ChatTrigger,
ChatPanel,
);
```

See [Chat](./extension-points/chat.md) for implementation details.

## Backend

Backend contribution types allow extensions to extend Superset's server-side capabilities. Backend contributions are registered at startup via classes and functions imported from the auto-discovered `entrypoint.py` file.
Expand Down
140 changes: 140 additions & 0 deletions docs/developer_docs/extensions/extension-points/chat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
title: Chat
sidebar_position: 3
---

<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->

# Chat Contributions

Extensions can add a chat interface to Superset by registering a trigger and a panel. The host owns the layout, open/close state, and display mode — the extension only needs to provide the UI components.

## Overview

A chat registration consists of two React components:

| Component | Role |
|-----------|------|
| **Trigger** | Always-visible entry point (e.g., a floating button). Rendered in the bottom-right corner in floating mode, or as a fixed overlay in panel mode. |
| **Panel** | The chat UI itself (message list, input, etc.). Mounted by the host in the active display mode. |

## Display Modes

The host supports two display modes, switchable by the user or the extension at runtime:

| Mode | Behavior |
|------|----------|
| `floating` | Panel floats above page content, anchored to the bottom-right corner. |
| `panel` | Panel is docked to the right side of the application as a resizable sidebar, sitting beside the page content. |

The user's last selected mode and open/closed state are persisted across page reloads.

## Registering a Chat

Call `chat.registerChat` from your extension's entry point with a descriptor, a trigger factory, and a panel factory:

```tsx
import { chat } from '@apache-superset/core';
import ChatTrigger from './ChatTrigger';
import ChatPanel from './ChatPanel';

chat.registerChat(
{ id: 'my-org.my-chat', name: 'My Chat' },
ChatTrigger,
ChatPanel,
);
```

Only one chat registration is active at a time. If a second extension calls `registerChat`, it replaces the first and a warning is logged.

## Opening and Closing the Chat

The trigger component is responsible for toggling the panel. Use `chat.isOpen()`, `chat.open()`, and `chat.close()` to control visibility:

```tsx
import { chat } from '@apache-superset/core';

export default function ChatTrigger() {
return (
<button onClick={() => (chat.isOpen() ? chat.close() : chat.open())}>
💬
</button>
);
}
```

You can also subscribe to open/close events from any component:

```tsx
useEffect(() => {
const { dispose } = chat.onDidOpen(() => console.log('chat opened'));
return dispose;
}, []);
```

## Changing the Display Mode

Call `chat.setDisplayMode` to switch between `'floating'` and `'panel'` modes. In your panel component, subscribe to `onDidChangeDisplayMode` to react to changes (including those triggered by the user):

```tsx
import { useState, useEffect } from 'react';
import { chat } from '@apache-superset/core';

export default function ChatPanel() {
const [mode, setMode] = useState(chat.getDisplayMode());

useEffect(() => {
const { dispose } = chat.onDidChangeDisplayMode(m => setMode(m));
return dispose;
}, []);

return (
<div style={{ height: mode === 'panel' ? '100%' : '80vh' }}>
<button onClick={() => chat.setDisplayMode(mode === 'panel' ? 'floating' : 'panel')}>
{mode === 'panel' ? 'Float' : 'Dock'}
</button>
{/* message list and input */}
</div>
);
}
```

## Chat API Reference

All methods are available on the `chat` namespace from `@apache-superset/core`:

| Method / Event | Description |
|----------------|-------------|
| `registerChat(descriptor, trigger, panel)` | Register a chat extension. Returns a `Disposable` to unregister. |
| `open()` | Open the chat panel. No-op if already open or no registration. |
| `close()` | Close the chat panel. |
| `isOpen()` | Returns `true` if the panel is currently open. |
| `getDisplayMode()` | Returns the current display mode (`'floating'` or `'panel'`). |
| `setDisplayMode(mode)` | Switch between `'floating'` and `'panel'` mode. |
| `onDidOpen(listener)` | Subscribe to panel open events. Returns a `Disposable`. |
| `onDidClose(listener)` | Subscribe to panel close events. Returns a `Disposable`. |
| `onDidChangeDisplayMode(listener)` | Subscribe to display mode changes. Returns a `Disposable`. |
| `onDidRegisterChat(listener)` | Subscribe to registration events. |
| `onDidUnregisterChat(listener)` | Subscribe to unregistration events. |

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@michael-s-molina would it make sense to add onDidResizePanel() here?

## Next Steps

- **[Contribution Types](../contribution-types.md)** — Explore other contribution types
- **[Development](../development.md)** — Set up your development environment
2 changes: 2 additions & 0 deletions docs/developer_docs/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ module.exports = {
collapsed: true,
items: [
'extensions/extension-points/sqllab',
'extensions/extension-points/editors',
'extensions/extension-points/chat',
],
},
'extensions/development',
Expand Down
30 changes: 30 additions & 0 deletions superset-frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions superset-frontend/packages/superset-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@
"types": "./lib/authentication/index.d.ts",
"default": "./lib/authentication/index.js"
},
"./chat": {
"types": "./lib/chat/index.d.ts",
"default": "./lib/chat/index.js"
},
"./navigation": {
"types": "./lib/navigation/index.d.ts",
"default": "./lib/navigation/index.js"
},
"./commands": {
"types": "./lib/commands/index.d.ts",
"default": "./lib/commands/index.js"
Expand Down
Loading
Loading