@hef2024/llmasaservice-ui 0.20.0 → 0.20.1
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/AICHATPANEL-PORT-INVENTORY.md +1 -0
- package/DEBUG-ERROR-HANDLING.md +1 -0
- package/FIX-APPLIED.md +1 -0
- package/IMPLEMENTATION-COMPLETE.md +1 -0
- package/dist/index.css +445 -0
- package/dist/index.d.mts +36 -0
- package/dist/index.d.ts +36 -0
- package/dist/index.js +1042 -438
- package/dist/index.mjs +873 -269
- package/docs/CHANGELOG-ERROR-HANDLING.md +1 -0
- package/docs/CONVERSATION-HISTORY.md +1 -0
- package/docs/ERROR-HANDLING-413.md +1 -0
- package/docs/ERROR-HANDLING-SUMMARY.md +1 -0
- package/package.json +2 -2
- package/src/AIAgentPanel.tsx +97 -1
- package/src/AIChatPanel.css +536 -0
- package/src/AIChatPanel.tsx +641 -32
- package/src/AgentPanel.tsx +3 -1
- package/src/ChatPanel.tsx +69 -29
- package/src/components/ui/Button.tsx +1 -0
- package/src/components/ui/Dialog.tsx +1 -0
- package/src/components/ui/Input.tsx +1 -0
- package/src/components/ui/Select.tsx +1 -0
- package/src/components/ui/ToolInfoModal.tsx +66 -0
- package/src/components/ui/Tooltip.tsx +1 -0
- package/src/components/ui/index.ts +1 -0
- package/src/hooks/useAgentRegistry.ts +1 -0
|
@@ -251,3 +251,4 @@ Potential improvements for future iterations:
|
|
|
251
251
|
- Errors are detected by monitoring the `error` property from `useLLM` hook
|
|
252
252
|
- The implementation is consistent across both modern (AIChatPanel) and legacy (ChatPanel) components
|
|
253
253
|
- Error state is properly synchronized with loading state to prevent UI inconsistencies
|
|
254
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hef2024/llmasaservice-ui",
|
|
3
|
-
"version": "0.20.
|
|
3
|
+
"version": "0.20.1",
|
|
4
4
|
"description": "Prebuilt UI components for LLMAsAService.io",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"dotenv": "^16.4.7",
|
|
58
58
|
"llmasaservice-client": "^0.10.4",
|
|
59
59
|
"process": "^0.11.10",
|
|
60
|
-
"react-markdown": "^
|
|
60
|
+
"react-markdown": "^10.1.0",
|
|
61
61
|
"react-syntax-highlighter": "^15.5.0",
|
|
62
62
|
"rehype-raw": "^7.0.0",
|
|
63
63
|
"remark-gfm": "^4.0.0",
|
package/src/AIAgentPanel.tsx
CHANGED
|
@@ -141,6 +141,23 @@ export interface AIAgentPanelProps {
|
|
|
141
141
|
|
|
142
142
|
// Enable/disable conversation history panel
|
|
143
143
|
showConversationHistory?: boolean;
|
|
144
|
+
|
|
145
|
+
// New props from ChatPanel port
|
|
146
|
+
cssUrl?: string;
|
|
147
|
+
markdownClass?: string;
|
|
148
|
+
width?: string;
|
|
149
|
+
height?: string;
|
|
150
|
+
scrollToEnd?: boolean;
|
|
151
|
+
prismStyle?: any;
|
|
152
|
+
showSaveButton?: boolean;
|
|
153
|
+
showEmailButton?: boolean;
|
|
154
|
+
messages?: { role: "user" | "assistant"; content: string }[];
|
|
155
|
+
showCallToAction?: boolean;
|
|
156
|
+
callToActionButtonText?: string;
|
|
157
|
+
callToActionEmailAddress?: string;
|
|
158
|
+
callToActionEmailSubject?: string;
|
|
159
|
+
customerEmailCaptureMode?: "HIDE" | "OPTIONAL" | "REQUIRED";
|
|
160
|
+
customerEmailCapturePlaceholder?: string;
|
|
144
161
|
}
|
|
145
162
|
|
|
146
163
|
// Icons
|
|
@@ -381,6 +398,22 @@ interface ChatPanelWrapperProps {
|
|
|
381
398
|
onConversationCreated: (tempId: string, realId: string) => void;
|
|
382
399
|
// Per-conversation initial prompt
|
|
383
400
|
conversationInitialPrompt?: string;
|
|
401
|
+
// New props from ChatPanel port
|
|
402
|
+
cssUrl?: string;
|
|
403
|
+
markdownClass?: string;
|
|
404
|
+
width?: string;
|
|
405
|
+
height?: string;
|
|
406
|
+
scrollToEnd?: boolean;
|
|
407
|
+
prismStyle?: any;
|
|
408
|
+
showSaveButton?: boolean;
|
|
409
|
+
showEmailButton?: boolean;
|
|
410
|
+
messages?: { role: "user" | "assistant"; content: string }[];
|
|
411
|
+
showCallToAction?: boolean;
|
|
412
|
+
callToActionButtonText?: string;
|
|
413
|
+
callToActionEmailAddress?: string;
|
|
414
|
+
callToActionEmailSubject?: string;
|
|
415
|
+
customerEmailCaptureMode?: "HIDE" | "OPTIONAL" | "REQUIRED";
|
|
416
|
+
customerEmailCapturePlaceholder?: string;
|
|
384
417
|
}
|
|
385
418
|
|
|
386
419
|
// Remove React.memo temporarily to debug - ChatPanelWrapper needs to re-render when agentId changes
|
|
@@ -414,11 +447,28 @@ const ChatPanelWrapper = (({
|
|
|
414
447
|
enableContextDetailView,
|
|
415
448
|
onConversationCreated,
|
|
416
449
|
conversationInitialPrompt,
|
|
450
|
+
// New props from ChatPanel port
|
|
451
|
+
cssUrl,
|
|
452
|
+
markdownClass,
|
|
453
|
+
width,
|
|
454
|
+
height,
|
|
455
|
+
scrollToEnd,
|
|
456
|
+
prismStyle,
|
|
457
|
+
showSaveButton,
|
|
458
|
+
showEmailButton,
|
|
459
|
+
messages,
|
|
460
|
+
showCallToAction,
|
|
461
|
+
callToActionButtonText,
|
|
462
|
+
callToActionEmailAddress,
|
|
463
|
+
callToActionEmailSubject,
|
|
464
|
+
customerEmailCaptureMode,
|
|
465
|
+
customerEmailCapturePlaceholder,
|
|
417
466
|
}) => {
|
|
418
467
|
const convAgentProfile = getAgent(activeConv.agentId);
|
|
419
468
|
const convAgentMetadata = convAgentProfile?.metadata;
|
|
420
469
|
const isVisible = currentConversationId === activeConv.conversationId;
|
|
421
470
|
|
|
471
|
+
|
|
422
472
|
// Memoize callbacks to prevent recreating on every render
|
|
423
473
|
const historyCallback = useCallback(
|
|
424
474
|
(history: Record<string, { content: string; callId: string }>) => {
|
|
@@ -505,7 +555,7 @@ const ChatPanelWrapper = (({
|
|
|
505
555
|
customer={effectiveCustomer}
|
|
506
556
|
showPoweredBy={showPoweredBy}
|
|
507
557
|
showNewConversationButton={false}
|
|
508
|
-
createConversationOnFirstChat={
|
|
558
|
+
createConversationOnFirstChat={convAgentProfile?.createConversationOnFirstChat ?? true}
|
|
509
559
|
mcpServers={mcpServers}
|
|
510
560
|
actions={actions}
|
|
511
561
|
followOnQuestions={effectiveFollowOnQuestions}
|
|
@@ -521,6 +571,21 @@ const ChatPanelWrapper = (({
|
|
|
521
571
|
maxContextTokens={maxContextTokens}
|
|
522
572
|
enableContextDetailView={enableContextDetailView}
|
|
523
573
|
onConversationCreated={conversationCreatedCallback}
|
|
574
|
+
cssUrl={cssUrl}
|
|
575
|
+
markdownClass={markdownClass}
|
|
576
|
+
width={width}
|
|
577
|
+
height={height}
|
|
578
|
+
scrollToEnd={scrollToEnd ?? convAgentMetadata.displayAutoScroll}
|
|
579
|
+
prismStyle={prismStyle}
|
|
580
|
+
showSaveButton={showSaveButton ?? convAgentMetadata.displayShowSaveButton ?? true}
|
|
581
|
+
showEmailButton={showEmailButton ?? convAgentMetadata.displayShowEmailButton ?? true}
|
|
582
|
+
messages={messages}
|
|
583
|
+
showCallToAction={showCallToAction ?? convAgentMetadata.displayShowCallToAction ?? false}
|
|
584
|
+
callToActionButtonText={callToActionButtonText ?? convAgentMetadata.displayCallToActionButtonText ?? 'Submit'}
|
|
585
|
+
callToActionEmailAddress={callToActionEmailAddress ?? convAgentMetadata.displayCallToActionEmailAddress ?? ''}
|
|
586
|
+
callToActionEmailSubject={callToActionEmailSubject ?? convAgentMetadata.displayCallToActionEmailSubject ?? 'Agent CTA submitted'}
|
|
587
|
+
customerEmailCaptureMode={customerEmailCaptureMode ?? convAgentMetadata?.customerEmailCaptureMode ?? 'HIDE'}
|
|
588
|
+
customerEmailCapturePlaceholder={customerEmailCapturePlaceholder ?? convAgentMetadata?.customerEmailCapturePlaceholder ?? 'Please enter your email...'}
|
|
524
589
|
/>
|
|
525
590
|
</div>
|
|
526
591
|
);
|
|
@@ -568,6 +633,22 @@ const AIAgentPanel = React.forwardRef<AIAgentPanelHandle, AIAgentPanelProps>(({
|
|
|
568
633
|
followOnPrompt = '',
|
|
569
634
|
historyListLimit = 50,
|
|
570
635
|
showConversationHistory = true,
|
|
636
|
+
// New props from ChatPanel port
|
|
637
|
+
cssUrl,
|
|
638
|
+
markdownClass,
|
|
639
|
+
width,
|
|
640
|
+
height,
|
|
641
|
+
scrollToEnd,
|
|
642
|
+
prismStyle,
|
|
643
|
+
showSaveButton,
|
|
644
|
+
showEmailButton,
|
|
645
|
+
messages,
|
|
646
|
+
showCallToAction,
|
|
647
|
+
callToActionButtonText,
|
|
648
|
+
callToActionEmailAddress,
|
|
649
|
+
callToActionEmailSubject,
|
|
650
|
+
customerEmailCaptureMode,
|
|
651
|
+
customerEmailCapturePlaceholder,
|
|
571
652
|
}, ref) => {
|
|
572
653
|
// Panel state - only start collapsed if collapsible is true
|
|
573
654
|
const [isCollapsed, setIsCollapsed] = useState(collapsible && defaultCollapsed);
|
|
@@ -2118,6 +2199,21 @@ console.log("apiKey", apiKey);
|
|
|
2118
2199
|
enableContextDetailView={enableContextDetailView}
|
|
2119
2200
|
onConversationCreated={handleConversationCreated}
|
|
2120
2201
|
conversationInitialPrompt={activeConv.conversationInitialPrompt}
|
|
2202
|
+
cssUrl={cssUrl}
|
|
2203
|
+
markdownClass={markdownClass}
|
|
2204
|
+
width={width}
|
|
2205
|
+
height={height}
|
|
2206
|
+
scrollToEnd={scrollToEnd}
|
|
2207
|
+
prismStyle={prismStyle}
|
|
2208
|
+
showSaveButton={showSaveButton}
|
|
2209
|
+
showEmailButton={showEmailButton}
|
|
2210
|
+
messages={messages}
|
|
2211
|
+
showCallToAction={showCallToAction}
|
|
2212
|
+
callToActionButtonText={callToActionButtonText}
|
|
2213
|
+
callToActionEmailAddress={callToActionEmailAddress}
|
|
2214
|
+
callToActionEmailSubject={callToActionEmailSubject}
|
|
2215
|
+
customerEmailCaptureMode={customerEmailCaptureMode}
|
|
2216
|
+
customerEmailCapturePlaceholder={customerEmailCapturePlaceholder}
|
|
2121
2217
|
/>
|
|
2122
2218
|
))}
|
|
2123
2219
|
|