blixify-ui-web-mcp 0.1.2 → 0.1.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/components/action/button/README.md +12 -11
- package/lib/components/action/button/button.stories.tsx +4 -10
- package/lib/components/action/buttonGroup/buttonGroup.stories.tsx +4 -10
- package/lib/components/action/iconButton/iconButton.stories.tsx +4 -10
- package/lib/components/action/radioList/radioList.stories.tsx +4 -10
- package/lib/components/action/slider/slider.stories.tsx +4 -10
- package/lib/components/action/textButton/textButton.stories.tsx +4 -10
- package/lib/components/action/toggle/toggle.stories.tsx +4 -10
- package/lib/components/advanced/collapse/collapse.stories.tsx +4 -10
- package/lib/components/advanced/infoWindow/infoWindow.stories.tsx +4 -10
- package/lib/components/advanced/popUp/README.md +21 -7
- package/lib/components/advanced/popUp/popUp.stories.tsx +4 -10
- package/lib/components/auth/bareSignIn/bareSignIn.stories.tsx +30 -10
- package/lib/components/auth/bareSignUp/bareSignUp.stories.tsx +4 -10
- package/lib/components/auth/signIn/signIn.stories.tsx +4 -10
- package/lib/components/auth/signUp/signUp.stories.tsx +4 -10
- package/lib/components/chart/areaChart/areaChart.stories.tsx +7 -13
- package/lib/components/chart/barChart/barChart.stories.tsx +7 -13
- package/lib/components/chart/boxPlotChart/boxPlotChart.stories.tsx +8 -14
- package/lib/components/chart/bubbleChart/bubbleChart.stories.tsx +8 -14
- package/lib/components/chart/card/card.stories.tsx +4 -10
- package/lib/components/chart/ganttChart/README.md +96 -110
- package/lib/components/chart/ganttChart/ganttChart.stories.tsx +135 -125
- package/lib/components/chart/heatmapChart/README.md +93 -82
- package/lib/components/chart/heatmapChart/heatmapChart.stories.tsx +122 -84
- package/lib/components/chart/lineChart/lineChart.stories.tsx +4 -10
- package/lib/components/chart/pieChart/pieChart.stories.tsx +4 -10
- package/lib/components/chart/polarAreaChart/polarAreaChart.stories.tsx +8 -14
- package/lib/components/chart/radarChart/radarChart.stories.tsx +4 -10
- package/lib/components/chart/radialBar/radialChart.stories.tsx +4 -10
- package/lib/components/chart/rangeBarChart/rangeBarChart.stories.tsx +4 -10
- package/lib/components/chart/statsCard/statsCard.stories.tsx +4 -10
- package/lib/components/chart/treemapChart/treemapChart.stories.tsx +8 -14
- package/lib/components/chat/chatAnchor/README.md +61 -79
- package/lib/components/chat/chatAnchor/chatAnchor.stories.tsx +13 -19
- package/lib/components/chat/chatBase/README.md +244 -196
- package/lib/components/chat/chatBase/chatBase.stories.tsx +828 -250
- package/lib/components/chat/chatDashboard/README.md +89 -129
- package/lib/components/chat/chatDashboard/chatDashboard.stories.tsx +406 -117
- package/lib/components/data/dataGraph/README.md +135 -1
- package/lib/components/data/dataGraph/dataGraph.stories.tsx +90 -77
- package/lib/components/data/dataReference/README.md +141 -43
- package/lib/components/data/dataReference/dataReference.stories.tsx +111 -45
- package/lib/components/data/dataTemplate/README.md +88 -61
- package/lib/components/data/dataTemplate/dataModule.stories.tsx +4 -10
- package/lib/components/data/dataTemplate/dataTemplate.stories.tsx +4 -10
- package/lib/components/data/dataWrapper/README.md +48 -46
- package/lib/components/data/dataWrapper/dataWrapper.stories.tsx +258 -489
- package/lib/components/data/queryForm/queryForm.stories.tsx +4 -10
- package/lib/components/data/readQuery/readQuery.stories.tsx +4 -9
- package/lib/components/data/readQueryHoc/readQueryHoc.stories.tsx +4 -10
- package/lib/components/data/writeQuery/writeQuery.stories.tsx +4 -8
- package/lib/components/design/actionSection/actionSection.stories.tsx +6 -10
- package/lib/components/design/banner/banner.stories.tsx +4 -10
- package/lib/components/design/bannerAction/bannerAction.stories.tsx +4 -10
- package/lib/components/design/blogSection/blogSection.stories.tsx +4 -10
- package/lib/components/design/carouselSection/carouselSection.stories.tsx +4 -10
- package/lib/components/design/designList/designList.stories.tsx +4 -10
- package/lib/components/design/faq/faq.stories.tsx +4 -10
- package/lib/components/design/fileGrid/fileGrid.stories.tsx +4 -10
- package/lib/components/design/fileViewer/fileViewer.stories.tsx +4 -10
- package/lib/components/design/footerSection/footerSection.stories.tsx +4 -10
- package/lib/components/design/googleReview/googleReview.stories.tsx +4 -10
- package/lib/components/design/heroSection/heroSection.stories.tsx +4 -10
- package/lib/components/design/iconList/iconList.stories.tsx +4 -10
- package/lib/components/design/imageGallery/imageGallery.stories.tsx +4 -10
- package/lib/components/design/imageZoom/imageZoom.stories.tsx +4 -10
- package/lib/components/design/leftContent/leftContent.stories.tsx +4 -10
- package/lib/components/design/logoCloud/logoCloud.stories.tsx +4 -10
- package/lib/components/design/onboarding/onboarding.stories.tsx +4 -10
- package/lib/components/design/pricing/pricing.stories.tsx +4 -10
- package/lib/components/design/rightContent/rightContent.stories.tsx +4 -10
- package/lib/components/design/sectionList/sectionList.stories.tsx +4 -10
- package/lib/components/design/teams/teams.stories.tsx +4 -10
- package/lib/components/display/alert/alert.stories.tsx +4 -10
- package/lib/components/display/calendar/README.md +49 -0
- package/lib/components/display/calendar/calendar.stories.tsx +71 -28
- package/lib/components/display/clipboard/clipboard.stories.tsx +4 -10
- package/lib/components/display/detailList/detailList.stories.tsx +5 -10
- package/lib/components/display/drawer/drawer.stories.tsx +5 -10
- package/lib/components/display/emptyState/emptyState.stories.tsx +4 -10
- package/lib/components/display/feeds/feeds.stories.tsx +4 -10
- package/lib/components/display/flexTable/README.md +11 -7
- package/lib/components/display/flexTable/flexTable.stories.tsx +114 -11
- package/lib/components/display/grid/README.md +28 -27
- package/lib/components/display/grid/grid.stories.tsx +4 -10
- package/lib/components/display/kanban/kanban.stories.tsx +14 -20
- package/lib/components/display/list/README.md +30 -29
- package/lib/components/display/list/list.stories.tsx +4 -10
- package/lib/components/display/loading/loading.stories.tsx +5 -10
- package/lib/components/display/mapView/mapView.stories.tsx +4 -10
- package/lib/components/display/modal/modal.stories.tsx +4 -11
- package/lib/components/display/notification/notification.stories.tsx +4 -10
- package/lib/components/display/progress/progress.stories.tsx +5 -10
- package/lib/components/display/stepper/stepper.stories.tsx +5 -10
- package/lib/components/display/table/README.md +38 -37
- package/lib/components/display/table/table.stories.tsx +8 -14
- package/lib/components/display/tag/tag.stories.tsx +4 -10
- package/lib/components/input/address/address.stories.tsx +4 -10
- package/lib/components/input/canvas/canvas.stories.tsx +4 -10
- package/lib/components/input/checkbox/checkbox.stories.tsx +4 -10
- package/lib/components/input/datePicker/datePicker.stories.tsx +4 -10
- package/lib/components/input/form/form.stories.tsx +4 -10
- package/lib/components/input/markdown/markdown.stories.tsx +5 -10
- package/lib/components/input/monthYearPicker/monthYearPicker.stories.tsx +4 -10
- package/lib/components/input/netPromoterScore/netPromoterScore.stories.tsx +4 -10
- package/lib/components/input/rating/rating.stories.tsx +4 -10
- package/lib/components/input/select/README.md +30 -29
- package/lib/components/input/select/select.stories.tsx +4 -10
- package/lib/components/input/signature/signature.stories.tsx +4 -10
- package/lib/components/input/textArea/textArea.stories.tsx +4 -10
- package/lib/components/input/textInput/textinput.stories.tsx +4 -10
- package/lib/components/input/uploadInput/uploadInput.stories.tsx +135 -11
- package/lib/components/navigation/bars/README.md +90 -17
- package/lib/components/navigation/bars/bars.stories.tsx +128 -60
- package/lib/components/navigation/bottomTab/bottomTab.stories.tsx +5 -10
- package/lib/components/navigation/breadcrumb/README.md +40 -20
- package/lib/components/navigation/breadcrumb/breadcrumb.stories.tsx +34 -14
- package/lib/components/navigation/header/README.md +67 -108
- package/lib/components/navigation/header/header.stories.tsx +165 -49
- package/lib/components/navigation/leftNav/README.md +121 -66
- package/lib/components/navigation/leftNav/leftNav.stories.tsx +178 -91
- package/lib/components/navigation/tabs/tabs.stories.tsx +57 -39
- package/lib/components/structure/column/column.stories.tsx +5 -10
- package/lib/components/structure/container/container.stories.tsx +5 -10
- package/lib/components/structure/link/link.stories.tsx +4 -10
- package/lib/components/structure/text/text.stories.tsx +5 -10
- package/lib/components/template/authPage/authPage.stories.tsx +6 -5
- package/lib/components/template/landingPage/landingPage.stories.tsx +8 -6
- package/lib/components/template/productListing/productListing.stories.tsx +7 -13
- package/lib/components/template/productOverview/productOverview.stories.tsx +5 -11
- package/lib/components/template/shoppingCart/shoppingCart.stories.tsx +6 -12
- package/lib/components/template/userHomePage/userHomePage.stories.tsx +7 -6
- package/lib/components/template/userRankingDashboard/userRankingDashboard.stories.tsx +5 -11
- package/package.json +1 -1
|
@@ -4,220 +4,268 @@
|
|
|
4
4
|
|
|
5
5
|
<hr>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
A chat window component with message bubbles, markdown rendering for received messages, message search, file upload (images, videos, PDFs, and other documents), a loading reply indicator, tool report logs, tool call chips, and customisable header/footer/body slots.
|
|
8
8
|
|
|
9
9
|
##### Import
|
|
10
10
|
|
|
11
11
|
```js
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
ChatBase,
|
|
14
|
+
Conversation,
|
|
15
|
+
Message,
|
|
16
|
+
ToolReport,
|
|
17
|
+
ToolCall,
|
|
18
|
+
User,
|
|
19
|
+
} from "blixify-ui-web/components/chat/chatBase";
|
|
13
20
|
```
|
|
14
21
|
|
|
15
22
|
##### Usage
|
|
16
23
|
|
|
17
|
-
|
|
18
|
-
const [message, setMessage] = useState("");
|
|
19
|
-
const [search, setSearch] = useState("");
|
|
20
|
-
const [filteredConversation, setFilteredConversation] =
|
|
21
|
-
useState<Conversation | null>();
|
|
22
|
-
const [conversation, setConversation] = useState<Conversation>({
|
|
23
|
-
id: "1",
|
|
24
|
-
members: [currentUser, botUser],
|
|
25
|
-
messageList: [
|
|
26
|
-
{
|
|
27
|
-
sender: botUser,
|
|
28
|
-
messageBody: "Hi! How can I help you? 🤖",
|
|
29
|
-
createdAt: moment(
|
|
30
|
-
"Fri Nov 03 2023 12:21:14 GMT+0800 (Malaysia Time)"
|
|
31
|
-
).toDate(),
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
sender: currentUser,
|
|
35
|
-
messageBody: "Yo, my computer's acting up.",
|
|
36
|
-
createdAt: moment(
|
|
37
|
-
"Fri Nov 03 2023 13:21:14 GMT+0800 (Malaysia Time)"
|
|
38
|
-
).toDate(),
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
const handleOnSendMessage = (conversation: Conversation) => {
|
|
44
|
-
setConversation(conversation);
|
|
45
|
-
setMessage("");
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const handleOnSearch = (searchMessage: string) => {
|
|
49
|
-
if (searchMessage.length === 0) {
|
|
50
|
-
setSearch("");
|
|
51
|
-
setFilteredConversation(null);
|
|
52
|
-
} else {
|
|
53
|
-
const dupMessageList = conversation.messageList.filter((eachMessage) => {
|
|
54
|
-
return eachMessage.messageBody
|
|
55
|
-
.toLowerCase()
|
|
56
|
-
.includes(searchMessage.toLowerCase());
|
|
57
|
-
});
|
|
58
|
-
const dupConversation = {
|
|
59
|
-
id: conversation.id,
|
|
60
|
-
members: [...conversation.members],
|
|
61
|
-
messageList: [...dupMessageList],
|
|
62
|
-
};
|
|
63
|
-
setFilteredConversation(dupConversation);
|
|
64
|
-
}
|
|
65
|
-
};
|
|
24
|
+
Basic chat:
|
|
66
25
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
26
|
+
```jsx
|
|
27
|
+
const [message, setMessage] = useState("");
|
|
28
|
+
const [conversation, setConversation] =
|
|
29
|
+
useState <
|
|
30
|
+
Conversation >
|
|
31
|
+
{
|
|
70
32
|
id: "1",
|
|
71
33
|
members: [currentUser, botUser],
|
|
72
|
-
messageList: [
|
|
73
|
-
|
|
74
|
-
|
|
34
|
+
messageList: [
|
|
35
|
+
{
|
|
36
|
+
sender: botUser,
|
|
37
|
+
messageBody: "Hi! How can I help?",
|
|
38
|
+
createdAt: new Date(),
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
<ChatBase
|
|
44
|
+
open
|
|
45
|
+
value={message}
|
|
46
|
+
currentUser={currentUser}
|
|
47
|
+
conversation={conversation}
|
|
48
|
+
onSendMessage={(updated) => {
|
|
49
|
+
setConversation(updated);
|
|
50
|
+
setMessage("");
|
|
51
|
+
}}
|
|
52
|
+
onChangeMessage={(e) => setMessage(e.target.value)}
|
|
53
|
+
sizeClassName="h-[500px] w-96"
|
|
54
|
+
disableMobileResize
|
|
55
|
+
/>;
|
|
56
|
+
```
|
|
75
57
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
</p>
|
|
92
|
-
<TextButton
|
|
93
|
-
text="Clear now"
|
|
94
|
-
onClick={handleOnClearMessage}
|
|
95
|
-
className="mt-2"
|
|
96
|
-
/>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
);
|
|
100
|
-
else return <></>;
|
|
101
|
-
};
|
|
102
|
-
const footerElement = renderFooterElement();
|
|
58
|
+
With search:
|
|
59
|
+
|
|
60
|
+
```jsx
|
|
61
|
+
<ChatBase
|
|
62
|
+
open
|
|
63
|
+
value={message}
|
|
64
|
+
currentUser={currentUser}
|
|
65
|
+
conversation={filteredConversation ?? conversation}
|
|
66
|
+
searchMessage={search}
|
|
67
|
+
onSearch={(q) => { /* filter conversation.messageList */ }}
|
|
68
|
+
onChangeSearch={(e) => setSearch(e.target.value)}
|
|
69
|
+
onSendMessage={...}
|
|
70
|
+
onChangeMessage={...}
|
|
71
|
+
/>
|
|
72
|
+
```
|
|
103
73
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
74
|
+
With file upload:
|
|
75
|
+
|
|
76
|
+
```jsx
|
|
77
|
+
<ChatBase
|
|
78
|
+
open
|
|
79
|
+
value={message}
|
|
80
|
+
currentUser={currentUser}
|
|
81
|
+
conversation={conversation}
|
|
82
|
+
fileUpload={{
|
|
83
|
+
allowFileUpload: true,
|
|
84
|
+
file,
|
|
85
|
+
acceptFileType: ".jpg,.jpeg,.png,.mp4,.webm,.pdf,.docx",
|
|
86
|
+
onChangeUpload: (e) => setFile(e.target.files[0]),
|
|
87
|
+
onSendUpload: (conversation, file) => { /* handle upload */ },
|
|
88
|
+
}}
|
|
89
|
+
onSendMessage={...}
|
|
90
|
+
onChangeMessage={...}
|
|
91
|
+
/>
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
With loading reply indicator:
|
|
95
|
+
|
|
96
|
+
```jsx
|
|
97
|
+
<ChatBase
|
|
98
|
+
open
|
|
99
|
+
value={message}
|
|
100
|
+
currentUser={currentUser}
|
|
101
|
+
conversation={conversation}
|
|
102
|
+
isLoadingReply={waitingForBot}
|
|
103
|
+
onSendMessage={...}
|
|
104
|
+
onChangeMessage={...}
|
|
105
|
+
/>
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
With tool report (shows model + tool call status above an assistant message):
|
|
109
|
+
|
|
110
|
+
```jsx
|
|
111
|
+
const assistantMessage: Message = {
|
|
112
|
+
sender: botUser,
|
|
113
|
+
messageBody: "Your order is out for delivery.",
|
|
114
|
+
createdAt: new Date(),
|
|
115
|
+
toolReport: {
|
|
116
|
+
model: "gemini-2.0-flash",
|
|
117
|
+
tools: [
|
|
118
|
+
{ content: "search_orders", request: {}, response: {}, status: "done" },
|
|
119
|
+
{
|
|
120
|
+
content: "fetch_delivery_status",
|
|
121
|
+
request: {},
|
|
122
|
+
response: {},
|
|
123
|
+
status: "done",
|
|
124
|
+
},
|
|
125
|
+
],
|
|
109
126
|
},
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
className="border border-gray-200 shadow-lg w-96"
|
|
127
|
-
disableMobileResize
|
|
128
|
-
disableMessageInput={conversation.messageList.length >= messageLimit}
|
|
129
|
-
onHiddenChatText={true}
|
|
130
|
-
/>
|
|
131
|
-
);
|
|
127
|
+
};
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Status dot colours: `"pending"` → yellow pulsing, `"done"` → green, `"error"` → red.
|
|
131
|
+
|
|
132
|
+
With tool call chips (for AI pipelines that log tool invocations as separate messages):
|
|
133
|
+
|
|
134
|
+
```jsx
|
|
135
|
+
// Messages where author === "tool" should set isToolCall: true.
|
|
136
|
+
// They render as a small centred chip instead of a chat bubble.
|
|
137
|
+
const toolCallMessage: Message = {
|
|
138
|
+
sender: botUser,
|
|
139
|
+
messageBody: "fetch_policy_details",
|
|
140
|
+
createdAt: new Date(),
|
|
141
|
+
isToolCall: true,
|
|
142
|
+
};
|
|
132
143
|
```
|
|
133
144
|
|
|
134
145
|
##### Required props
|
|
135
146
|
|
|
136
|
-
| Name
|
|
137
|
-
|
|
|
138
|
-
| open | `boolean` |
|
|
139
|
-
| value | `string` |
|
|
140
|
-
| currentUser | `User` |
|
|
141
|
-
| conversation | `Conversation` | Conversation
|
|
147
|
+
| Name | Type | Description |
|
|
148
|
+
| -------------- | -------------- | -------------------------------------------------------------------- |
|
|
149
|
+
| `open` | `boolean` | When `false`, the component renders nothing |
|
|
150
|
+
| `value` | `string` | Current message input value |
|
|
151
|
+
| `currentUser` | `User` | The logged-in user — used to determine which side messages appear on |
|
|
152
|
+
| `conversation` | `Conversation` | The conversation to display — see Conversation below |
|
|
142
153
|
|
|
143
154
|
##### Optional props
|
|
144
155
|
|
|
145
|
-
| Name
|
|
146
|
-
|
|
|
147
|
-
|
|
|
148
|
-
|
|
|
149
|
-
|
|
|
150
|
-
|
|
|
151
|
-
|
|
|
152
|
-
|
|
|
153
|
-
|
|
|
154
|
-
|
|
|
155
|
-
|
|
|
156
|
-
|
|
|
157
|
-
| disableMobileResize
|
|
158
|
-
|
|
|
159
|
-
|
|
|
160
|
-
|
|
|
161
|
-
|
|
|
162
|
-
|
|
|
163
|
-
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
|
172
|
-
|
|
|
173
|
-
| `
|
|
174
|
-
| `
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
|
182
|
-
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
|
211
|
-
|
|
|
212
|
-
| `
|
|
213
|
-
| `
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
| Name
|
|
220
|
-
|
|
|
221
|
-
| `
|
|
222
|
-
| `
|
|
223
|
-
|
|
156
|
+
| Name | Type | Default | Description |
|
|
157
|
+
| ---------------------- | -------------------------------------- | ----------------------------------- | --------------------------------------------------------------------------------------------- |
|
|
158
|
+
| `fileUpload` | `FileUpload` | — | Enables file upload — see FileUpload below |
|
|
159
|
+
| `searchMessage` | `string` | — | Current search input value. Pass the filtered conversation to `conversation` to show results. |
|
|
160
|
+
| `headerElement` | `ReactElement` | — | Replaces the default blue "Chat" header bar |
|
|
161
|
+
| `bodyElement` | `ReactElement` | — | Replaces the default message list. Useful for loading states. |
|
|
162
|
+
| `footerElement` | `ReactElement` | — | Rendered above the message input. Useful for limit warnings or disclaimers. |
|
|
163
|
+
| `additionalAction` | `ChatBaseAction[]` | — | Extra items added to the ⋮ actions dropdown — see ChatBaseAction below |
|
|
164
|
+
| `hideAdditionalAction` | `boolean` | `false` | Hides the ⋮ actions dropdown entirely |
|
|
165
|
+
| `disableMessageInput` | `boolean` | `false` | Disables the message text input |
|
|
166
|
+
| `isLoadingReply` | `boolean` | `false` | Shows an animated typing indicator above the input and disables the input |
|
|
167
|
+
| `onHiddenChatText` | `boolean` | `false` | Hides the text input and paperclip icon. Useful when the input is managed externally. |
|
|
168
|
+
| `disableMobileResize` | `boolean` | `false` | Prevents the component from expanding to full screen on mobile |
|
|
169
|
+
| `sizeClassName` | `string` | `h-full w-full sm:h-[75vh] sm:w-96` | Tailwind classes controlling the component dimensions |
|
|
170
|
+
| `className` | `string` | — | Additional Tailwind classes applied to the outer container |
|
|
171
|
+
| `paddingTop` | `number` | `0` | Top padding in pixels. Used to offset the actions menu in mobile app layouts. |
|
|
172
|
+
| `inputActions` | `ReactElement[]` | — | Extra icon buttons rendered in the input row between the paperclip and the send button |
|
|
173
|
+
| `onSendMessage` | `(conversation: Conversation) => void` | — | Called with the updated conversation (including the new message) when send is triggered |
|
|
174
|
+
| `onChangeMessage` | `(event: any) => void` | — | Called on every keystroke in the message input |
|
|
175
|
+
| `onSearch` | `(searchMessage: string) => void` | — | Called when the search form is submitted |
|
|
176
|
+
| `onChangeSearch` | `(event: any) => void` | — | Called on every keystroke in the search input |
|
|
177
|
+
| `onClose` | `() => void` | — | Called when the mobile close (✕) button is tapped |
|
|
178
|
+
| `lib` | `{ axios?: any }` | — | Pass axios for file upload operations |
|
|
179
|
+
|
|
180
|
+
##### FileUpload
|
|
181
|
+
|
|
182
|
+
| Name | Type | Description |
|
|
183
|
+
| ----------------- | ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
|
|
184
|
+
| `allowFileUpload` | `boolean` | Shows the paperclip button to trigger file selection |
|
|
185
|
+
| `hasFiles` | `boolean` | Tells the component files are selected — shows the send button and triggers `onSendMessage` on send |
|
|
186
|
+
| `multiple` | `boolean` | Allows picking multiple files at once |
|
|
187
|
+
| `acceptFileType` | `string` | Comma-separated accepted extensions, e.g. `".jpg,.png,.mp4,.pdf,.docx"`. Defaults to images only if omitted. |
|
|
188
|
+
| `onChangeUpload` | `(event: any) => void` | Called when files are selected via the file input. Consumer extracts files from `event.target.files` and manages their own `File[]` state |
|
|
189
|
+
|
|
190
|
+
##### File rendering in message bubbles
|
|
191
|
+
|
|
192
|
+
| File type | Behaviour |
|
|
193
|
+
| ----------------- | ---------------------------------------------------------------------------------------------------- |
|
|
194
|
+
| `image/*` | Renders as an inline image. Click to open a full-size preview modal. Hover to download. |
|
|
195
|
+
| `video/*` | Renders as an inline video player. Hover to download. |
|
|
196
|
+
| `application/pdf` | Renders as a document icon + filename. Click to open a PDF preview modal. Download link shown below. |
|
|
197
|
+
| Other | Renders as a document icon + filename with a "Cannot preview" label. Download link shown below. |
|
|
198
|
+
|
|
199
|
+
##### ChatBaseAction
|
|
200
|
+
|
|
201
|
+
| Name | Type | Description |
|
|
202
|
+
| --------- | ------------- | ---------------------------------------- |
|
|
203
|
+
| `text` | `string` | Label shown in the dropdown item |
|
|
204
|
+
| `onClick` | `() => void` | Called when the dropdown item is clicked |
|
|
205
|
+
| `icon` | `JSX.Element` | Icon rendered to the left of the label |
|
|
206
|
+
|
|
207
|
+
##### Conversation
|
|
208
|
+
|
|
209
|
+
| Name | Type | Description |
|
|
210
|
+
| ------------- | ----------- | -------------------------------- |
|
|
211
|
+
| `id` | `string` | Unique conversation identifier |
|
|
212
|
+
| `members` | `User[]` | Participants in the conversation |
|
|
213
|
+
| `messageList` | `Message[]` | Ordered list of messages |
|
|
214
|
+
|
|
215
|
+
##### Message
|
|
216
|
+
|
|
217
|
+
| Name | Type | Description |
|
|
218
|
+
| -------------- | ------------------- | ----------------------------------------------------------------------------------------------------------------- |
|
|
219
|
+
| `sender` | `User` | The user who sent the message |
|
|
220
|
+
| `messageBody` | `string \| FileObj` | Text content (supports markdown for received messages) or a `FileObj` for image, video, PDF, or document messages |
|
|
221
|
+
| `reactElement` | `ReactElement` | Optional — replaces `messageBody` rendering with a custom element |
|
|
222
|
+
| `createdAt` | `Date` | Timestamp shown below the message bubble |
|
|
223
|
+
| `toolReport` | `ToolReport` | Optional — renders a compact tool log panel above the message body (see ToolReport below) |
|
|
224
|
+
| `isToolCall` | `boolean` | Optional — renders the message as a centred chip instead of a chat bubble (see Tool Calls) |
|
|
225
|
+
|
|
226
|
+
##### ToolReport
|
|
227
|
+
|
|
228
|
+
Attach to an assistant `Message` to show which model and tools were used to produce the reply.
|
|
229
|
+
|
|
230
|
+
| Name | Type | Description |
|
|
231
|
+
| ------- | ------------ | ------------------------------------ |
|
|
232
|
+
| `model` | `string` | Optional model name shown at the top |
|
|
233
|
+
| `tools` | `ToolCall[]` | List of tool calls and their status |
|
|
234
|
+
|
|
235
|
+
##### ToolCall
|
|
236
|
+
|
|
237
|
+
| Name | Type | Description |
|
|
238
|
+
| ---------- | -------------------------------- | -------------------------------------------------------------------------------- |
|
|
239
|
+
| `content` | `string` | Tool name displayed in the summary row |
|
|
240
|
+
| `request` | `string \| any` | Request payload — shown in the expandable details panel |
|
|
241
|
+
| `response` | `any` | Response payload — shown in the expandable details panel |
|
|
242
|
+
| `status` | `"pending" \| "done" \| "error"` | Dot colour: yellow pulsing (pending), green (done), red (error). Default pending |
|
|
243
|
+
|
|
244
|
+
##### Tool Calls
|
|
245
|
+
|
|
246
|
+
When an AI pipeline stores tool invocations as separate messages (e.g. `author: "tool"` in a database), set `isToolCall: true` on those messages. They render as small centred chips between conversation bubbles — visually distinct from user/assistant messages.
|
|
247
|
+
|
|
248
|
+
```jsx
|
|
249
|
+
const messages = chatList.map((chat) => ({
|
|
250
|
+
sender: chat.author === "assistant" ? botUser : userObj,
|
|
251
|
+
messageBody: chat.content,
|
|
252
|
+
createdAt: new Date(chat.createdAt),
|
|
253
|
+
isToolCall: chat.author === "tool",
|
|
254
|
+
}));
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
##### User
|
|
258
|
+
|
|
259
|
+
| Name | Type | Description |
|
|
260
|
+
| ---------- | -------- | -------------------------------------------------- |
|
|
261
|
+
| `id` | `string` | Unique user identifier |
|
|
262
|
+
| `name` | `string` | Display name shown above received message bubbles |
|
|
263
|
+
| `imageUrl` | `string` | Optional avatar URL. Falls back to a default icon. |
|
|
264
|
+
|
|
265
|
+
##### FileObj
|
|
266
|
+
|
|
267
|
+
| Name | Type | Description |
|
|
268
|
+
| ---------- | -------- | ----------------------------------------------------------------- |
|
|
269
|
+
| `fileName` | `string` | File URL or path |
|
|
270
|
+
| `token` | `string` | Unique file token — also used as the display name in the bubble |
|
|
271
|
+
| `type` | `string` | MIME type, e.g. `"image/png"`, `"video/mp4"`, `"application/pdf"` |
|