@autobe/ui 0.29.2 → 0.30.0-dev.20260315
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/LICENSE +661 -661
- package/README.md +261 -0
- package/lib/components/AutoBeChatMain.js +5 -5
- package/lib/components/AutoBeChatMain.js.map +1 -1
- package/lib/components/AutoBeConfigModal.js +9 -9
- package/lib/components/AutoBeStatusModal.js +4 -4
- package/lib/components/AutoBeStatusModal.js.map +1 -1
- package/lib/components/AutoBeUserMessageMovie.d.ts +2 -2
- package/lib/components/common/ChatBubble.d.ts +2 -2
- package/lib/components/common/openai/OpenAIContent.d.ts +2 -2
- package/lib/components/common/openai/OpenAIContent.js.map +1 -1
- package/lib/components/common/openai/OpenAIUserAudioContent.js +1 -1
- package/lib/components/common/openai/OpenAIUserAudioContent.js.map +1 -1
- package/lib/components/common/openai/OpenAIUserFileContent.js +1 -1
- package/lib/components/common/openai/OpenAIUserFileContent.js.map +1 -1
- package/lib/components/common/openai/OpenAIUserImageContent.d.ts +2 -2
- package/lib/components/events/AutoBeCompleteEventMovie.d.ts +2 -2
- package/lib/components/events/AutoBeCompleteEventMovie.js +5 -5
- package/lib/components/events/AutoBeCompleteEventMovie.js.map +1 -1
- package/lib/components/events/AutoBeCorrectEventMovie.d.ts +2 -2
- package/lib/components/events/AutoBeCorrectEventMovie.js +4 -4
- package/lib/components/events/AutoBeCorrectEventMovie.js.map +1 -1
- package/lib/components/events/AutoBeEventMovie.js +38 -17
- package/lib/components/events/AutoBeEventMovie.js.map +1 -1
- package/lib/components/events/AutoBeProgressEventMovie.js +73 -13
- package/lib/components/events/AutoBeProgressEventMovie.js.map +1 -1
- package/lib/components/events/AutoBeScenarioEventMovie.d.ts +2 -2
- package/lib/components/events/AutoBeScenarioEventMovie.js +18 -5
- package/lib/components/events/AutoBeScenarioEventMovie.js.map +1 -1
- package/lib/components/events/AutoBeStartEventMovie.d.ts +2 -2
- package/lib/components/events/AutoBeStartEventMovie.js +2 -2
- package/lib/components/events/AutoBeStartEventMovie.js.map +1 -1
- package/lib/components/events/AutoBeValidateEventMovie.d.ts +2 -2
- package/lib/components/events/AutoBeValidateEventMovie.js +3 -11
- package/lib/components/events/AutoBeValidateEventMovie.js.map +1 -1
- package/lib/components/events/groups/CorrectEventGroup.d.ts +2 -2
- package/lib/components/events/groups/CorrectEventGroup.js +1 -1
- package/lib/components/events/groups/CorrectEventGroup.js.map +1 -1
- package/lib/components/events/groups/ValidateEventGroup.d.ts +2 -2
- package/lib/components/events/groups/ValidateEventGroup.js +1 -2
- package/lib/components/events/groups/ValidateEventGroup.js.map +1 -1
- package/lib/components/events/utils/eventGrouper.js +1 -2
- package/lib/components/events/utils/eventGrouper.js.map +1 -1
- package/lib/components/upload/AutoBeChatUploadBox.d.ts +3 -4
- package/lib/components/upload/AutoBeChatUploadBox.js +2 -1
- package/lib/components/upload/AutoBeChatUploadBox.js.map +1 -1
- package/lib/components/upload/AutoBeChatUploadSendButton.js +1 -1
- package/lib/components/upload/AutoBeChatUploadSendButton.js.map +1 -1
- package/lib/context/AutoBeAgentContext.d.ts +1 -3
- package/lib/context/AutoBeAgentContext.js +0 -4
- package/lib/context/AutoBeAgentContext.js.map +1 -1
- package/lib/hooks/useSessionStorage.d.ts +4 -0
- package/lib/hooks/useSessionStorage.js +16 -0
- package/lib/hooks/useSessionStorage.js.map +1 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/strategy/AutoBeAgentSessionStorageStrategy.d.ts +10 -0
- package/lib/strategy/AutoBeAgentSessionStorageStrategy.js +117 -0
- package/lib/strategy/AutoBeAgentSessionStorageStrategy.js.map +1 -0
- package/lib/structure/AutoBeListener.js +91 -23
- package/lib/structure/AutoBeListener.js.map +1 -1
- package/lib/structure/AutoBeListenerState.d.ts +3 -3
- package/lib/structure/AutoBeListenerState.js +4 -4
- package/lib/structure/AutoBeListenerState.js.map +1 -1
- package/lib/structure/IAutoBeAgentSessionStorageStrategy.js +1 -1
- package/lib/structure/IAutoBeAgentSessionStorageStrategy.js.map +1 -1
- package/lib/utils/AutoBeFileUploader.d.ts +2 -2
- package/lib/utils/AutoBeFileUploader.js.map +1 -1
- package/package.json +3 -4
- package/src/components/AutoBeAssistantMessageMovie.tsx +22 -22
- package/src/components/AutoBeChatMain.tsx +376 -376
- package/src/components/AutoBeChatSidebar.tsx +414 -414
- package/src/components/AutoBeConfigButton.tsx +83 -83
- package/src/components/AutoBeConfigModal.tsx +443 -443
- package/src/components/AutoBeStatusButton.tsx +75 -75
- package/src/components/AutoBeStatusModal.tsx +486 -484
- package/src/components/AutoBeUserMessageMovie.tsx +27 -27
- package/src/components/common/ActionButton.tsx +205 -205
- package/src/components/common/ActionButtonGroup.tsx +80 -80
- package/src/components/common/AutoBeConfigInput.tsx +185 -185
- package/src/components/common/ChatBubble.tsx +119 -119
- package/src/components/common/Collapsible.tsx +95 -95
- package/src/components/common/CompactSessionIndicator.tsx +73 -73
- package/src/components/common/CompactSessionList.tsx +82 -82
- package/src/components/common/index.ts +8 -8
- package/src/components/common/openai/OpenAIContent.tsx +53 -53
- package/src/components/common/openai/OpenAIUserAudioContent.tsx +70 -70
- package/src/components/common/openai/OpenAIUserFileContent.tsx +76 -76
- package/src/components/common/openai/OpenAIUserImageContent.tsx +34 -34
- package/src/components/common/openai/OpenAIUserTextContent.tsx +15 -15
- package/src/components/common/openai/index.ts +5 -5
- package/src/components/events/AutoBeCompleteEventMovie.tsx +402 -402
- package/src/components/events/AutoBeCorrectEventMovie.tsx +354 -368
- package/src/components/events/AutoBeEventGroupMovie.tsx +18 -18
- package/src/components/events/AutoBeEventMovie.tsx +158 -139
- package/src/components/events/AutoBeProgressEventMovie.tsx +217 -157
- package/src/components/events/AutoBeScenarioEventMovie.tsx +135 -95
- package/src/components/events/AutoBeStartEventMovie.tsx +82 -82
- package/src/components/events/AutoBeValidateEventMovie.tsx +249 -286
- package/src/components/events/README.md +300 -300
- package/src/components/events/common/CollapsibleEventGroup.tsx +211 -211
- package/src/components/events/common/EventCard.tsx +61 -61
- package/src/components/events/common/EventContent.tsx +31 -31
- package/src/components/events/common/EventHeader.tsx +85 -85
- package/src/components/events/common/EventIcon.tsx +82 -82
- package/src/components/events/common/ProgressBar.tsx +64 -64
- package/src/components/events/common/index.ts +13 -13
- package/src/components/events/groups/CorrectEventGroup.tsx +183 -183
- package/src/components/events/groups/ValidateEventGroup.tsx +143 -146
- package/src/components/events/groups/index.ts +8 -8
- package/src/components/events/index.ts +16 -16
- package/src/components/events/utils/eventGrouper.tsx +116 -117
- package/src/components/events/utils/index.ts +1 -1
- package/src/components/index.ts +13 -13
- package/src/components/upload/AutoBeChatUploadBox.tsx +425 -424
- package/src/components/upload/AutoBeChatUploadSendButton.tsx +66 -66
- package/src/components/upload/AutoBeFileUploadBox.tsx +123 -123
- package/src/components/upload/AutoBeUploadConfig.ts +5 -5
- package/src/components/upload/AutoBeVoiceRecoderButton.tsx +100 -100
- package/src/components/upload/index.ts +5 -5
- package/src/constant/color.ts +28 -28
- package/src/context/AutoBeAgentContext.tsx +245 -258
- package/src/context/AutoBeAgentSessionList.tsx +58 -58
- package/src/context/SearchParamsContext.tsx +49 -49
- package/src/hooks/index.ts +3 -3
- package/src/hooks/useEscapeKey.ts +24 -24
- package/src/hooks/useIsomorphicLayoutEffect.ts +8 -8
- package/src/hooks/useMediaQuery.ts +73 -73
- package/src/hooks/useSessionStorage.ts +10 -0
- package/src/icons/Receipt.tsx +74 -74
- package/src/index.ts +9 -8
- package/src/strategy/AutoBeAgentSessionStorageStrategy.ts +127 -0
- package/src/structure/AutoBeListener.ts +373 -304
- package/src/structure/AutoBeListenerState.ts +53 -53
- package/src/structure/IAutoBeAgentSessionStorageStrategy.ts +87 -87
- package/src/structure/IAutoBeEventGroup.ts +6 -6
- package/src/structure/index.ts +4 -4
- package/src/types/config.ts +44 -44
- package/src/types/index.ts +1 -1
- package/src/utils/AutoBeFileUploader.ts +279 -279
- package/src/utils/AutoBeVoiceRecorder.ts +95 -95
- package/src/utils/__tests__/crypto.test.ts +286 -286
- package/src/utils/__tests__/storage.test.ts +229 -229
- package/src/utils/crypto.ts +95 -95
- package/src/utils/index.ts +6 -6
- package/src/utils/number.ts +17 -17
- package/src/utils/storage.ts +96 -96
- package/src/utils/time.ts +14 -14
- package/tsconfig.json +9 -9
- package/vitest.config.ts +15 -15
|
@@ -1,300 +1,300 @@
|
|
|
1
|
-
# AutoBe Event Components
|
|
2
|
-
|
|
3
|
-
Event UI components for the AutoBe platform with comprehensive event handling, grouping, and collapsible functionality.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The AutoBe Event system provides a complete solution for displaying various types of events in the AutoBe workflow. The main entry point is `AutoBeEventMovie`, which intelligently routes different event types to their appropriate components.
|
|
8
|
-
|
|
9
|
-
## Main Event Router
|
|
10
|
-
|
|
11
|
-
### AutoBeEventMovie
|
|
12
|
-
The central component that handles all event types and routes them to appropriate sub-components.
|
|
13
|
-
|
|
14
|
-
```tsx
|
|
15
|
-
import { AutoBeEventMovie } from "@autobe/ui/events";
|
|
16
|
-
|
|
17
|
-
<AutoBeEventMovie
|
|
18
|
-
service={rpcService}
|
|
19
|
-
events={eventArray}
|
|
20
|
-
last={isLastEvent}
|
|
21
|
-
/>
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
**Supported Event Types:**
|
|
25
|
-
- **Message Events**: `userMessage`, `assistantMessage`
|
|
26
|
-
- **Start Events**: `analyzeStart`, `
|
|
27
|
-
- **Scenario Events**: `analyzeScenario`, `
|
|
28
|
-
- **Progress Events**: `analyzeWrite`, `analyzeReview`, `interfaceEndpoints`, `
|
|
29
|
-
- **Validate Events**: `
|
|
30
|
-
- **Complete Events**: `analyzeComplete`, `
|
|
31
|
-
|
|
32
|
-
## Individual Event Components
|
|
33
|
-
|
|
34
|
-
### AutoBeProgressEventMovie
|
|
35
|
-
Shows progress tracking events with animated progress bars and status indicators.
|
|
36
|
-
|
|
37
|
-
```tsx
|
|
38
|
-
import { AutoBeProgressEventMovie } from "@autobe/ui/events";
|
|
39
|
-
|
|
40
|
-
<AutoBeProgressEventMovie event={progressEvent} />
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
### AutoBeValidateEventMovie
|
|
44
|
-
Displays validation events with detailed error/success states and validation results.
|
|
45
|
-
|
|
46
|
-
```tsx
|
|
47
|
-
import { AutoBeValidateEventMovie } from "@autobe/ui/events";
|
|
48
|
-
|
|
49
|
-
<AutoBeValidateEventMovie event={validateEvent} />
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
### AutoBeScenarioEventMovie
|
|
53
|
-
Shows scenario analysis and component generation events with structured data display.
|
|
54
|
-
|
|
55
|
-
```tsx
|
|
56
|
-
import { AutoBeScenarioEventMovie } from "@autobe/ui/events";
|
|
57
|
-
|
|
58
|
-
<AutoBeScenarioEventMovie event={scenarioEvent} />
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
### AutoBeStartEventMovie
|
|
62
|
-
Displays pipeline start events with clean status indicators and timing information.
|
|
63
|
-
|
|
64
|
-
```tsx
|
|
65
|
-
import { AutoBeStartEventMovie } from "@autobe/ui/events";
|
|
66
|
-
|
|
67
|
-
<AutoBeStartEventMovie event={startEvent} />
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
### AutoBeCompleteEventMovie
|
|
71
|
-
Shows completion events with file download capabilities and summary statistics.
|
|
72
|
-
|
|
73
|
-
```tsx
|
|
74
|
-
import { AutoBeCompleteEventMovie } from "@autobe/ui/events";
|
|
75
|
-
|
|
76
|
-
<AutoBeCompleteEventMovie
|
|
77
|
-
event={completeEvent}
|
|
78
|
-
getFiles={service.getFiles}
|
|
79
|
-
/>
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Grouped Event Components
|
|
83
|
-
|
|
84
|
-
### ValidateEventGroup
|
|
85
|
-
Intelligently groups validation events with success rate statistics and collapsible interface.
|
|
86
|
-
|
|
87
|
-
```tsx
|
|
88
|
-
import { ValidateEventGroup } from "@autobe/ui/events";
|
|
89
|
-
|
|
90
|
-
<ValidateEventGroup
|
|
91
|
-
events={validateEvents}
|
|
92
|
-
defaultCollapsed={true}
|
|
93
|
-
/>
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**Features:**
|
|
97
|
-
- Automatic success/failure rate calculation
|
|
98
|
-
- Collapsible interface for better UX
|
|
99
|
-
- Grouped display for multiple validation events
|
|
100
|
-
- Individual event access when expanded
|
|
101
|
-
|
|
102
|
-
## Message Components
|
|
103
|
-
|
|
104
|
-
### AutoBeUserMessageMovie
|
|
105
|
-
Displays user messages with support for various content types (text, files, images, audio).
|
|
106
|
-
|
|
107
|
-
```tsx
|
|
108
|
-
import { AutoBeUserMessageMovie } from "@autobe/ui";
|
|
109
|
-
|
|
110
|
-
<AutoBeUserMessageMovie message={userMessageContents} />
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### AutoBeAssistantMessageMovie
|
|
114
|
-
Shows assistant responses with timestamps and custom assistant names.
|
|
115
|
-
|
|
116
|
-
```tsx
|
|
117
|
-
import { AutoBeAssistantMessageMovie } from "@autobe/ui";
|
|
118
|
-
|
|
119
|
-
<AutoBeAssistantMessageMovie
|
|
120
|
-
text={responseText}
|
|
121
|
-
isoTimestamp={timestamp}
|
|
122
|
-
assistantName="AutoBe"
|
|
123
|
-
/>
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## Automatic Event Grouping
|
|
127
|
-
|
|
128
|
-
Use the `groupEvents` utility to automatically group events by type:
|
|
129
|
-
|
|
130
|
-
```tsx
|
|
131
|
-
import { groupEvents } from "@autobe/ui/events/utils/eventGrouper";
|
|
132
|
-
|
|
133
|
-
const EventList = ({ events }: { events: AutoBeEvent[] }) => {
|
|
134
|
-
const groupedComponents = groupEvents(events, {
|
|
135
|
-
minGroupSize: 3, // Minimum events to form a group
|
|
136
|
-
defaultCollapsed: true, // Start collapsed
|
|
137
|
-
enableGrouping: true, // Enable grouping
|
|
138
|
-
});
|
|
139
|
-
|
|
140
|
-
return (
|
|
141
|
-
<div>
|
|
142
|
-
{groupedComponents}
|
|
143
|
-
</div>
|
|
144
|
-
);
|
|
145
|
-
};
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
## Custom Collapsible Groups
|
|
149
|
-
|
|
150
|
-
Create custom event groups using the `CollapsibleEventGroup` component:
|
|
151
|
-
|
|
152
|
-
```tsx
|
|
153
|
-
import { CollapsibleEventGroup } from "@autobe/ui/events";
|
|
154
|
-
|
|
155
|
-
<CollapsibleEventGroup
|
|
156
|
-
events={customEvents}
|
|
157
|
-
title="Custom Event Group"
|
|
158
|
-
iconType="info"
|
|
159
|
-
getTimestamp={(event) => event.created_at}
|
|
160
|
-
renderEvent={(event, index) => <CustomEventComponent event={event} />}
|
|
161
|
-
renderSummary={(events) => <CustomSummary events={events} />}
|
|
162
|
-
defaultCollapsed={true}
|
|
163
|
-
description="Custom grouped events"
|
|
164
|
-
/>
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
## Common Components
|
|
168
|
-
|
|
169
|
-
### EventCard
|
|
170
|
-
Basic card container for consistent styling across all event types.
|
|
171
|
-
|
|
172
|
-
```tsx
|
|
173
|
-
import { EventCard } from "@autobe/ui/events";
|
|
174
|
-
|
|
175
|
-
<EventCard>
|
|
176
|
-
<div>Your content here</div>
|
|
177
|
-
</EventCard>
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### EventHeader
|
|
181
|
-
Standardized header with icon, title, timestamp, and step numbering.
|
|
182
|
-
|
|
183
|
-
```tsx
|
|
184
|
-
import { EventHeader } from "@autobe/ui/events";
|
|
185
|
-
|
|
186
|
-
<EventHeader
|
|
187
|
-
title="Event Title"
|
|
188
|
-
timestamp="2024-01-01T12:00:00Z"
|
|
189
|
-
iconType="success"
|
|
190
|
-
step={1}
|
|
191
|
-
/>
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
### EventContent
|
|
195
|
-
Consistent content area styling with proper spacing and typography.
|
|
196
|
-
|
|
197
|
-
```tsx
|
|
198
|
-
import { EventContent } from "@autobe/ui/events";
|
|
199
|
-
|
|
200
|
-
<EventContent>
|
|
201
|
-
<div>Your content here</div>
|
|
202
|
-
</EventContent>
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### EventIcon
|
|
206
|
-
Consistent icons for different event states with customizable sizes.
|
|
207
|
-
|
|
208
|
-
```tsx
|
|
209
|
-
import { EventIcon } from "@autobe/ui/events";
|
|
210
|
-
|
|
211
|
-
<EventIcon type="success" size={16} />
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
**Available icon types:** `success`, `progress`, `warning`, `error`, `info`, `start`
|
|
215
|
-
|
|
216
|
-
### ProgressBar
|
|
217
|
-
Reusable progress bar component with customizable styling.
|
|
218
|
-
|
|
219
|
-
```tsx
|
|
220
|
-
import { ProgressBar } from "@autobe/ui/events";
|
|
221
|
-
|
|
222
|
-
<ProgressBar
|
|
223
|
-
current={7}
|
|
224
|
-
total={10}
|
|
225
|
-
color="#4caf50"
|
|
226
|
-
showLabel={true}
|
|
227
|
-
/>
|
|
228
|
-
```
|
|
229
|
-
|
|
230
|
-
## Event Flow Architecture
|
|
231
|
-
|
|
232
|
-
The AutoBe event system follows a predictable flow:
|
|
233
|
-
|
|
234
|
-
1. **Start Events** → Initialize pipeline stages
|
|
235
|
-
2. **Scenario Events** → Analyze and plan components
|
|
236
|
-
3. **Progress Events** → Track ongoing operations
|
|
237
|
-
4. **Validate Events** → Verify outputs and handle errors
|
|
238
|
-
5. **Complete Events** → Finalize and provide results
|
|
239
|
-
|
|
240
|
-
## Advanced Usage
|
|
241
|
-
|
|
242
|
-
### Custom Event Handlers
|
|
243
|
-
|
|
244
|
-
```tsx
|
|
245
|
-
import { AutoBeEventMovie, IAutoBeEventMovieProps } from "@autobe/ui/events";
|
|
246
|
-
|
|
247
|
-
const CustomEventHandler = ({ events, service, last }: IAutoBeEventMovieProps<AutoBeEvent>) => {
|
|
248
|
-
// Pre-process events if needed
|
|
249
|
-
const processedEvents = preprocessEvents(events);
|
|
250
|
-
|
|
251
|
-
return (
|
|
252
|
-
<AutoBeEventMovie
|
|
253
|
-
events={processedEvents}
|
|
254
|
-
service={service}
|
|
255
|
-
last={last}
|
|
256
|
-
/>
|
|
257
|
-
);
|
|
258
|
-
};
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
### Event Filtering
|
|
262
|
-
|
|
263
|
-
```tsx
|
|
264
|
-
const filteredEvents = events.filter(event =>
|
|
265
|
-
!['vendorRequest', 'vendorResponse', 'jsonParseError'].includes(event.type)
|
|
266
|
-
);
|
|
267
|
-
```
|
|
268
|
-
|
|
269
|
-
## TypeScript Support
|
|
270
|
-
|
|
271
|
-
All components are fully typed with comprehensive interfaces:
|
|
272
|
-
|
|
273
|
-
```tsx
|
|
274
|
-
interface IAutoBeEventMovieProps<Event extends AutoBeEvent> {
|
|
275
|
-
service: IAutoBeRpcService;
|
|
276
|
-
events: Event[];
|
|
277
|
-
last: boolean;
|
|
278
|
-
}
|
|
279
|
-
```
|
|
280
|
-
|
|
281
|
-
## Features
|
|
282
|
-
|
|
283
|
-
- 🎯 **Intelligent Routing**: Automatic event type detection and routing
|
|
284
|
-
- 📱 **Responsive Design**: Works seamlessly on all screen sizes
|
|
285
|
-
- 🔄 **Smart Grouping**: Automatic grouping of related events
|
|
286
|
-
- 📊 **Rich Statistics**: Built-in progress and error rate calculations
|
|
287
|
-
- 🎨 **Consistent Styling**: Unified design system across all components
|
|
288
|
-
- 💎 **Full TypeScript**: Complete type safety and IntelliSense support
|
|
289
|
-
- ⚡ **Optimized Performance**: Efficient rendering with minimal re-renders
|
|
290
|
-
- 🔧 **Highly Customizable**: Easy to extend and customize for specific needs
|
|
291
|
-
- 🎪 **Animation Support**: Smooth transitions and progress animations
|
|
292
|
-
- 📁 **File Management**: Built-in file download and management capabilities
|
|
293
|
-
|
|
294
|
-
## Best Practices
|
|
295
|
-
|
|
296
|
-
1. **Always use AutoBeEventMovie** as the main entry point for event rendering
|
|
297
|
-
2. **Group related validation events** for better user experience
|
|
298
|
-
3. **Provide meaningful timestamps** for all events
|
|
299
|
-
4. **Use consistent naming** for custom event types
|
|
300
|
-
5. **Handle edge cases** gracefully with null returns for unsupported events
|
|
1
|
+
# AutoBe Event Components
|
|
2
|
+
|
|
3
|
+
Event UI components for the AutoBe platform with comprehensive event handling, grouping, and collapsible functionality.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The AutoBe Event system provides a complete solution for displaying various types of events in the AutoBe workflow. The main entry point is `AutoBeEventMovie`, which intelligently routes different event types to their appropriate components.
|
|
8
|
+
|
|
9
|
+
## Main Event Router
|
|
10
|
+
|
|
11
|
+
### AutoBeEventMovie
|
|
12
|
+
The central component that handles all event types and routes them to appropriate sub-components.
|
|
13
|
+
|
|
14
|
+
```tsx
|
|
15
|
+
import { AutoBeEventMovie } from "@autobe/ui/events";
|
|
16
|
+
|
|
17
|
+
<AutoBeEventMovie
|
|
18
|
+
service={rpcService}
|
|
19
|
+
events={eventArray}
|
|
20
|
+
last={isLastEvent}
|
|
21
|
+
/>
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
**Supported Event Types:**
|
|
25
|
+
- **Message Events**: `userMessage`, `assistantMessage`
|
|
26
|
+
- **Start Events**: `analyzeStart`, `databaseStart`, `interfaceStart`, `testStart`, `realizeStart`, `realizeTestStart`, `realizeAuthorizationStart`
|
|
27
|
+
- **Scenario Events**: `analyzeScenario`, `databaseComponent`, `interfaceGroups`, `realizeTestReset`
|
|
28
|
+
- **Progress Events**: `analyzeWrite`, `analyzeReview`, `interfaceEndpoints`, `databaseSchema`, `databaseReview`, `interfaceOperations`, `interfaceOperationsReview`, `interfaceAuthorization`, `interfaceSchemas`, `interfaceSchemasReview`, `testWrite`, `testScenarios`, `realizeWrite`, `realizeAuthorizationWrite`, `realizeTestOperation`
|
|
29
|
+
- **Validate Events**: `databaseInsufficient`, `databaseValidate`, `interfaceComplement`, `testValidate`, `realizeValidate`, `realizeAuthorizationValidate`
|
|
30
|
+
- **Complete Events**: `analyzeComplete`, `databaseComplete`, `interfaceComplete`, `testComplete`, `realizeComplete`
|
|
31
|
+
|
|
32
|
+
## Individual Event Components
|
|
33
|
+
|
|
34
|
+
### AutoBeProgressEventMovie
|
|
35
|
+
Shows progress tracking events with animated progress bars and status indicators.
|
|
36
|
+
|
|
37
|
+
```tsx
|
|
38
|
+
import { AutoBeProgressEventMovie } from "@autobe/ui/events";
|
|
39
|
+
|
|
40
|
+
<AutoBeProgressEventMovie event={progressEvent} />
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### AutoBeValidateEventMovie
|
|
44
|
+
Displays validation events with detailed error/success states and validation results.
|
|
45
|
+
|
|
46
|
+
```tsx
|
|
47
|
+
import { AutoBeValidateEventMovie } from "@autobe/ui/events";
|
|
48
|
+
|
|
49
|
+
<AutoBeValidateEventMovie event={validateEvent} />
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### AutoBeScenarioEventMovie
|
|
53
|
+
Shows scenario analysis and component generation events with structured data display.
|
|
54
|
+
|
|
55
|
+
```tsx
|
|
56
|
+
import { AutoBeScenarioEventMovie } from "@autobe/ui/events";
|
|
57
|
+
|
|
58
|
+
<AutoBeScenarioEventMovie event={scenarioEvent} />
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### AutoBeStartEventMovie
|
|
62
|
+
Displays pipeline start events with clean status indicators and timing information.
|
|
63
|
+
|
|
64
|
+
```tsx
|
|
65
|
+
import { AutoBeStartEventMovie } from "@autobe/ui/events";
|
|
66
|
+
|
|
67
|
+
<AutoBeStartEventMovie event={startEvent} />
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
### AutoBeCompleteEventMovie
|
|
71
|
+
Shows completion events with file download capabilities and summary statistics.
|
|
72
|
+
|
|
73
|
+
```tsx
|
|
74
|
+
import { AutoBeCompleteEventMovie } from "@autobe/ui/events";
|
|
75
|
+
|
|
76
|
+
<AutoBeCompleteEventMovie
|
|
77
|
+
event={completeEvent}
|
|
78
|
+
getFiles={service.getFiles}
|
|
79
|
+
/>
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Grouped Event Components
|
|
83
|
+
|
|
84
|
+
### ValidateEventGroup
|
|
85
|
+
Intelligently groups validation events with success rate statistics and collapsible interface.
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { ValidateEventGroup } from "@autobe/ui/events";
|
|
89
|
+
|
|
90
|
+
<ValidateEventGroup
|
|
91
|
+
events={validateEvents}
|
|
92
|
+
defaultCollapsed={true}
|
|
93
|
+
/>
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
**Features:**
|
|
97
|
+
- Automatic success/failure rate calculation
|
|
98
|
+
- Collapsible interface for better UX
|
|
99
|
+
- Grouped display for multiple validation events
|
|
100
|
+
- Individual event access when expanded
|
|
101
|
+
|
|
102
|
+
## Message Components
|
|
103
|
+
|
|
104
|
+
### AutoBeUserMessageMovie
|
|
105
|
+
Displays user messages with support for various content types (text, files, images, audio).
|
|
106
|
+
|
|
107
|
+
```tsx
|
|
108
|
+
import { AutoBeUserMessageMovie } from "@autobe/ui";
|
|
109
|
+
|
|
110
|
+
<AutoBeUserMessageMovie message={userMessageContents} />
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### AutoBeAssistantMessageMovie
|
|
114
|
+
Shows assistant responses with timestamps and custom assistant names.
|
|
115
|
+
|
|
116
|
+
```tsx
|
|
117
|
+
import { AutoBeAssistantMessageMovie } from "@autobe/ui";
|
|
118
|
+
|
|
119
|
+
<AutoBeAssistantMessageMovie
|
|
120
|
+
text={responseText}
|
|
121
|
+
isoTimestamp={timestamp}
|
|
122
|
+
assistantName="AutoBe"
|
|
123
|
+
/>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Automatic Event Grouping
|
|
127
|
+
|
|
128
|
+
Use the `groupEvents` utility to automatically group events by type:
|
|
129
|
+
|
|
130
|
+
```tsx
|
|
131
|
+
import { groupEvents } from "@autobe/ui/events/utils/eventGrouper";
|
|
132
|
+
|
|
133
|
+
const EventList = ({ events }: { events: AutoBeEvent[] }) => {
|
|
134
|
+
const groupedComponents = groupEvents(events, {
|
|
135
|
+
minGroupSize: 3, // Minimum events to form a group
|
|
136
|
+
defaultCollapsed: true, // Start collapsed
|
|
137
|
+
enableGrouping: true, // Enable grouping
|
|
138
|
+
});
|
|
139
|
+
|
|
140
|
+
return (
|
|
141
|
+
<div>
|
|
142
|
+
{groupedComponents}
|
|
143
|
+
</div>
|
|
144
|
+
);
|
|
145
|
+
};
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## Custom Collapsible Groups
|
|
149
|
+
|
|
150
|
+
Create custom event groups using the `CollapsibleEventGroup` component:
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
import { CollapsibleEventGroup } from "@autobe/ui/events";
|
|
154
|
+
|
|
155
|
+
<CollapsibleEventGroup
|
|
156
|
+
events={customEvents}
|
|
157
|
+
title="Custom Event Group"
|
|
158
|
+
iconType="info"
|
|
159
|
+
getTimestamp={(event) => event.created_at}
|
|
160
|
+
renderEvent={(event, index) => <CustomEventComponent event={event} />}
|
|
161
|
+
renderSummary={(events) => <CustomSummary events={events} />}
|
|
162
|
+
defaultCollapsed={true}
|
|
163
|
+
description="Custom grouped events"
|
|
164
|
+
/>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Common Components
|
|
168
|
+
|
|
169
|
+
### EventCard
|
|
170
|
+
Basic card container for consistent styling across all event types.
|
|
171
|
+
|
|
172
|
+
```tsx
|
|
173
|
+
import { EventCard } from "@autobe/ui/events";
|
|
174
|
+
|
|
175
|
+
<EventCard>
|
|
176
|
+
<div>Your content here</div>
|
|
177
|
+
</EventCard>
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### EventHeader
|
|
181
|
+
Standardized header with icon, title, timestamp, and step numbering.
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
import { EventHeader } from "@autobe/ui/events";
|
|
185
|
+
|
|
186
|
+
<EventHeader
|
|
187
|
+
title="Event Title"
|
|
188
|
+
timestamp="2024-01-01T12:00:00Z"
|
|
189
|
+
iconType="success"
|
|
190
|
+
step={1}
|
|
191
|
+
/>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### EventContent
|
|
195
|
+
Consistent content area styling with proper spacing and typography.
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
import { EventContent } from "@autobe/ui/events";
|
|
199
|
+
|
|
200
|
+
<EventContent>
|
|
201
|
+
<div>Your content here</div>
|
|
202
|
+
</EventContent>
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
### EventIcon
|
|
206
|
+
Consistent icons for different event states with customizable sizes.
|
|
207
|
+
|
|
208
|
+
```tsx
|
|
209
|
+
import { EventIcon } from "@autobe/ui/events";
|
|
210
|
+
|
|
211
|
+
<EventIcon type="success" size={16} />
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**Available icon types:** `success`, `progress`, `warning`, `error`, `info`, `start`
|
|
215
|
+
|
|
216
|
+
### ProgressBar
|
|
217
|
+
Reusable progress bar component with customizable styling.
|
|
218
|
+
|
|
219
|
+
```tsx
|
|
220
|
+
import { ProgressBar } from "@autobe/ui/events";
|
|
221
|
+
|
|
222
|
+
<ProgressBar
|
|
223
|
+
current={7}
|
|
224
|
+
total={10}
|
|
225
|
+
color="#4caf50"
|
|
226
|
+
showLabel={true}
|
|
227
|
+
/>
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
## Event Flow Architecture
|
|
231
|
+
|
|
232
|
+
The AutoBe event system follows a predictable flow:
|
|
233
|
+
|
|
234
|
+
1. **Start Events** → Initialize pipeline stages
|
|
235
|
+
2. **Scenario Events** → Analyze and plan components
|
|
236
|
+
3. **Progress Events** → Track ongoing operations
|
|
237
|
+
4. **Validate Events** → Verify outputs and handle errors
|
|
238
|
+
5. **Complete Events** → Finalize and provide results
|
|
239
|
+
|
|
240
|
+
## Advanced Usage
|
|
241
|
+
|
|
242
|
+
### Custom Event Handlers
|
|
243
|
+
|
|
244
|
+
```tsx
|
|
245
|
+
import { AutoBeEventMovie, IAutoBeEventMovieProps } from "@autobe/ui/events";
|
|
246
|
+
|
|
247
|
+
const CustomEventHandler = ({ events, service, last }: IAutoBeEventMovieProps<AutoBeEvent>) => {
|
|
248
|
+
// Pre-process events if needed
|
|
249
|
+
const processedEvents = preprocessEvents(events);
|
|
250
|
+
|
|
251
|
+
return (
|
|
252
|
+
<AutoBeEventMovie
|
|
253
|
+
events={processedEvents}
|
|
254
|
+
service={service}
|
|
255
|
+
last={last}
|
|
256
|
+
/>
|
|
257
|
+
);
|
|
258
|
+
};
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
### Event Filtering
|
|
262
|
+
|
|
263
|
+
```tsx
|
|
264
|
+
const filteredEvents = events.filter(event =>
|
|
265
|
+
!['vendorRequest', 'vendorResponse', 'jsonParseError'].includes(event.type)
|
|
266
|
+
);
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
## TypeScript Support
|
|
270
|
+
|
|
271
|
+
All components are fully typed with comprehensive interfaces:
|
|
272
|
+
|
|
273
|
+
```tsx
|
|
274
|
+
interface IAutoBeEventMovieProps<Event extends AutoBeEvent> {
|
|
275
|
+
service: IAutoBeRpcService;
|
|
276
|
+
events: Event[];
|
|
277
|
+
last: boolean;
|
|
278
|
+
}
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
## Features
|
|
282
|
+
|
|
283
|
+
- 🎯 **Intelligent Routing**: Automatic event type detection and routing
|
|
284
|
+
- 📱 **Responsive Design**: Works seamlessly on all screen sizes
|
|
285
|
+
- 🔄 **Smart Grouping**: Automatic grouping of related events
|
|
286
|
+
- 📊 **Rich Statistics**: Built-in progress and error rate calculations
|
|
287
|
+
- 🎨 **Consistent Styling**: Unified design system across all components
|
|
288
|
+
- 💎 **Full TypeScript**: Complete type safety and IntelliSense support
|
|
289
|
+
- ⚡ **Optimized Performance**: Efficient rendering with minimal re-renders
|
|
290
|
+
- 🔧 **Highly Customizable**: Easy to extend and customize for specific needs
|
|
291
|
+
- 🎪 **Animation Support**: Smooth transitions and progress animations
|
|
292
|
+
- 📁 **File Management**: Built-in file download and management capabilities
|
|
293
|
+
|
|
294
|
+
## Best Practices
|
|
295
|
+
|
|
296
|
+
1. **Always use AutoBeEventMovie** as the main entry point for event rendering
|
|
297
|
+
2. **Group related validation events** for better user experience
|
|
298
|
+
3. **Provide meaningful timestamps** for all events
|
|
299
|
+
4. **Use consistent naming** for custom event types
|
|
300
|
+
5. **Handle edge cases** gracefully with null returns for unsupported events
|