@jazzmine-ui/react 0.1.5 → 0.1.7
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/README.md +124 -3
- package/dist/jazzmine-ui.js +3421 -1230
- package/dist/jazzmine-ui.umd.cjs +17 -2
- package/dist/style.css +1 -1
- package/package.json +7 -2
package/README.md
CHANGED
|
@@ -18,11 +18,12 @@ Peer dependencies:
|
|
|
18
18
|
- react
|
|
19
19
|
- react-dom
|
|
20
20
|
- react-markdown
|
|
21
|
+
- remark-gfm
|
|
21
22
|
|
|
22
23
|
If your project does not already include peer dependencies, install everything together:
|
|
23
24
|
|
|
24
25
|
```bash
|
|
25
|
-
npm install @jazzmine-ui/react react react-dom react-markdown
|
|
26
|
+
npm install @jazzmine-ui/react react react-dom react-markdown remark-gfm
|
|
26
27
|
```
|
|
27
28
|
|
|
28
29
|
## Styles
|
|
@@ -42,6 +43,7 @@ Components:
|
|
|
42
43
|
- MessageList
|
|
43
44
|
- FloatingChatWidget
|
|
44
45
|
- JazzmineChat
|
|
46
|
+
- SearchModal
|
|
45
47
|
|
|
46
48
|
Types:
|
|
47
49
|
|
|
@@ -50,6 +52,7 @@ Types:
|
|
|
50
52
|
- MessageListProps
|
|
51
53
|
- FloatingChatWidgetProps
|
|
52
54
|
- JazzmineChatProps
|
|
55
|
+
- SearchModalProps
|
|
53
56
|
- IJazzmineClient
|
|
54
57
|
- Message
|
|
55
58
|
- Chat
|
|
@@ -63,6 +66,7 @@ import {
|
|
|
63
66
|
MessageList,
|
|
64
67
|
FloatingChatWidget,
|
|
65
68
|
JazzmineChat,
|
|
69
|
+
SearchModal,
|
|
66
70
|
} from '@jazzmine-ui/react';
|
|
67
71
|
|
|
68
72
|
import type {
|
|
@@ -71,6 +75,7 @@ import type {
|
|
|
71
75
|
MessageListProps,
|
|
72
76
|
FloatingChatWidgetProps,
|
|
73
77
|
JazzmineChatProps,
|
|
78
|
+
SearchModalProps,
|
|
74
79
|
IJazzmineClient,
|
|
75
80
|
Message,
|
|
76
81
|
Chat,
|
|
@@ -84,8 +89,11 @@ It manages:
|
|
|
84
89
|
|
|
85
90
|
- conversation creation
|
|
86
91
|
- message sending
|
|
92
|
+
- explicit context forwarding
|
|
87
93
|
- loading state
|
|
88
94
|
- conversation deletion
|
|
95
|
+
- conversation search modal (live search)
|
|
96
|
+
- message history loading on conversation selection
|
|
89
97
|
- basic error fallback behavior
|
|
90
98
|
|
|
91
99
|
You provide a client that matches IJazzmineClient.
|
|
@@ -119,6 +127,7 @@ export function App() {
|
|
|
119
127
|
JazzmineChatProps:
|
|
120
128
|
|
|
121
129
|
- client: IJazzmineClient (required)
|
|
130
|
+
- userId: string (default: 'user')
|
|
122
131
|
- assistantName: string
|
|
123
132
|
- placeholder: string
|
|
124
133
|
- className: string
|
|
@@ -211,7 +220,12 @@ ChatInterfaceProps:
|
|
|
211
220
|
- onSend: (text: string, contexts?: Context[]) => void
|
|
212
221
|
- onNewChat: () => void
|
|
213
222
|
- onSelectChat: (chatId: string) => void
|
|
223
|
+
- onRenameChat: (chatId: string, newTitle?: string) => void
|
|
214
224
|
- onDeleteChat: (chatId: string) => void
|
|
225
|
+
- onSearchClick: () => void
|
|
226
|
+
- onLoadMore: () => void
|
|
227
|
+
- hasMore: boolean
|
|
228
|
+
- isLoadingChats: boolean
|
|
215
229
|
- loadingText: string
|
|
216
230
|
- loadingVariant: text-and-dots | dots-only
|
|
217
231
|
- isLoading: boolean
|
|
@@ -297,9 +311,16 @@ SidebarProps:
|
|
|
297
311
|
- chatActions: ChatAction[]
|
|
298
312
|
- onNewChat: () => void
|
|
299
313
|
- onSelectChat: (chatId: string) => void
|
|
300
|
-
- onRenameChat: (chatId: string) => void
|
|
314
|
+
- onRenameChat: (chatId: string, newTitle?: string) => void
|
|
301
315
|
- onDeleteChat: (chatId: string) => void
|
|
302
316
|
- onArchiveChat: (chatId: string) => void
|
|
317
|
+
- onSearchClick: () => void
|
|
318
|
+
- onLoadMore: () => void
|
|
319
|
+
- hasMore: boolean
|
|
320
|
+
- isLoadingChats: boolean
|
|
321
|
+
- isSearchOpen: boolean
|
|
322
|
+
- searchQuery: string
|
|
323
|
+
- onSearchQueryChange: (query: string) => void
|
|
303
324
|
- className: string
|
|
304
325
|
- collapsed: boolean
|
|
305
326
|
- onToggleCollapse: (value?: boolean) => void
|
|
@@ -336,6 +357,45 @@ MessageListProps:
|
|
|
336
357
|
- onAddContext: (context: Context) => void
|
|
337
358
|
- scrollRef: ref object or callback ref
|
|
338
359
|
|
|
360
|
+
## 6) SearchModal
|
|
361
|
+
|
|
362
|
+
SearchModal is exported for standalone usage when you want a full-overlay
|
|
363
|
+
conversation picker.
|
|
364
|
+
|
|
365
|
+
```tsx
|
|
366
|
+
import React from 'react';
|
|
367
|
+
import { SearchModal } from '@jazzmine-ui/react';
|
|
368
|
+
import type { Chat } from '@jazzmine-ui/react';
|
|
369
|
+
|
|
370
|
+
export function SearchModalDemo() {
|
|
371
|
+
const [isOpen, setIsOpen] = React.useState(true);
|
|
372
|
+
const [query, setQuery] = React.useState('');
|
|
373
|
+
const [results, setResults] = React.useState<Chat[]>([]);
|
|
374
|
+
|
|
375
|
+
return (
|
|
376
|
+
<SearchModal
|
|
377
|
+
isOpen={isOpen}
|
|
378
|
+
onClose={() => setIsOpen(false)}
|
|
379
|
+
onSelectConversation={(conversationId) => console.log(conversationId)}
|
|
380
|
+
searchQuery={query}
|
|
381
|
+
onSearchQueryChange={setQuery}
|
|
382
|
+
results={results}
|
|
383
|
+
isSearching={false}
|
|
384
|
+
/>
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
SearchModalProps:
|
|
390
|
+
|
|
391
|
+
- isOpen: boolean
|
|
392
|
+
- onClose: () => void
|
|
393
|
+
- onSelectConversation: (conversationId: string) => void
|
|
394
|
+
- searchQuery: string
|
|
395
|
+
- onSearchQueryChange: (query: string) => void
|
|
396
|
+
- results: Chat[]
|
|
397
|
+
- isSearching: boolean
|
|
398
|
+
|
|
339
399
|
## Exported Core Types
|
|
340
400
|
|
|
341
401
|
Message:
|
|
@@ -377,6 +437,7 @@ interface IJazzmineClient {
|
|
|
377
437
|
conversationId?: string;
|
|
378
438
|
autoCreateConversation?: boolean;
|
|
379
439
|
conversationTitle?: string;
|
|
440
|
+
explicitContext?: string[];
|
|
380
441
|
}
|
|
381
442
|
): Promise<{
|
|
382
443
|
response: {
|
|
@@ -400,6 +461,66 @@ interface IJazzmineClient {
|
|
|
400
461
|
deleted: boolean;
|
|
401
462
|
}>;
|
|
402
463
|
|
|
464
|
+
listConversations(params: {
|
|
465
|
+
userId: string;
|
|
466
|
+
limit?: number;
|
|
467
|
+
offset?: number;
|
|
468
|
+
}): Promise<{
|
|
469
|
+
conversations: Array<{
|
|
470
|
+
conversation_id: string;
|
|
471
|
+
title: string;
|
|
472
|
+
last_updated_at: number;
|
|
473
|
+
}>;
|
|
474
|
+
total: number;
|
|
475
|
+
hasMore: boolean;
|
|
476
|
+
offset: number;
|
|
477
|
+
limit: number;
|
|
478
|
+
}>;
|
|
479
|
+
|
|
480
|
+
searchConversations(params: {
|
|
481
|
+
userId: string;
|
|
482
|
+
query: string;
|
|
483
|
+
limit?: number;
|
|
484
|
+
offset?: number;
|
|
485
|
+
}): Promise<{
|
|
486
|
+
conversations: Array<{
|
|
487
|
+
conversation_id: string;
|
|
488
|
+
title: string;
|
|
489
|
+
last_updated_at: number;
|
|
490
|
+
}>;
|
|
491
|
+
total: number;
|
|
492
|
+
hasMore: boolean;
|
|
493
|
+
offset: number;
|
|
494
|
+
limit: number;
|
|
495
|
+
query?: string;
|
|
496
|
+
}>;
|
|
497
|
+
|
|
498
|
+
updateConversation(
|
|
499
|
+
conversationId: string,
|
|
500
|
+
payload: { title: string }
|
|
501
|
+
): Promise<{
|
|
502
|
+
conversation_id: string;
|
|
503
|
+
title: string;
|
|
504
|
+
last_updated_at: number;
|
|
505
|
+
}>;
|
|
506
|
+
|
|
507
|
+
getConversationMessages(params: {
|
|
508
|
+
conversationId: string;
|
|
509
|
+
limit?: number;
|
|
510
|
+
offset?: number;
|
|
511
|
+
}): Promise<{
|
|
512
|
+
conversation_id: string;
|
|
513
|
+
messages: Array<{
|
|
514
|
+
id: string;
|
|
515
|
+
role: 'user' | 'assistant' | 'colleague_assistant' | 'system';
|
|
516
|
+
original_content: string;
|
|
517
|
+
enhanced_message: string;
|
|
518
|
+
timestamp: number;
|
|
519
|
+
}>;
|
|
520
|
+
total: number;
|
|
521
|
+
hasMore: boolean;
|
|
522
|
+
}>;
|
|
523
|
+
|
|
403
524
|
getHealth(): Promise<{
|
|
404
525
|
status: string;
|
|
405
526
|
agent_name: string;
|
|
@@ -412,7 +533,7 @@ interface IJazzmineClient {
|
|
|
412
533
|
- This package does not import from @jazzmine-ui/sdk directly.
|
|
413
534
|
- Any SDK client that structurally matches IJazzmineClient works.
|
|
414
535
|
- JazzmineChat is a client-side component and includes a use client directive.
|
|
415
|
-
- react-markdown
|
|
536
|
+
- react-markdown and remark-gfm are externalized and must be present in the consuming app.
|
|
416
537
|
|
|
417
538
|
## Development
|
|
418
539
|
|