@cognizant-ai-lab/ui-common 1.6.0 → 1.8.0
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/dist/Theme/Palettes.d.ts +0 -9
- package/dist/Theme/Palettes.js +0 -18
- package/dist/components/AgentChat/ChatCommon/ChatCommon.d.ts +11 -7
- package/dist/components/AgentChat/ChatCommon/ChatCommon.js +119 -90
- package/dist/components/AgentChat/ChatCommon/Const.d.ts +1 -0
- package/dist/components/AgentChat/ChatCommon/Const.js +2 -0
- package/dist/components/AgentChat/ChatCommon/ControlButtons.d.ts +1 -1
- package/dist/components/AgentChat/ChatCommon/ControlButtons.js +7 -4
- package/dist/components/AgentChat/ChatCommon/FormattedMarkdown.js +3 -0
- package/dist/components/AgentChat/ChatCommon/SendButton.js +7 -6
- package/dist/components/AgentChat/ChatCommon/SyntaxHighlighterThemes.js +1 -1
- package/dist/components/AgentChat/ChatCommon/Thinking.d.ts +1 -0
- package/dist/components/AgentChat/ChatCommon/Thinking.js +10 -7
- package/dist/components/AgentChat/Common/LlmChatButton.d.ts +0 -2
- package/dist/components/AgentChat/Common/LlmChatButton.js +6 -9
- package/dist/components/AgentChat/VoiceChat/MicrophoneButton.js +12 -10
- package/dist/components/ChatBot/ChatBot.d.ts +0 -4
- package/dist/components/ChatBot/ChatBot.js +2 -2
- package/dist/components/Common/Navbar.js +24 -22
- package/dist/components/Common/StatusLight.d.ts +9 -0
- package/dist/components/Common/StatusLight.js +21 -0
- package/dist/components/ErrorPage/ErrorBoundary.js +1 -1
- package/dist/components/ErrorPage/ErrorPage.d.ts +3 -3
- package/dist/components/ErrorPage/ErrorPage.js +4 -3
- package/dist/components/Logo/Common.d.ts +4 -0
- package/dist/components/Logo/Common.js +8 -0
- package/dist/components/Logo/CustomerLogo.d.ts +23 -0
- package/dist/components/Logo/CustomerLogo.js +41 -0
- package/dist/components/MultiAgentAccelerator/AgentConversations.js +0 -1
- package/dist/components/MultiAgentAccelerator/AgentFlow.js +85 -53
- package/dist/components/MultiAgentAccelerator/AgentNode.js +23 -27
- package/dist/components/MultiAgentAccelerator/GraphLayouts.d.ts +17 -10
- package/dist/components/MultiAgentAccelerator/GraphLayouts.js +4 -6
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.d.ts +3 -9
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +102 -47
- package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.d.ts +0 -5
- package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +30 -25
- package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.d.ts +3 -4
- package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +84 -168
- package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.d.ts +30 -13
- package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.js +157 -100
- package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.js +10 -8
- package/dist/components/MultiAgentAccelerator/const.d.ts +2 -0
- package/dist/components/MultiAgentAccelerator/const.js +4 -0
- package/dist/components/Settings/ApiKeyInput.d.ts +16 -0
- package/dist/components/Settings/ApiKeyInput.js +69 -0
- package/dist/components/Settings/InfoTip.d.ts +8 -0
- package/dist/components/Settings/InfoTip.js +14 -0
- package/dist/components/Settings/SettingsDialog.js +379 -178
- package/dist/components/Settings/SettingsRow.d.ts +18 -0
- package/dist/components/Settings/SettingsRow.js +35 -0
- package/dist/controller/agent/Agent.d.ts +3 -20
- package/dist/controller/agent/Agent.js +9 -43
- package/dist/controller/agent/IconSuggestions.d.ts +35 -0
- package/dist/controller/agent/IconSuggestions.js +85 -0
- package/dist/controller/llm/Providers.d.ts +2 -0
- package/dist/controller/llm/Providers.js +41 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
- package/dist/state/IconSuggestions.d.ts +27 -0
- package/dist/state/IconSuggestions.js +50 -0
- package/dist/state/Settings.d.ts +19 -3
- package/dist/state/Settings.js +24 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/title.js +1 -1
- package/package.json +5 -1
- package/dist/components/Common/CustomerLogo.d.ts +0 -17
- package/dist/components/Common/CustomerLogo.js +0 -49
- package/dist/components/Common/MUIAccordion.d.ts +0 -17
- package/dist/components/Common/MUIAccordion.js +0 -66
- package/dist/utils/useLocalStorage.d.ts +0 -1
- package/dist/utils/useLocalStorage.js +0 -55
|
@@ -45,8 +45,8 @@ import { ThoughtBubbleOverlay } from "./ThoughtBubbleOverlay.js";
|
|
|
45
45
|
import { sendChatQuery } from "../../controller/agent/Agent.js";
|
|
46
46
|
import { StreamingUnit } from "../../controller/llm/LlmChat.js";
|
|
47
47
|
import { useAgentChatHistoryStore } from "../../state/ChatHistory.js";
|
|
48
|
+
import { usePalette, useSettingsStore } from "../../state/Settings.js";
|
|
48
49
|
import { useTempNetworksStore } from "../../state/TemporaryNetworks.js";
|
|
49
|
-
import { usePalette } from "../../Theme/Palettes.js";
|
|
50
50
|
import { getZIndex } from "../../utils/zIndexLayers.js";
|
|
51
51
|
import { chatMessageFromChunk } from "../AgentChat/Common/Utils.js";
|
|
52
52
|
import { MUIAlert } from "../Common/MUIAlert.js";
|
|
@@ -55,7 +55,7 @@ import { NotificationType, sendNotification } from "../Common/notification.js";
|
|
|
55
55
|
// #region: Constants
|
|
56
56
|
// Timeout for thought bubbles is set to 10 seconds
|
|
57
57
|
const THOUGHT_BUBBLE_TIMEOUT_MS = 10_000;
|
|
58
|
-
// How long the dock'
|
|
58
|
+
// How long the dock's status banner stays visible before auto-dismissing. Error banners persist until dismissed.
|
|
59
59
|
// Exported for tests.
|
|
60
60
|
export const DOCK_BANNER_AUTO_DISMISS_MS = 5_000;
|
|
61
61
|
// #endregion: Constants
|
|
@@ -113,6 +113,8 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
113
113
|
}, []);
|
|
114
114
|
// Ref for isStreaming, read inside the cleanup interval.
|
|
115
115
|
const isStreamingRef = useRef(isStreaming);
|
|
116
|
+
// Display option for agent/network names
|
|
117
|
+
const useNativeNames = useSettingsStore((state) => state.settings.appearance.useNativeNames);
|
|
116
118
|
// Keep the ref current after every render.
|
|
117
119
|
useEffect(() => {
|
|
118
120
|
isStreamingRef.current = isStreaming;
|
|
@@ -166,7 +168,7 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
166
168
|
return edgesMap ?? prev;
|
|
167
169
|
});
|
|
168
170
|
}, [currentConversations, showThoughtBubbles, setThoughtBubbleEdges]);
|
|
169
|
-
//
|
|
171
|
+
// Clean up expired thought bubble edges — created once on mount, reads isStreaming via ref.
|
|
170
172
|
useEffect(() => {
|
|
171
173
|
const cleanupInterval = setInterval(() => {
|
|
172
174
|
if (!isStreamingRef.current)
|
|
@@ -187,9 +189,6 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
187
189
|
}, 1000);
|
|
188
190
|
return () => clearInterval(cleanupInterval);
|
|
189
191
|
}, [setThoughtBubbleEdges]); // mount/unmount only
|
|
190
|
-
// Shadow color for icon
|
|
191
|
-
const isDarkMode = theme.palette.mode === "dark";
|
|
192
|
-
const foregroundColor = isDarkMode ? theme.palette.common.white : theme.palette.common.black;
|
|
193
192
|
const isHeatmap = coloringOption === "heatmap";
|
|
194
193
|
const palette = usePalette();
|
|
195
194
|
// Merge agents from active thought bubbles with agentsInNetwork for layout
|
|
@@ -216,8 +215,28 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
216
215
|
// Create the flow layout depending on user preference
|
|
217
216
|
// Memoize layoutResult so it only recalculates when relevant data changes
|
|
218
217
|
const layoutResult = useMemo(() => layout === "linear"
|
|
219
|
-
? layoutLinear(
|
|
220
|
-
|
|
218
|
+
? layoutLinear({
|
|
219
|
+
agentCounts: isHeatmap ? agentCounts : undefined,
|
|
220
|
+
agentIconSuggestions,
|
|
221
|
+
agentsInNetwork: mergedAgentsInNetwork,
|
|
222
|
+
currentConversations,
|
|
223
|
+
isAgentNetworkDesignerMode,
|
|
224
|
+
isAwaitingLlm,
|
|
225
|
+
isTemporaryNetwork,
|
|
226
|
+
thoughtBubbleEdges,
|
|
227
|
+
useNativeNames,
|
|
228
|
+
})
|
|
229
|
+
: layoutRadial({
|
|
230
|
+
agentCounts: isHeatmap ? agentCounts : undefined,
|
|
231
|
+
agentIconSuggestions,
|
|
232
|
+
agentsInNetwork: mergedAgentsInNetwork,
|
|
233
|
+
currentConversations,
|
|
234
|
+
isAgentNetworkDesignerMode,
|
|
235
|
+
isAwaitingLlm,
|
|
236
|
+
isTemporaryNetwork,
|
|
237
|
+
thoughtBubbleEdges,
|
|
238
|
+
useNativeNames,
|
|
239
|
+
}), [
|
|
221
240
|
agentCounts,
|
|
222
241
|
agentIconSuggestions,
|
|
223
242
|
currentConversations,
|
|
@@ -228,6 +247,7 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
228
247
|
layout,
|
|
229
248
|
mergedAgentsInNetwork,
|
|
230
249
|
thoughtBubbleEdges,
|
|
250
|
+
useNativeNames,
|
|
231
251
|
]);
|
|
232
252
|
const [nodes, setNodes] = useState(layoutResult.nodes);
|
|
233
253
|
// Sync up the nodes with the layout result
|
|
@@ -237,7 +257,7 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
237
257
|
// Track which node the user clicked on so we can open the popup
|
|
238
258
|
const [selectedAgent, setSelectedAgent] = useState(null);
|
|
239
259
|
const [isPopupOpen, setIsPopupOpen] = useState(false);
|
|
240
|
-
// True while the agent-edit request is in-flight so we can disable the Save button.
|
|
260
|
+
// True, while the agent-edit request is in-flight so we can disable the Save button.
|
|
241
261
|
const [isSavingAgent, setIsSavingAgent] = useState(false);
|
|
242
262
|
// AbortController for the in-flight save request — stored in a ref so handlePopupClose can cancel it.
|
|
243
263
|
const saveAbortControllerRef = useRef(null);
|
|
@@ -247,7 +267,7 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
247
267
|
const dockAbortControllerRef = useRef(null);
|
|
248
268
|
// Stop-confirm overlay state: null = not shown, "confirming" = abort dialog open.
|
|
249
269
|
const [stopState, setStopState] = useState(null);
|
|
250
|
-
// Inline status banner shown above the dock header after an apply succeeds, is
|
|
270
|
+
// Inline status banner shown above the dock header after an "apply" succeeds, is canceled, or fails.
|
|
251
271
|
const [dockBanner, setDockBanner] = useState(null);
|
|
252
272
|
const bannerTimeoutRef = useRef(null);
|
|
253
273
|
// Clear the banner auto-dismiss timer on unmount.
|
|
@@ -333,7 +353,7 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
333
353
|
}
|
|
334
354
|
return true;
|
|
335
355
|
}
|
|
336
|
-
// Reservations came back but none matched the current network — surface this in the dock banner.
|
|
356
|
+
// Reservations came back, but none matched the current network — surface this in the dock banner.
|
|
337
357
|
showDockBanner({
|
|
338
358
|
severity: "error",
|
|
339
359
|
title: "Failed to apply network change.",
|
|
@@ -370,15 +390,17 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
370
390
|
}
|
|
371
391
|
catch (e) {
|
|
372
392
|
const isAbort = e instanceof DOMException && e.name === "AbortError";
|
|
373
|
-
if (
|
|
374
|
-
|
|
393
|
+
if (isAbort) {
|
|
394
|
+
if (hasTimedOut) {
|
|
395
|
+
showDockBanner({
|
|
396
|
+
severity: "error",
|
|
397
|
+
title: "Failed to apply network change.",
|
|
398
|
+
detail: "The request timed out. Please try again.",
|
|
399
|
+
});
|
|
400
|
+
}
|
|
375
401
|
}
|
|
376
|
-
else
|
|
377
|
-
showDockBanner({
|
|
378
|
-
severity: "error",
|
|
379
|
-
title: "Failed to apply network change.",
|
|
380
|
-
detail: "The request timed out. Please try again.",
|
|
381
|
-
});
|
|
402
|
+
else {
|
|
403
|
+
showDockBanner({ severity: "error", title: "Failed to apply network change.", detail: String(e) });
|
|
382
404
|
}
|
|
383
405
|
}
|
|
384
406
|
finally {
|
|
@@ -445,8 +467,8 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
445
467
|
}, [agentsInNetwork, fitView, layout]);
|
|
446
468
|
const onNodesChange = useCallback((changes) => {
|
|
447
469
|
setNodes((currentNodes) => applyNodeChanges(
|
|
448
|
-
// For now, we only allow dragging, no updates. In agent network designer mode, doesn't make
|
|
449
|
-
// to allow position changes since the user isn't actually manipulating a real network
|
|
470
|
+
// For now, we only allow dragging, no updates. In agent network designer mode, it doesn't make
|
|
471
|
+
// sense to allow position changes since the user isn't actually manipulating a real network
|
|
450
472
|
changes.filter((c) => c.type === "position" && !isAgentNetworkDesignerMode), currentNodes));
|
|
451
473
|
}, [isAgentNetworkDesignerMode]);
|
|
452
474
|
const transform = useStore((state) => state.transform);
|
|
@@ -479,53 +501,62 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
479
501
|
const getLegend = () => {
|
|
480
502
|
const length = isHeatmap ? palette.length : Math.min(maxDepth, palette.length);
|
|
481
503
|
return (_jsxs(Box, { id: `${id}-legend`, sx: {
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
504
|
+
alignItems: "center",
|
|
505
|
+
backgroundColor: theme.palette.background.paper,
|
|
506
|
+
border: `1px solid ${theme.palette.divider}`,
|
|
507
|
+
boxShadow: `0 2px 8px ${alpha(theme.palette.text.primary, 0.18)}`,
|
|
486
508
|
borderRadius: "5px",
|
|
487
|
-
boxShadow: `0 0 5px color-mix(in srgb, ${foregroundColor} 30%, transparent)`,
|
|
488
509
|
display: "flex",
|
|
489
|
-
|
|
510
|
+
padding: theme.spacing(0.5),
|
|
511
|
+
position: "absolute",
|
|
512
|
+
right: theme.spacing(2),
|
|
513
|
+
top: theme.spacing(4),
|
|
490
514
|
zIndex: getZIndex(2, theme),
|
|
491
|
-
}, children: [Array.from({ length }, (_, i) => (_jsx(Box, { id: `${id}-legend-depth-${i}`,
|
|
515
|
+
}, children: [Array.from({ length }, (_, i) => (_jsx(Box, { id: `${id}-legend-depth-${i}`, sx: {
|
|
492
516
|
alignItems: "center",
|
|
493
517
|
backgroundColor: palette[i],
|
|
494
518
|
borderRadius: "50%",
|
|
495
519
|
color: theme.palette.getContrastText(palette[i]),
|
|
496
520
|
display: "flex",
|
|
497
|
-
|
|
521
|
+
fontSize: "0.5rem",
|
|
498
522
|
justifyContent: "center",
|
|
499
|
-
marginLeft:
|
|
523
|
+
marginLeft: theme.spacing(0.75),
|
|
500
524
|
width: "15px",
|
|
501
|
-
}, children:
|
|
502
|
-
fontSize: "8px",
|
|
503
|
-
}, children: i }) }, i))), _jsxs(ToggleButtonGroup, { id: `${id}-coloring-toggle`, value: coloringOption, exclusive: true, onChange: (_, newValue) => {
|
|
525
|
+
}, children: i }, i))), _jsxs(ToggleButtonGroup, { id: `${id}-coloring-toggle`, value: coloringOption, exclusive: true, onChange: (_, newValue) => {
|
|
504
526
|
if (newValue !== null) {
|
|
505
527
|
setColoringOption(newValue);
|
|
506
528
|
}
|
|
507
|
-
}, sx: {
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
529
|
+
}, size: "small", sx: {
|
|
530
|
+
marginLeft: theme.spacing(2),
|
|
531
|
+
"& .MuiToggleButton-root": {
|
|
532
|
+
backgroundColor: theme.palette.background.paper,
|
|
533
|
+
borderColor: theme.palette.divider,
|
|
534
|
+
color: theme.palette.text.primary,
|
|
535
|
+
minHeight: 22,
|
|
536
|
+
px: 1,
|
|
537
|
+
"&:hover": {
|
|
538
|
+
backgroundColor: theme.palette.action.hover,
|
|
539
|
+
},
|
|
540
|
+
"&.Mui-selected": {
|
|
541
|
+
backgroundColor: theme.palette.action.selected,
|
|
542
|
+
borderColor: theme.palette.text.primary,
|
|
543
|
+
},
|
|
544
|
+
"&.Mui-selected:hover": {
|
|
545
|
+
backgroundColor: theme.palette.action.selected,
|
|
546
|
+
borderColor: theme.palette.text.primary,
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
}, children: [_jsx(ToggleButton, { id: `${id}-depth-toggle`, value: "depth", sx: {
|
|
512
550
|
fontSize: "0.5rem",
|
|
513
551
|
height: "1rem",
|
|
514
|
-
}, children: _jsx(
|
|
515
|
-
fontSize: "10px",
|
|
516
|
-
}, children: "Depth" }) }), _jsx(ToggleButton, { id: `${id}-heatmap-toggle`, size: "small", value: "heatmap", sx: {
|
|
552
|
+
}, children: "Depth" }), _jsx(ToggleButton, { id: `${id}-heatmap-toggle`, value: "heatmap", sx: {
|
|
517
553
|
fontSize: "0.5rem",
|
|
518
554
|
height: "1rem",
|
|
519
|
-
}, children:
|
|
520
|
-
fontSize: "10px",
|
|
521
|
-
}, children: "Heatmap" }) })] })] }));
|
|
555
|
+
}, children: "Heatmap" })] })] }));
|
|
522
556
|
};
|
|
523
557
|
// Get the background color for the control buttons based on the layout and dark mode setting
|
|
524
558
|
const getControlButtonBackgroundColor = (isActive) => {
|
|
525
|
-
|
|
526
|
-
return undefined;
|
|
527
|
-
}
|
|
528
|
-
return isDarkMode ? theme.palette.grey[800] : theme.palette.grey[200];
|
|
559
|
+
return isActive ? theme.palette.action.selected : undefined;
|
|
529
560
|
};
|
|
530
561
|
// Only show radial guides if radial layout is selected, radial guides are enabled, and it's not just Frontman
|
|
531
562
|
const shouldShowRadialGuides = enableRadialGuides && layout === "radial" && maxDepth > 1;
|
|
@@ -604,9 +635,12 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
604
635
|
fill: theme.palette.text.primary,
|
|
605
636
|
},
|
|
606
637
|
}, children: [_jsxs(Box, { id: `${id}-react-flow-wrapper`, sx: { position: "relative", flex: 1, minHeight: 0 }, children: [networkDisplayName ? _jsx(Box, { sx: { marginBottom: "1rem" }, children: getTitle() }) : null, _jsx(ReactFlow, { id: `${id}-react-flow`, nodes: nodes, edges: edges, onNodesChange: onNodesChange, onNodeClick: handleNodeClick, fitView: true, nodeTypes: nodeTypes, edgeTypes: edgeTypes, connectionMode: ConnectionMode.Loose, children: !isAwaitingLlm && (_jsxs(_Fragment, { children: [agentsInNetwork?.length && !isAgentNetworkDesignerMode && !isEditMode ? getLegend() : null, _jsx(Background, { id: `${id}-background` }), !isAgentNetworkDesignerMode && !isEditMode && getControls(), shouldShowRadialGuides ? getRadialGuides() : null] })) }), _jsx(ThoughtBubbleOverlay, { nodes: nodes, edges: thoughtBubbleEdgesForOverlay, showThoughtBubbles: showThoughtBubbles, isStreaming: isStreaming, onBubbleHoverChange: handleBubbleHoverChange })] }), isEditMode && isTemporaryNetwork && !isAwaitingLlm && (_jsxs(Box, { sx: {
|
|
638
|
+
backdropFilter: "blur(8px)",
|
|
639
|
+
backgroundColor: alpha(theme.palette.background.paper, 0.2),
|
|
607
640
|
borderTop: `2px solid ${theme.palette.primary.main}`,
|
|
608
|
-
backgroundColor: theme.palette.background.paper,
|
|
609
641
|
flexShrink: 0,
|
|
642
|
+
position: "relative",
|
|
643
|
+
zIndex: getZIndex(2, theme),
|
|
610
644
|
}, children: [dockBanner && (_jsx(MUIAlert, { closeable: true, id: `${id}-dock-banner`, onClose: handleDismissBanner, severity: dockBanner.severity, sx: {
|
|
611
645
|
borderRadius: 0,
|
|
612
646
|
// Override MUIAlert's default 1rem bottom margin so the banner sits flush
|
|
@@ -617,10 +651,8 @@ export const AgentFlow = ({ agentCounts, agentIconSuggestions, agentsInNetwork,
|
|
|
617
651
|
// vertically with the header's close X below it.
|
|
618
652
|
paddingRight: 0.5,
|
|
619
653
|
alignItems: "center",
|
|
620
|
-
// Frost the banner like the dock header so the graph doesn't show through the
|
|
621
|
-
// app's translucent paper background; keep a tinted, mostly
|
|
622
|
-
backdropFilter: "blur(8px)",
|
|
623
|
-
backgroundColor: alpha(theme.palette[dockBanner.severity].main, isDarkMode ? 0.28 : 0.16),
|
|
654
|
+
// Frost the banner like the dock header, so the graph doesn't show through the
|
|
655
|
+
// app's translucent paper background; keep a tinted, mostly opaque severity wash.
|
|
624
656
|
"& .MuiAlert-action": {
|
|
625
657
|
alignItems: "center",
|
|
626
658
|
marginRight: 0,
|
|
@@ -29,8 +29,7 @@ import Typography from "@mui/material/Typography";
|
|
|
29
29
|
import { Handle, Position } from "@xyflow/react";
|
|
30
30
|
import { useState } from "react";
|
|
31
31
|
import { DisplayAs } from "./const.js";
|
|
32
|
-
import { useSettingsStore } from "../../state/Settings.js";
|
|
33
|
-
import { usePalette } from "../../Theme/Palettes.js";
|
|
32
|
+
import { usePalette, useSettingsStore } from "../../state/Settings.js";
|
|
34
33
|
import { isLightColor } from "../../Theme/Theme.js";
|
|
35
34
|
import { getZIndex } from "../../utils/zIndexLayers.js";
|
|
36
35
|
// A zero-width space character, used to give the browser a hint where to break long names
|
|
@@ -125,32 +124,28 @@ export const AgentNode = (props) => {
|
|
|
125
124
|
// Determine which icon to display based on the agent type whether it is Frontman or not
|
|
126
125
|
const getDisplayAsIcon = () => {
|
|
127
126
|
const id = `${agentId}-icon`;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
127
|
+
// Check for valid MUI icon suggestion from the LLM suggestion service
|
|
128
|
+
const SuggestedIcon = agentIconSuggestion ? MuiIcons[agentIconSuggestion] : undefined;
|
|
129
|
+
// If the LLM provided a valid icon suggestion, use it. Otherwise, fall back to default icons based on
|
|
130
|
+
// agent type.
|
|
131
|
+
if (SuggestedIcon) {
|
|
132
|
+
return (_jsx(SuggestedIcon, { id: id, sx: { fontSize: AGENT_ICON_SIZE } }));
|
|
131
133
|
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
_jsx(
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
case DisplayAs.CODED_TOOL:
|
|
148
|
-
return (_jsx(HandymanIcon, { id: id, sx: { fontSize: AGENT_ICON_SIZE } }));
|
|
149
|
-
case DisplayAs.LLM_AGENT:
|
|
150
|
-
default:
|
|
151
|
-
return (_jsx(AutoAwesomeIcon, { id: id, sx: { fontSize: AGENT_ICON_SIZE } }));
|
|
152
|
-
}
|
|
153
|
-
}
|
|
134
|
+
if (isFrontman) {
|
|
135
|
+
return (
|
|
136
|
+
// Use special icon and larger size for Frontman
|
|
137
|
+
_jsx(PersonIcon, { id: id, sx: { fontSize: FRONTMAN_ICON_SIZE } }));
|
|
138
|
+
}
|
|
139
|
+
switch (displayAs) {
|
|
140
|
+
case DisplayAs.EXTERNAL_AGENT:
|
|
141
|
+
return (_jsx(TravelExploreIcon, { id: id, sx: { fontSize: AGENT_ICON_SIZE } }));
|
|
142
|
+
// This should be a supported type but we're not seeing it?
|
|
143
|
+
case DisplayAs.LANGCHAIN_TOOL:
|
|
144
|
+
case DisplayAs.CODED_TOOL:
|
|
145
|
+
return (_jsx(HandymanIcon, { id: id, sx: { fontSize: AGENT_ICON_SIZE } }));
|
|
146
|
+
case DisplayAs.LLM_AGENT:
|
|
147
|
+
default:
|
|
148
|
+
return (_jsx(AutoAwesomeIcon, { id: id, sx: { fontSize: AGENT_ICON_SIZE } }));
|
|
154
149
|
}
|
|
155
150
|
};
|
|
156
151
|
// Determine icon color based on settings. If auto color is enabled, use contrasting color for readability.
|
|
@@ -160,6 +155,7 @@ export const AgentNode = (props) => {
|
|
|
160
155
|
? theme.palette.common.black
|
|
161
156
|
: theme.palette.common.white;
|
|
162
157
|
const [isHovered, setIsHovered] = useState(false);
|
|
158
|
+
// Insert zero-width spaces into the agent name to give the browser hints where to wrap.
|
|
163
159
|
const wrappedAgentName = agentName
|
|
164
160
|
// Allow wrap after underscore
|
|
165
161
|
.replaceAll("_", `_${ZERO_WIDTH_SPACE}`)
|
|
@@ -24,13 +24,20 @@ export declare const getThoughtBubbleEdges: (thoughtBubbleEdges: Map<string, {
|
|
|
24
24
|
edge: ThoughtBubbleEdgeShape;
|
|
25
25
|
timestamp: number;
|
|
26
26
|
}>) => ThoughtBubbleEdgeShape[];
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
27
|
+
/** * Shared options for graph layout functions. */
|
|
28
|
+
export type LayoutOptions = {
|
|
29
|
+
readonly agentCounts: Map<string, number>;
|
|
30
|
+
readonly agentIconSuggestions?: AgentIconSuggestions | null;
|
|
31
|
+
readonly agentsInNetwork: ConnectivityInfo[];
|
|
32
|
+
readonly currentConversations: AgentConversation[] | null;
|
|
33
|
+
readonly isAgentNetworkDesignerMode: boolean;
|
|
34
|
+
readonly isAwaitingLlm: boolean;
|
|
35
|
+
readonly isTemporaryNetwork?: boolean;
|
|
36
|
+
readonly thoughtBubbleEdges: Map<string, {
|
|
37
|
+
edge: ThoughtBubbleEdgeShape;
|
|
38
|
+
timestamp: number;
|
|
39
|
+
}>;
|
|
40
|
+
readonly useNativeNames: boolean;
|
|
41
|
+
};
|
|
42
|
+
export declare const layoutRadial: ({ agentCounts, agentIconSuggestions, agentsInNetwork, currentConversations, isAgentNetworkDesignerMode, isAwaitingLlm, isTemporaryNetwork, thoughtBubbleEdges, useNativeNames, }: LayoutOptions) => LayoutResult;
|
|
43
|
+
export declare const layoutLinear: ({ agentCounts, agentIconSuggestions, agentsInNetwork, currentConversations, isAgentNetworkDesignerMode, isAwaitingLlm, isTemporaryNetwork, thoughtBubbleEdges, useNativeNames, }: LayoutOptions) => LayoutResult;
|
|
@@ -102,8 +102,7 @@ const getEdgeProperties = (sourceId, targetId, sourceHandle, targetHandle, isAni
|
|
|
102
102
|
type: isAnimated ? "plasmaEdge" : undefined,
|
|
103
103
|
};
|
|
104
104
|
};
|
|
105
|
-
export const layoutRadial = (agentCounts, agentsInNetwork, currentConversations,
|
|
106
|
-
isAwaitingLlm, isAgentNetworkDesignerMode, thoughtBubbleEdges, agentIconSuggestions = null, isTemporaryNetwork = false) => {
|
|
105
|
+
export const layoutRadial = ({ agentCounts, agentIconSuggestions = null, agentsInNetwork, currentConversations, isAgentNetworkDesignerMode, isAwaitingLlm, isTemporaryNetwork = false, thoughtBubbleEdges, useNativeNames, }) => {
|
|
107
106
|
const nodesInNetwork = [];
|
|
108
107
|
const edgesInNetwork = [];
|
|
109
108
|
// Compute depth of each node using breadth-first traversal
|
|
@@ -186,7 +185,7 @@ isAwaitingLlm, isAgentNetworkDesignerMode, thoughtBubbleEdges, agentIconSuggesti
|
|
|
186
185
|
type: AGENT_NODE_TYPE_NAME,
|
|
187
186
|
data: {
|
|
188
187
|
agentCounts,
|
|
189
|
-
agentName: cleanUpAgentName(nodeId),
|
|
188
|
+
agentName: useNativeNames ? nodeId : cleanUpAgentName(nodeId),
|
|
190
189
|
depth,
|
|
191
190
|
displayAs: agentsInNetwork.find((a) => a.origin === nodeId)?.display_as,
|
|
192
191
|
// Use current conversations for node highlighting (cleared at end)
|
|
@@ -216,8 +215,7 @@ isAwaitingLlm, isAgentNetworkDesignerMode, thoughtBubbleEdges, agentIconSuggesti
|
|
|
216
215
|
edgesInNetwork.push(...thoughtBubbleEdgesToAdd);
|
|
217
216
|
return { nodes: nodesInNetwork, edges: edgesInNetwork };
|
|
218
217
|
};
|
|
219
|
-
export const layoutLinear = (agentCounts, agentsInNetwork, currentConversations,
|
|
220
|
-
isAwaitingLlm, isAgentNetworkDesignerMode, thoughtBubbleEdges, agentIconSuggestions = null, isTemporaryNetwork = false) => {
|
|
218
|
+
export const layoutLinear = ({ agentCounts, agentIconSuggestions = null, agentsInNetwork, currentConversations, isAgentNetworkDesignerMode, isAwaitingLlm, isTemporaryNetwork = false, thoughtBubbleEdges, useNativeNames, }) => {
|
|
221
219
|
const nodesInNetwork = [];
|
|
222
220
|
const edgesInNetwork = [];
|
|
223
221
|
// Do these calculations outside the loop for efficiency
|
|
@@ -232,7 +230,7 @@ isAwaitingLlm, isAgentNetworkDesignerMode, thoughtBubbleEdges, agentIconSuggesti
|
|
|
232
230
|
type: AGENT_NODE_TYPE_NAME,
|
|
233
231
|
data: {
|
|
234
232
|
agentCounts,
|
|
235
|
-
agentName: cleanUpAgentName(nodeId),
|
|
233
|
+
agentName: useNativeNames ? nodeId : cleanUpAgentName(nodeId),
|
|
236
234
|
displayAs: agentsInNetwork.find((a) => a.origin === nodeId)?.display_as,
|
|
237
235
|
// Use current conversations for node highlighting (cleared at end)
|
|
238
236
|
getConversations: () => currentConversations,
|
|
@@ -1,17 +1,11 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
export interface MultiAgentAcceleratorProps {
|
|
3
|
-
readonly
|
|
4
|
-
|
|
5
|
-
userImage: string;
|
|
6
|
-
};
|
|
7
|
-
readonly backendNeuroSanApiUrl: string;
|
|
3
|
+
readonly username: string;
|
|
4
|
+
readonly defaultNeuroSanUrl: string;
|
|
8
5
|
}
|
|
9
|
-
export declare const GRACE_PERIOD_MS: number;
|
|
10
|
-
export declare const SHOW_TOUR_DELAY_MS = 5000;
|
|
11
6
|
/**
|
|
12
7
|
* Main Multi-Agent Accelerator component that contains the sidebar, agent flow, and chat components.
|
|
13
8
|
* @param backendNeuroSanApiUrl Initial URL of the backend Neuro-San API. User can change this in the UI.
|
|
14
|
-
* @param
|
|
15
|
-
* @param userInfo Information about the current user, including userName and userImage.
|
|
9
|
+
* @param username Identifier to use for interactions with the backend (for personalization and tracking).
|
|
16
10
|
*/
|
|
17
11
|
export declare const MultiAgentAccelerator: FC<MultiAgentAcceleratorProps>;
|