@cognizant-ai-lab/ui-common 1.9.0 → 1.11.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/components/AgentChat/ChatCommon/ChatCommon.js +32 -10
- package/dist/components/AgentChat/ChatCommon/Const.d.ts +1 -0
- package/dist/components/AgentChat/ChatCommon/Const.js +2 -0
- package/dist/components/AgentChat/ChatCommon/SlyDataDialog.d.ts +29 -0
- package/dist/components/AgentChat/ChatCommon/SlyDataDialog.js +150 -0
- package/dist/components/AgentChat/ChatCommon/Thinking.js +2 -2
- package/dist/components/AgentChat/Common/LlmChatButton.d.ts +4 -6
- package/dist/components/AgentChat/Common/LlmChatButton.js +0 -2
- package/dist/components/AgentChat/Common/Utils.d.ts +0 -11
- package/dist/components/AgentChat/Common/Utils.js +0 -16
- package/dist/components/Common/ConfirmationModal.d.ts +3 -2
- package/dist/components/Common/Footer.js +4 -0
- package/dist/components/Common/Navbar.d.ts +2 -1
- package/dist/components/Common/Navbar.js +3 -3
- package/dist/components/ErrorPage/ErrorPage.js +4 -4
- package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.d.ts +7 -7
- package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.js +161 -376
- package/dist/components/MultiAgentAccelerator/AgentFlow/AgentNode.js +7 -5
- package/dist/components/MultiAgentAccelerator/AgentFlow/GraphLayouts.js +10 -7
- package/dist/components/MultiAgentAccelerator/AgentFlow/GraphStructure.d.ts +1 -1
- package/dist/components/MultiAgentAccelerator/Editor/AgentNodeEditor.d.ts +24 -0
- package/dist/components/MultiAgentAccelerator/Editor/AgentNodeEditor.js +128 -0
- package/dist/components/MultiAgentAccelerator/Editor/NetworkEditorDock.d.ts +21 -0
- package/dist/components/MultiAgentAccelerator/Editor/NetworkEditorDock.js +305 -0
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +112 -116
- package/dist/components/MultiAgentAccelerator/NeuroSanStudioCallout.d.ts +2 -0
- package/dist/components/MultiAgentAccelerator/NeuroSanStudioCallout.js +38 -0
- package/dist/components/MultiAgentAccelerator/PanelSeparator.d.ts +5 -0
- package/dist/components/MultiAgentAccelerator/PanelSeparator.js +46 -0
- package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.d.ts +2 -0
- package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +23 -31
- package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.d.ts +0 -2
- package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +11 -9
- package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.d.ts +2 -2
- package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.js +13 -13
- package/dist/components/MultiAgentAccelerator/TemporaryNetworks.d.ts +3 -17
- package/dist/components/MultiAgentAccelerator/TemporaryNetworks.js +17 -40
- package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.js +10 -8
- package/dist/components/MultiAgentAccelerator/const.d.ts +12 -11
- package/dist/components/MultiAgentAccelerator/const.js +24 -22
- package/dist/components/Settings/ApiKeyErrorBanner.d.ts +22 -0
- package/dist/components/Settings/ApiKeyErrorBanner.js +26 -0
- package/dist/components/Settings/ApiKeyInput.d.ts +5 -2
- package/dist/components/Settings/ApiKeyInput.js +10 -4
- package/dist/components/Settings/SettingsDialog.js +22 -5
- package/dist/const.d.ts +0 -1
- package/dist/const.js +0 -1
- package/dist/controller/llm/Providers.d.ts +19 -2
- package/dist/controller/llm/Providers.js +45 -31
- package/dist/state/Announcements.d.ts +24 -0
- package/dist/state/Announcements.js +29 -0
- package/dist/state/ChatHistory.d.ts +10 -1
- package/dist/state/ChatHistory.js +8 -0
- package/dist/state/Environment.d.ts +2 -0
- package/dist/state/Environment.js +2 -0
- package/dist/state/Settings.d.ts +14 -0
- package/dist/state/Settings.js +6 -2
- package/dist/state/TemporaryNetworks.js +12 -21
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/AgentName.d.ts +17 -0
- package/dist/utils/AgentName.js +46 -0
- package/dist/utils/Authentication.d.ts +7 -0
- package/dist/utils/Authentication.js +19 -5
- package/dist/utils/SlyData.d.ts +56 -0
- package/dist/utils/SlyData.js +106 -0
- package/package.json +7 -6
- package/dist/components/MultiAgentAccelerator/AgentNodePopup.d.ts +0 -30
- package/dist/components/MultiAgentAccelerator/AgentNodePopup.js +0 -80
- package/dist/components/MultiAgentAccelerator/Sidebar/ImportNetworkModal.d.ts +0 -67
- package/dist/components/MultiAgentAccelerator/Sidebar/ImportNetworkModal.js +0 -585
|
@@ -14,46 +14,47 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
14
14
|
See the License for the specific language governing permissions and
|
|
15
15
|
limitations under the License.
|
|
16
16
|
*/
|
|
17
|
+
import Close from "@mui/icons-material/Close";
|
|
17
18
|
import StopCircle from "@mui/icons-material/StopCircle";
|
|
18
|
-
import Backdrop from "@mui/material/Backdrop";
|
|
19
19
|
import Box from "@mui/material/Box";
|
|
20
|
-
import
|
|
21
|
-
import Grid from "@mui/material/Grid";
|
|
22
|
-
import Paper from "@mui/material/Paper";
|
|
20
|
+
import IconButton from "@mui/material/IconButton";
|
|
23
21
|
import Slide from "@mui/material/Slide";
|
|
22
|
+
import Snackbar from "@mui/material/Snackbar";
|
|
24
23
|
import { useTheme } from "@mui/material/styles";
|
|
25
24
|
import Tooltip from "@mui/material/Tooltip";
|
|
26
25
|
import Typography from "@mui/material/Typography";
|
|
27
26
|
import { ReactFlowProvider } from "@xyflow/react";
|
|
28
27
|
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
29
28
|
import { useJoyride } from "react-joyride";
|
|
29
|
+
import { Group, Panel, usePanelRef } from "react-resizable-panels";
|
|
30
30
|
import { extractConversations } from "./AgentConversations.js";
|
|
31
31
|
import { getUpdatedAgentCounts } from "./AgentCounts.js";
|
|
32
32
|
import { AgentFlow } from "./AgentFlow/AgentFlow.js";
|
|
33
33
|
import { extractAgentNetworkDesignerProgress } from "./AgentNetworkDesigner.js";
|
|
34
|
-
import { AGENT_NETWORK_DEFINITION_KEY, AGENT_NETWORK_DESIGNER_ID, AGENT_NETWORK_HOCON, AGENT_NETWORK_NAME_KEY, EXPIRED_NETWORKS_CHECK_INTERVAL_MS, GRACE_PERIOD_MS, SHOW_TOUR_DELAY_MS, TRIGGER_APP_TOUR_EVENT_NAME, } from "./const.js";
|
|
35
|
-
import {
|
|
34
|
+
import { AGENT_NETWORK_DEFINITION_KEY, AGENT_NETWORK_DESIGNER_ID, AGENT_NETWORK_HOCON, AGENT_NETWORK_NAME_KEY, EXPIRED_NETWORKS_CHECK_INTERVAL_MS, GRACE_PERIOD_MS, NEURO_SAN_CALLOUT_DELAY_MS, SHOW_TOUR_DELAY_MS, TRIGGER_APP_TOUR_EVENT_NAME, } from "./const.js";
|
|
35
|
+
import { NeuroSanStudioCallout } from "./NeuroSanStudioCallout.js";
|
|
36
|
+
import { PanelSeparator } from "./PanelSeparator.js";
|
|
37
|
+
import { BYOK } from "./Schema/SlyData.js";
|
|
36
38
|
import { Sidebar } from "./Sidebar/Sidebar.js";
|
|
37
|
-
import { extractTemporaryNetworksFromMessage,
|
|
39
|
+
import { extractTemporaryNetworksFromMessage, isTemporaryNetwork, notifySaveError, streamNetworkDesignerUpsert, } from "./TemporaryNetworks.js";
|
|
38
40
|
import { MAIN_TOUR_STEPS } from "./Tour/MainTourSteps.js";
|
|
39
41
|
import { getAgentFunction, getAgentNetworks, getConnectivity } from "../../controller/agent/Agent.js";
|
|
40
42
|
import { getAgentIconSuggestions, getNetworkIconSuggestions } from "../../controller/agent/IconSuggestions.js";
|
|
43
|
+
import { AnnouncementId, useAnnouncementsStore } from "../../state/Announcements.js";
|
|
41
44
|
import { useAgentChatHistoryStore } from "../../state/ChatHistory.js";
|
|
45
|
+
import { getApiKey, LLM_PROVIDER_API_KEY_FIELD, useSettingsStore } from "../../state/Settings.js";
|
|
42
46
|
import { useTempNetworksStore } from "../../state/TemporaryNetworks.js";
|
|
43
47
|
import { TourPromptState, useTourStore } from "../../state/Tour.js";
|
|
48
|
+
import { toDisplayName } from "../../utils/AgentName.js";
|
|
44
49
|
import { getZIndex } from "../../utils/zIndexLayers.js";
|
|
45
50
|
import { ChatCommon } from "../AgentChat/ChatCommon/ChatCommon.js";
|
|
46
51
|
import { LlmChatButton } from "../AgentChat/Common/LlmChatButton.js";
|
|
47
52
|
import { isLegacyAgentType } from "../AgentChat/Common/Types.js";
|
|
48
|
-
import { chatMessageFromChunk
|
|
53
|
+
import { chatMessageFromChunk } from "../AgentChat/Common/Utils.js";
|
|
49
54
|
import { ConfirmationModal, StyledButton } from "../Common/ConfirmationModal.js";
|
|
50
55
|
import { MUIAlert } from "../Common/MUIAlert.js";
|
|
51
56
|
import { MUIDialog } from "../Common/MUIDialog.js";
|
|
52
57
|
import { closeNotification, NotificationType, sendNotification } from "../Common/notification.js";
|
|
53
|
-
import { BYOK } from "./Schema/SlyData.js";
|
|
54
|
-
import { getApiKey, LLM_PROVIDER_API_KEY_FIELD, useSettingsStore } from "../../state/Settings.js";
|
|
55
|
-
// Animation time for the left and right panels to slide in or out when launching the animation
|
|
56
|
-
const GROW_ANIMATION_TIME_MS = 800;
|
|
57
58
|
// Optimization to avoid creating a new empty map on every render
|
|
58
59
|
const EMPTY_THOUGHT_BUBBLE_EDGES = new Map();
|
|
59
60
|
/**
|
|
@@ -79,8 +80,6 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
79
80
|
const temporaryNetworks = useTempNetworksStore((state) => state.tempNetworks);
|
|
80
81
|
// Track newly added temp networks so we can highlight them
|
|
81
82
|
const [newlyAddedTemporaryNetworks, setNewlyAddedTemporaryNetworks] = useState(new Set());
|
|
82
|
-
// True while a file import is in-flight (after modal confirm, before the new network appears)
|
|
83
|
-
const [isImporting, setIsImporting] = useState(false);
|
|
84
83
|
const [networkIconSuggestions, setNetworkIconSuggestions] = useState({});
|
|
85
84
|
const [agentsInNetwork, setAgentsInNetwork] = useState([]);
|
|
86
85
|
const [sampleQueries, setSampleQueries] = useState([]);
|
|
@@ -90,7 +89,7 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
90
89
|
const [agentIconSuggestions, setAgentIconSuggestions] = useState(null);
|
|
91
90
|
const [selectedNetwork, setSelectedNetwork] = useState(null);
|
|
92
91
|
const [networkDescription, setNetworkDescription] = useState("");
|
|
93
|
-
const networkDisplayName = useMemo(() => (
|
|
92
|
+
const networkDisplayName = useMemo(() => toDisplayName(selectedNetwork, useNativeNames), [selectedNetwork, useNativeNames]);
|
|
94
93
|
// LLM providers for which BYOK keys are supported by the current network
|
|
95
94
|
const [supportedByokProviders, setSupportedByokProviders] = useState(new Set());
|
|
96
95
|
const neuroSanURL = useSettingsStore((state) => state.settings.externalServices.neuroSanUrl) ?? defaultNeuroSanUrl;
|
|
@@ -107,11 +106,10 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
107
106
|
// State to hold thought bubble edges - avoids duplicates across layout recalculations
|
|
108
107
|
const [thoughtBubbleEdges, setThoughtBubbleEdges] = useState(new Map());
|
|
109
108
|
const [confirmationModalOpen, setConfirmationModalOpen] = useState(false);
|
|
110
|
-
const [importModalOpen, setImportModalOpen] = useState(false);
|
|
111
109
|
const [tourModalOpen, setTourModalOpen] = useState(false);
|
|
112
110
|
const [haveShownTourModal, setHaveShownTourModal] = useState(false);
|
|
113
111
|
// Memoized key for agent names to trigger icon suggestion updates when the set of agents changes, not just
|
|
114
|
-
// when sorting/other operations on the agents list
|
|
112
|
+
// when sorting/other operations on the "agents" list
|
|
115
113
|
const agentNamesKey = useMemo(() => agentsInNetwork
|
|
116
114
|
.map((agent) => agent.origin)
|
|
117
115
|
.sort()
|
|
@@ -142,12 +140,18 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
142
140
|
skip: "Exit Tour",
|
|
143
141
|
},
|
|
144
142
|
});
|
|
143
|
+
// Neuro SAN Studio callout
|
|
144
|
+
const [neuroSanCalloutOpen, setNeuroSanCalloutOpen] = useState(false);
|
|
145
|
+
const haveShownNeuroSanCallout = useAnnouncementsStore((state) => state.hasShown(AnnouncementId.NeuroSanStudioGithubStar));
|
|
146
|
+
const markAnnouncementShown = useAnnouncementsStore((state) => state.markShown);
|
|
145
147
|
const resetState = useCallback(() => {
|
|
146
148
|
setThoughtBubbleEdges(new Map());
|
|
147
149
|
setIsStreaming(false);
|
|
148
150
|
}, []);
|
|
149
151
|
// Reference to the ChatCommon component to allow external stop button to call its handleStop method
|
|
150
152
|
const chatRef = useRef(null);
|
|
153
|
+
const leftPanelRef = usePanelRef();
|
|
154
|
+
const rightPanelRef = usePanelRef();
|
|
151
155
|
// Clear chat whenever the user navigates to the Agent Network Designer, so they start fresh each time
|
|
152
156
|
useEffect(() => {
|
|
153
157
|
if (selectedNetwork === AGENT_NETWORK_DESIGNER_ID) {
|
|
@@ -167,9 +171,8 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
167
171
|
// progresses. We read it back here to find the matching temp network and override agent_network_definition in the
|
|
168
172
|
// outgoing request — leaving what's in IndexedDB untouched.
|
|
169
173
|
const designerSlyData = useAgentChatHistoryStore((state) => state.history[AGENT_NETWORK_DESIGNER_ID]?.slyData);
|
|
170
|
-
const
|
|
171
|
-
|
|
172
|
-
: undefined;
|
|
174
|
+
const designerNetworkNameValue = designerSlyData?.[AGENT_NETWORK_NAME_KEY];
|
|
175
|
+
const designerNetworkName = isNetworkDesignerMode && typeof designerNetworkNameValue === "string" ? designerNetworkNameValue : undefined;
|
|
173
176
|
const designerTempNetwork = designerNetworkName
|
|
174
177
|
? temporaryNetworks.find((n) => n.agentNetworkName === designerNetworkName)
|
|
175
178
|
: undefined;
|
|
@@ -453,7 +456,7 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
453
456
|
}, [isNetworkDesignerMode]);
|
|
454
457
|
/**
|
|
455
458
|
* Handles a save from the AgentFlow popup: streams the updated definition to the network designer,
|
|
456
|
-
* collects reservations from each chunk, then upserts the result and navigates if the network changed.
|
|
459
|
+
* collects reservations from each chunk, then upserts the result, and navigates if the network changed.
|
|
457
460
|
*/
|
|
458
461
|
const onSaveAgent = useCallback(async (agentName, updated, agentNetworkName, signal) => {
|
|
459
462
|
try {
|
|
@@ -480,35 +483,6 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
480
483
|
notifySaveError(agentName, e);
|
|
481
484
|
}
|
|
482
485
|
}, [neuroSanURL, username, selectedNetwork]);
|
|
483
|
-
/**
|
|
484
|
-
* Handles an import from the ImportNetworkModal: converts the JSON content to a
|
|
485
|
-
* network definition, streams it through the network designer to obtain a reservation,
|
|
486
|
-
* then upserts the result into the temporary-networks store and navigates to the new network.
|
|
487
|
-
*/
|
|
488
|
-
const handleImportNetwork = useCallback(async (agentNetworkName, content) => {
|
|
489
|
-
setIsImporting(true);
|
|
490
|
-
try {
|
|
491
|
-
const result = await importNetworkFromJson(content, agentNetworkName, neuroSanURL, username);
|
|
492
|
-
if ("failure" in result) {
|
|
493
|
-
sendNotification(NotificationType.error, `Failed to import "${agentNetworkName}".`, IMPORT_FAILURE_DETAIL[result.failure]);
|
|
494
|
-
return;
|
|
495
|
-
}
|
|
496
|
-
useTempNetworksStore.getState().upsertTempNetworks(result.networks);
|
|
497
|
-
// An import defines a single network, so the designer returns one reservation. Highlight and
|
|
498
|
-
// navigate to it; any further entries (none expected) are still upserted above.
|
|
499
|
-
const newNetworkName = result.networks[0]?.agentInfo.agent_name;
|
|
500
|
-
if (newNetworkName) {
|
|
501
|
-
setNewlyAddedTemporaryNetworks(new Set([newNetworkName]));
|
|
502
|
-
changeSelectedNetwork(newNetworkName);
|
|
503
|
-
}
|
|
504
|
-
}
|
|
505
|
-
catch (e) {
|
|
506
|
-
notifySaveError(agentNetworkName, e);
|
|
507
|
-
}
|
|
508
|
-
finally {
|
|
509
|
-
setIsImporting(false);
|
|
510
|
-
}
|
|
511
|
-
}, [changeSelectedNetwork, neuroSanURL, username]);
|
|
512
486
|
const onStreamingStarted = useCallback(() => {
|
|
513
487
|
// Reset agent counts
|
|
514
488
|
setAgentCounts(new Map());
|
|
@@ -518,14 +492,24 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
518
492
|
setAgentsInNetworkDesigner([]);
|
|
519
493
|
// Mark that streaming has started
|
|
520
494
|
setIsStreaming(true);
|
|
521
|
-
|
|
495
|
+
// Collapse outer panels for Zen mode
|
|
496
|
+
if (enableZenMode) {
|
|
497
|
+
leftPanelRef?.current?.collapse();
|
|
498
|
+
rightPanelRef?.current?.collapse();
|
|
499
|
+
}
|
|
500
|
+
}, [enableZenMode, leftPanelRef, rightPanelRef]);
|
|
522
501
|
const onStreamingComplete = useCallback(() => {
|
|
523
502
|
// When streaming is complete, clean up any refs and state
|
|
524
503
|
conversationsRef.current = null;
|
|
525
504
|
setCurrentConversations(null);
|
|
526
505
|
setAgentsInNetworkDesigner([]);
|
|
527
506
|
resetState();
|
|
528
|
-
|
|
507
|
+
// Un-collapse outer panels for Zen mode
|
|
508
|
+
if (enableZenMode) {
|
|
509
|
+
leftPanelRef?.current?.expand();
|
|
510
|
+
rightPanelRef?.current?.expand();
|
|
511
|
+
}
|
|
512
|
+
}, [enableZenMode, leftPanelRef, resetState, rightPanelRef]);
|
|
529
513
|
const handleDeleteNetwork = (networkId, isExpired) => {
|
|
530
514
|
if (isExpired) {
|
|
531
515
|
// It's expired, so just delete it without confirmation
|
|
@@ -560,6 +544,19 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
560
544
|
clearTimeout(timer);
|
|
561
545
|
};
|
|
562
546
|
}, [haveShownTourModal, tourRequested, tourStatus]);
|
|
547
|
+
// Show Neuro SAN Studio callout after a delay if the user hasn't seen it yet
|
|
548
|
+
useEffect(() => {
|
|
549
|
+
// If it's already open, or we've already shown it, just return
|
|
550
|
+
if (neuroSanCalloutOpen || haveShownNeuroSanCallout)
|
|
551
|
+
return undefined;
|
|
552
|
+
// Show callout after a delay
|
|
553
|
+
const timer = setTimeout(() => {
|
|
554
|
+
setNeuroSanCalloutOpen(true);
|
|
555
|
+
}, NEURO_SAN_CALLOUT_DELAY_MS);
|
|
556
|
+
return () => {
|
|
557
|
+
clearTimeout(timer);
|
|
558
|
+
};
|
|
559
|
+
}, [haveShownNeuroSanCallout, neuroSanCalloutOpen]);
|
|
563
560
|
useEffect(() => {
|
|
564
561
|
if (!tourRequested)
|
|
565
562
|
return;
|
|
@@ -577,50 +574,32 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
577
574
|
return intersection.size === 0 ? supportedByokProviders : new Set();
|
|
578
575
|
};
|
|
579
576
|
const hasMissingApiKeys = getMissingApiKeys().size > 0;
|
|
580
|
-
const getLeftPanel = () => {
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
};
|
|
587
|
-
const getCenterPanel = () => {
|
|
588
|
-
return (_jsx(Grid, { id: "multi-agent-accelerator-grid-agent-flow", size: enableZenMode && isStreaming ? 18 : 8.25, sx: {
|
|
589
|
-
height: "100%",
|
|
590
|
-
}, children: _jsx(ReactFlowProvider, { children: _jsx(Box, { id: "multi-agent-accelerator-agent-flow-container", sx: {
|
|
591
|
-
display: "flex",
|
|
592
|
-
justifyContent: "center",
|
|
593
|
-
alignItems: "center",
|
|
594
|
-
width: "100%",
|
|
595
|
-
height: "100%",
|
|
596
|
-
maxWidth: 1000,
|
|
597
|
-
margin: "0 auto",
|
|
598
|
-
}, children: _jsx(AgentFlow, { agentCounts: agentCounts, agentsInNetwork: agentsInNetwork, agentIconSuggestions: agentIconSuggestions, id: "multi-agent-accelerator-agent-flow", currentConversations: currentConversations, currentUser: username, isAwaitingLlm: isAwaitingLlm, isEditMode: isEditingNetwork, isStreaming: isStreaming, isSelectedNetworkTemporary: isSelectedNetworkTemporary, networkDisplayName: networkDisplayName || "", networkId: isSelectedNetworkTemporary ? selectedNetwork : "", neuroSanURL: neuroSanURL, onEnterEditMode: () => setIsEditingNetwork(true), onExitEditMode: () => setIsEditingNetwork(false), onNetworkReplaced: (_old, newId) => changeSelectedNetwork(newId), onSaveAgent: onSaveAgent, thoughtBubbleEdges: thoughtBubbleEdges, setThoughtBubbleEdges: setThoughtBubbleEdges }, "multi-agent-accelerator-agent-flow") }) }) }));
|
|
599
|
-
};
|
|
600
|
-
const getRightPanel = () => {
|
|
601
|
-
return (_jsx(Slide, { id: "multi-agent-accelerator-grid-agent-chat-common-slide", in: !enableZenMode || !isAwaitingLlm, direction: "left", timeout: GROW_ANIMATION_TIME_MS, onExited: () => {
|
|
602
|
-
setIsStreaming(true);
|
|
603
|
-
}, children: _jsx(Grid, { id: "multi-agent-accelerator-grid-agent-chat-common", size: enableZenMode && isStreaming ? 0 : 6.5, sx: {
|
|
577
|
+
const getLeftPanel = () => (_jsx(Panel, { collapsible: true, defaultSize: "20%", id: "multi-agent-accelerator-left-panel", minSize: "10%", panelRef: leftPanelRef, children: _jsx(Sidebar, { id: "multi-agent-accelerator-sidebar", isAwaitingLlm: isAwaitingLlm, networkIconSuggestions: networkIconSuggestions, networks: networks, neuroSanServerURL: neuroSanURL, newlyAddedTemporaryNetworks: newlyAddedTemporaryNetworks, onDeleteNetwork: handleDeleteNetwork, onEditNetwork: handleEditNetwork, setSelectedNetwork: (newNetwork) => changeSelectedNetwork(newNetwork), temporaryNetworks: temporaryNetworks }) }));
|
|
578
|
+
const getCenterPanel = () => (_jsx(Panel, { collapsible: true, defaultSize: "45%", id: "multi-agent-accelerator-center-panel", minSize: "10%", children: _jsx(ReactFlowProvider, { children: _jsx(Box, { id: "multi-agent-accelerator-agent-flow-container", sx: {
|
|
579
|
+
display: "flex",
|
|
580
|
+
justifyContent: "center",
|
|
581
|
+
alignItems: "center",
|
|
582
|
+
width: "100%",
|
|
604
583
|
height: "100%",
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
const getDeleteNetworkConfirmationModal = () => confirmationModalOpen ? (_jsx(ConfirmationModal, { id: "delete-network-confirmation-modal", content: `The network "${
|
|
584
|
+
margin: "0 auto",
|
|
585
|
+
}, children: _jsx(AgentFlow, { agentCounts: agentCounts, agentsInNetwork: agentsInNetwork, agentIconSuggestions: agentIconSuggestions, id: "multi-agent-accelerator-agent-flow", currentConversations: currentConversations, currentUser: username, isAwaitingLlm: isAwaitingLlm, isEditingNetwork: isEditingNetwork, isStreaming: isStreaming, isTemporaryNetwork: isSelectedNetworkTemporary, networkDisplayName: networkDisplayName || "", networkId: isSelectedNetworkTemporary ? selectedNetwork : "", neuroSanURL: neuroSanURL, onSaveAgent: onSaveAgent, setIsEditingNetwork: setIsEditingNetwork, thoughtBubbleEdges: thoughtBubbleEdges, setSelectedNetwork: changeSelectedNetwork, setThoughtBubbleEdges: setThoughtBubbleEdges }, "multi-agent-accelerator-agent-flow") }) }) }));
|
|
586
|
+
const getRightPanel = () => (_jsx(Panel, { collapsible: true, defaultSize: "35%", id: "multi-agent-accelerator-right-panel", minSize: "15%", panelRef: rightPanelRef, children: _jsx(ChatCommon, { agentPlaceholders: {
|
|
587
|
+
[AGENT_NETWORK_DESIGNER_ID]: "Describe in plain language the network you would like to build.",
|
|
588
|
+
}, currentUser: username, customAgentGreetings: {
|
|
589
|
+
[AGENT_NETWORK_DESIGNER_ID]: "Let's build a network together!",
|
|
590
|
+
}, extraSlyData: extraSlyData, id: "agent-network-ui", isAwaitingLlm: isAwaitingLlm, hasMissingApiKeys: hasMissingApiKeys, networkDescription: networkDescription, neuroSanURL: neuroSanURL, onChunkReceived: onChunkReceived, onStreamingComplete: onStreamingComplete, onStreamingStarted: onStreamingStarted, ref: chatRef, sampleQueries: sampleQueries, setIsAwaitingLlm: setIsAwaitingLlm, selectedNetwork: selectedNetwork, setSelectedNetwork: changeSelectedNetwork }, selectedNetwork ?? "no-network") }));
|
|
591
|
+
const getStopButton = () => isAwaitingLlm &&
|
|
592
|
+
enableZenMode && (_jsx(Box, { id: "stop-button-container", sx: {
|
|
593
|
+
position: "absolute",
|
|
594
|
+
bottom: "1rem",
|
|
595
|
+
right: "1rem",
|
|
596
|
+
zIndex: getZIndex(2, theme),
|
|
597
|
+
}, children: _jsx(Tooltip, { title: "Stop response (Esc)", children: _jsx(LlmChatButton, { "aria-label": "Stop", id: "stop-output-button", onClick: handleExternalStop, sx: {
|
|
598
|
+
"&:hover": {
|
|
599
|
+
backgroundColor: "error.main",
|
|
600
|
+
},
|
|
601
|
+
}, children: _jsx(StopCircle, { fontSize: "large", id: "stop-button-icon" }) }) }) }));
|
|
602
|
+
const getDeleteNetworkConfirmationModal = () => confirmationModalOpen ? (_jsx(ConfirmationModal, { id: "delete-network-confirmation-modal", content: `The network "${toDisplayName(networkToBeDeleted)}" will be deleted. ` +
|
|
624
603
|
"This action cannot be undone. Are you sure you want to proceed?", handleCancel: () => {
|
|
625
604
|
setConfirmationModalOpen(false);
|
|
626
605
|
setNetworkToBeDeleted(null);
|
|
@@ -635,17 +614,6 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
635
614
|
setNetworkToBeDeleted(null);
|
|
636
615
|
setConfirmationModalOpen(false);
|
|
637
616
|
}, title: "Delete Network" })) : null;
|
|
638
|
-
const getImportNetworkModal = () => (_jsx(ImportNetworkModal, { existingNetworkNames: temporaryNetworks.map((n) => n.agentNetworkName), isOpen: importModalOpen, onClose: () => setImportModalOpen(false), onImport: handleImportNetwork }));
|
|
639
|
-
// Blocking overlay shown while an imported network is being created on the backend.
|
|
640
|
-
const getImportBackdrop = () => (_jsx(Backdrop, { id: "multi-agent-accelerator-import-backdrop", "data-testid": "multi-agent-accelerator-import-backdrop", open: isImporting, sx: { zIndex: getZIndex(3, theme) }, children: _jsxs(Paper, { elevation: 6, role: "status", "aria-live": "polite", sx: {
|
|
641
|
-
display: "flex",
|
|
642
|
-
alignItems: "center",
|
|
643
|
-
gap: 2,
|
|
644
|
-
px: 4,
|
|
645
|
-
py: 2.5,
|
|
646
|
-
borderRadius: 2,
|
|
647
|
-
maxWidth: 480,
|
|
648
|
-
}, children: [_jsx(CircularProgress, { id: "multi-agent-accelerator-import-spinner", size: 24 }), _jsx(Typography, { id: "multi-agent-accelerator-import-title", variant: "body1", sx: { fontWeight: "bold" }, children: "Importing network..." })] }) }));
|
|
649
617
|
const getTourModal = () => tourModalOpen && (_jsx(MUIDialog, { contentSx: { fontSize: "0.8rem", minWidth: "550px", paddingTop: "0" }, footer: _jsxs(_Fragment, { children: [_jsx(StyledButton, { id: "tour-dont-show-again", onClick: () => {
|
|
650
618
|
setTourStatus(TourPromptState.DontShowAgain);
|
|
651
619
|
dismissTourModal();
|
|
@@ -666,8 +634,8 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
666
634
|
* Popper to show real-time progress of the Agent Network Designer output as we receive it from the backend.
|
|
667
635
|
* Only displayed when Agent Network Designer is active.
|
|
668
636
|
*/
|
|
669
|
-
const getProgressPopper = () =>
|
|
670
|
-
|
|
637
|
+
const getProgressPopper = () => isStreaming &&
|
|
638
|
+
isNetworkDesignerMode && (_jsx(Box, { sx: {
|
|
671
639
|
position: "absolute",
|
|
672
640
|
top: 0,
|
|
673
641
|
left: 0,
|
|
@@ -694,13 +662,41 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
694
662
|
textAlign: "center",
|
|
695
663
|
},
|
|
696
664
|
}, children: _jsxs(Typography, { sx: { fontSize: "larger" }, children: ["API key(s) required for at least one of these providers:", " ", _jsx("strong", { children: [...getMissingApiKeys()].join(", ") }), ". Please add the required key(s) in \"Settings\" to use this Network."] }) }));
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
665
|
+
const getNeuroSanStudioCallout = () => (_jsx(Snackbar, { anchorOrigin: { vertical: "bottom", horizontal: "left" }, open: neuroSanCalloutOpen, slotProps: {
|
|
666
|
+
clickAwayListener: {
|
|
667
|
+
onClickAway: (event) => {
|
|
668
|
+
;
|
|
669
|
+
event.defaultMuiPrevented =
|
|
670
|
+
true;
|
|
671
|
+
},
|
|
672
|
+
},
|
|
673
|
+
transition: {
|
|
674
|
+
timeout: {
|
|
675
|
+
enter: 500,
|
|
676
|
+
exit: 250,
|
|
677
|
+
},
|
|
678
|
+
},
|
|
679
|
+
}, slots: { transition: Slide }, sx: { mb: 2 }, children: _jsxs(Box, { sx: {
|
|
680
|
+
position: "relative",
|
|
681
|
+
maxWidth: 340,
|
|
682
|
+
}, children: [_jsx(IconButton, { "aria-label": "Close Neuro SAN Studio callout", onClick: (event) => {
|
|
683
|
+
event.preventDefault();
|
|
684
|
+
event.stopPropagation();
|
|
685
|
+
setNeuroSanCalloutOpen(false);
|
|
686
|
+
markAnnouncementShown(AnnouncementId.NeuroSanStudioGithubStar);
|
|
687
|
+
}, role: "button", size: "small", sx: {
|
|
688
|
+
bgcolor: "background.paper",
|
|
689
|
+
position: "absolute",
|
|
690
|
+
right: 4,
|
|
691
|
+
top: 20,
|
|
692
|
+
"&:hover": {
|
|
693
|
+
bgcolor: "action.hover",
|
|
694
|
+
},
|
|
695
|
+
}, children: _jsx(Close, { fontSize: "small" }) }), _jsx(NeuroSanStudioCallout, {})] }) }));
|
|
696
|
+
return (_jsxs(_Fragment, { children: [getNeuroSanStudioCallout(), getMissingApiKeysAlert(), Tour, getTourModal(), getProgressPopper(), getDeleteNetworkConfirmationModal(), _jsxs(Box, { id: "multi-agent-accelerator-container", sx: {
|
|
704
697
|
position: "relative",
|
|
705
|
-
|
|
698
|
+
width: "100%",
|
|
699
|
+
height: "100%",
|
|
700
|
+
minHeight: 0,
|
|
701
|
+
}, children: [_jsxs(Group, { children: [getLeftPanel(), _jsx(PanelSeparator, {}), getCenterPanel(), _jsx(PanelSeparator, {}), getRightPanel()] }), getStopButton()] })] }));
|
|
706
702
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Box from "@mui/material/Box";
|
|
3
|
+
import Paper from "@mui/material/Paper";
|
|
4
|
+
import { alpha } from "@mui/material/styles";
|
|
5
|
+
import Typography from "@mui/material/Typography";
|
|
6
|
+
export const NeuroSanStudioCallout = () => (_jsxs(Paper, { "aria-label": "neuro-san-studio GitHub repository", component: "a", elevation: 4, href: "https://github.com/cognizant-ai-lab/neuro-san-studio", rel: "noopener noreferrer", sx: (theme) => {
|
|
7
|
+
const paper = theme.palette.background.paper;
|
|
8
|
+
const primary = theme.palette.primary.main;
|
|
9
|
+
return {
|
|
10
|
+
"&:hover": {
|
|
11
|
+
backgroundImage: `linear-gradient(135deg, ${paper}, ${alpha(primary, 0.14)})`,
|
|
12
|
+
borderColor: "primary.main",
|
|
13
|
+
boxShadow: `0 0 0 3px ${alpha(primary, 0.22)}, ${theme.shadows[6]}`,
|
|
14
|
+
color: "secondary.main",
|
|
15
|
+
},
|
|
16
|
+
bgcolor: "background.paper",
|
|
17
|
+
backgroundImage: `linear-gradient(135deg, ${paper}, ${alpha(primary, 0.06)})`,
|
|
18
|
+
border: "1px solid",
|
|
19
|
+
borderColor: "divider",
|
|
20
|
+
borderRadius: 2,
|
|
21
|
+
color: "text.primary",
|
|
22
|
+
display: "block",
|
|
23
|
+
mt: 2,
|
|
24
|
+
p: 2,
|
|
25
|
+
textAlign: "center",
|
|
26
|
+
textDecoration: "none", // prevent underline on hover
|
|
27
|
+
transition: theme.transitions.create(["color", "border-color", "box-shadow"], {
|
|
28
|
+
duration: theme.transitions.duration.shortest,
|
|
29
|
+
}),
|
|
30
|
+
};
|
|
31
|
+
}, target: "_blank", children: [_jsx(Typography, { sx: { fontWeight: 700 }, variant: "body1", children: "\u2B50 Star us on GitHub!" }), _jsx(Typography, { sx: { mt: 0.5, mb: 1.25, opacity: 0.92 }, variant: "body2", children: "See the latest releases, explore examples, read the User Guide and help grow the community on GitHub." }), _jsx(Box, { alt: "GitHub Repo stars", component: "img", loading: "lazy", referrerPolicy: "no-referrer", src: "https://img.shields.io/github/stars/cognizant-ai-lab/neuro-san-studio?label=Neuro%20SAN%20Studio", sx: {
|
|
32
|
+
borderRadius: 1,
|
|
33
|
+
border: "1px solid",
|
|
34
|
+
borderColor: "divider",
|
|
35
|
+
display: "inline-block",
|
|
36
|
+
height: 20,
|
|
37
|
+
verticalAlign: "middle",
|
|
38
|
+
} })] }));
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import DragIndicator from "@mui/icons-material/DragIndicator";
|
|
3
|
+
import Box from "@mui/material/Box";
|
|
4
|
+
import { Separator } from "react-resizable-panels";
|
|
5
|
+
/**
|
|
6
|
+
* Styled Separator that wraps the default react-resizable-panels Separator component. It adds some visual flair.
|
|
7
|
+
*/
|
|
8
|
+
export const PanelSeparator = () => (_jsx(Separator, { style: {
|
|
9
|
+
width: "14px",
|
|
10
|
+
cursor: "col-resize",
|
|
11
|
+
display: "flex",
|
|
12
|
+
alignItems: "center",
|
|
13
|
+
justifyContent: "center",
|
|
14
|
+
flexShrink: 0,
|
|
15
|
+
}, children: _jsx(Box, { sx: {
|
|
16
|
+
width: "14px",
|
|
17
|
+
height: "100%",
|
|
18
|
+
display: "flex",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
justifyContent: "center",
|
|
21
|
+
transition: "background-color 120ms ease",
|
|
22
|
+
"&:hover": {
|
|
23
|
+
backgroundColor: "action.hover",
|
|
24
|
+
},
|
|
25
|
+
"&:hover .separator-grip": {
|
|
26
|
+
borderColor: "primary.main",
|
|
27
|
+
backgroundColor: "background.paper",
|
|
28
|
+
color: "primary.main",
|
|
29
|
+
boxShadow: 2,
|
|
30
|
+
opacity: 1,
|
|
31
|
+
},
|
|
32
|
+
}, children: _jsx(Box, { className: "separator-grip", sx: {
|
|
33
|
+
width: "18px",
|
|
34
|
+
height: "44px",
|
|
35
|
+
borderRadius: "999px",
|
|
36
|
+
border: "1px solid",
|
|
37
|
+
borderColor: "divider",
|
|
38
|
+
backgroundColor: "background.default",
|
|
39
|
+
color: "text.secondary",
|
|
40
|
+
opacity: 0.75,
|
|
41
|
+
display: "flex",
|
|
42
|
+
alignItems: "center",
|
|
43
|
+
justifyContent: "center",
|
|
44
|
+
transition: "background-color 120ms ease, border-color 120ms ease, color 120ms ease, " +
|
|
45
|
+
"box-shadow 120ms ease, opacity 120ms ease",
|
|
46
|
+
}, children: _jsx(DragIndicator, { fontSize: "small", sx: { fontSize: "1rem" } }) }) }) }));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { TreeItemProps } from "@mui/x-tree-view/TreeItem";
|
|
2
2
|
import { FC } from "react";
|
|
3
|
+
export declare const EDIT_NETWORK_LABEL = "Edit this network";
|
|
4
|
+
export declare const DOWNLOAD_NETWORK_DEFINITION_LABEL = "Download network definition";
|
|
3
5
|
export interface AgentNetworkNodeProps extends TreeItemProps {
|
|
4
6
|
readonly onDeleteNetwork?: (network: string, isExpired: boolean) => void;
|
|
5
7
|
readonly onEditNetwork?: (network: string) => void;
|
|
@@ -9,14 +9,18 @@ import Edit from "@mui/icons-material/Edit";
|
|
|
9
9
|
import Box from "@mui/material/Box";
|
|
10
10
|
import Chip from "@mui/material/Chip";
|
|
11
11
|
import IconButton from "@mui/material/IconButton";
|
|
12
|
+
import { styled } from "@mui/material/styles";
|
|
12
13
|
import Tooltip from "@mui/material/Tooltip";
|
|
13
14
|
import { useTreeItemModel } from "@mui/x-tree-view/hooks";
|
|
14
15
|
import { TreeItemContent, TreeItemGroupTransition, TreeItemLabel, TreeItemRoot, } from "@mui/x-tree-view/TreeItem";
|
|
15
16
|
import { TreeItemProvider } from "@mui/x-tree-view/TreeItemProvider";
|
|
16
17
|
import { useTreeItem } from "@mui/x-tree-view/useTreeItem";
|
|
17
18
|
import { useRef } from "react";
|
|
18
|
-
import { downloadFile
|
|
19
|
-
|
|
19
|
+
import { downloadFile } from "../../../utils/File.js";
|
|
20
|
+
//#region Constants
|
|
21
|
+
// Accessible names shared between each action's tooltip title and its aria-label.
|
|
22
|
+
export const EDIT_NETWORK_LABEL = "Edit this network";
|
|
23
|
+
export const DOWNLOAD_NETWORK_DEFINITION_LABEL = "Download network definition";
|
|
20
24
|
// Palette of colors we can use for tags
|
|
21
25
|
const TAG_COLORS = [
|
|
22
26
|
"--bs-accent2-light",
|
|
@@ -29,6 +33,17 @@ const TAG_COLORS = [
|
|
|
29
33
|
"--bs-secondary",
|
|
30
34
|
"--bs-yellow",
|
|
31
35
|
];
|
|
36
|
+
// Shared styling for the row's action buttons (download, edit, ...). Disabled state keeps the base
|
|
37
|
+
// color and only dims via opacity.
|
|
38
|
+
const ActionIconButton = styled(IconButton)({
|
|
39
|
+
padding: 0,
|
|
40
|
+
color: "var(--bs-secondary)",
|
|
41
|
+
"&:hover": { color: "var(--bs-secondary-dark)" },
|
|
42
|
+
"&.Mui-disabled": {
|
|
43
|
+
opacity: 0.3,
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
//#endregion Types and Interfaces
|
|
32
47
|
// Keep track of which tags have which colors so that the same tag always has the same color
|
|
33
48
|
const tagsToColors = new Map();
|
|
34
49
|
/**
|
|
@@ -46,8 +61,6 @@ const isTemporaryNetworkExpired = (expirationDate) => {
|
|
|
46
61
|
*/
|
|
47
62
|
export const AgentNetworkTreeItem = ({ children, disabled, itemId, label, onDeleteNetwork, onEditNetwork, }) => {
|
|
48
63
|
const item = useTreeItemModel(itemId);
|
|
49
|
-
// We know all labels are strings because we set them that way in the tree view items
|
|
50
|
-
const labelString = label;
|
|
51
64
|
const { getContextProviderProps, getRootProps, getContentProps, getLabelProps, getGroupTransitionProps } = useTreeItem({ itemId, children, label, disabled });
|
|
52
65
|
const rootRef = useRef(null);
|
|
53
66
|
const isParent = Array.isArray(children) && children.length > 0;
|
|
@@ -64,7 +77,7 @@ export const AgentNetworkTreeItem = ({ children, disabled, itemId, label, onDele
|
|
|
64
77
|
const expirationTime = item?.temporaryNetworkExpirationTime;
|
|
65
78
|
const isTemporaryNetwork = Boolean(expirationTime);
|
|
66
79
|
const isExpired = isChild && isTemporaryNetwork && isTemporaryNetworkExpired(expirationTime);
|
|
67
|
-
const
|
|
80
|
+
const networkHocon = item?.temporaryNetworkHocon ?? null;
|
|
68
81
|
const iconNameSuggestion = item.iconSuggestion;
|
|
69
82
|
let muiIconElement;
|
|
70
83
|
// If the item is a child (i.e., a network), we want to render an icon next to it.
|
|
@@ -106,41 +119,20 @@ export const AgentNetworkTreeItem = ({ children, disabled, itemId, label, onDele
|
|
|
106
119
|
.map((tag) => (_jsx(Chip, { label: tag, style: {
|
|
107
120
|
margin: "0.25rem",
|
|
108
121
|
backgroundColor: `var(${tagsToColors.get(tag) || TAG_COLORS[0]})`,
|
|
109
|
-
} }, tag))), placement: "right", arrow: true, children: _jsx(BookmarkIcon, { sx: { fontSize: "0.75rem", color: "var(--bs-accent1-medium)" } }) })) : null] }), isChild && isTemporaryNetwork && (_jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: "0.25rem", marginLeft: "auto" }, children: [
|
|
122
|
+
} }, tag))), placement: "right", arrow: true, children: _jsx(BookmarkIcon, { sx: { fontSize: "0.75rem", color: "var(--bs-accent1-medium)" } }) })) : null] }), isChild && isTemporaryNetwork && (_jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: "0.25rem", marginLeft: "auto" }, children: [networkHocon && (_jsx(Tooltip, { title: isExpired ? "Expired" : DOWNLOAD_NETWORK_DEFINITION_LABEL, children: _jsx("span", { children: _jsx(ActionIconButton, { onClick: (e) => {
|
|
123
|
+
// The button is disabled while expired, so no need to guard here.
|
|
110
124
|
e.stopPropagation();
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
// otherwise flatten the UUID's hyphens to underscores).
|
|
114
|
-
const cleanName = removeTrailingUuid(labelString);
|
|
115
|
-
const fileName = `${toSafeFilename(cleanName)}.json`;
|
|
116
|
-
downloadFile(JSON.stringify(networkDefinition, null, 2), fileName, "application/json");
|
|
117
|
-
}, disabled: isExpired, "aria-label": "Download network definition", size: "small", sx: {
|
|
118
|
-
padding: 0,
|
|
119
|
-
color: "var(--bs-secondary)",
|
|
120
|
-
"&:hover": { color: "var(--bs-secondary-dark)" },
|
|
121
|
-
"&.Mui-disabled": {
|
|
122
|
-
color: "var(--bs-secondary)",
|
|
123
|
-
opacity: 0.3,
|
|
124
|
-
},
|
|
125
|
-
}, children: _jsx(DownloadIcon, { sx: { fontSize: "0.75rem" } }) }) }) })), _jsx(Tooltip, { title: "Edit this network", children: _jsx("span", { children: _jsx(IconButton, { onClick: (e) => {
|
|
125
|
+
downloadFile(networkHocon, item.downloadFileName, "text/plain");
|
|
126
|
+
}, disabled: isExpired, "aria-label": DOWNLOAD_NETWORK_DEFINITION_LABEL, size: "small", children: _jsx(DownloadIcon, { sx: { fontSize: "0.75rem" } }) }) }) })), _jsx(Tooltip, { title: EDIT_NETWORK_LABEL, children: _jsx("span", { children: _jsx(ActionIconButton, { onClick: (e) => {
|
|
126
127
|
e.stopPropagation();
|
|
127
128
|
onEditNetwork?.(itemId);
|
|
128
|
-
}, disabled: isExpired, size: "small", sx: {
|
|
129
|
-
padding: 0,
|
|
130
|
-
color: "var(--bs-secondary)",
|
|
131
|
-
"&:hover": { color: "var(--bs-secondary-dark)" },
|
|
132
|
-
"&.Mui-disabled": {
|
|
133
|
-
color: "var(--bs-secondary)",
|
|
134
|
-
opacity: 0.3,
|
|
135
|
-
},
|
|
136
|
-
}, children: _jsx(Edit, { sx: { fontSize: "0.75rem" } }) }) }) }), _jsx(Tooltip, { title: "Delete network", children: _jsx(Delete, { onClick: (e) => {
|
|
129
|
+
}, disabled: isExpired, "aria-label": EDIT_NETWORK_LABEL, size: "small", children: _jsx(Edit, { sx: { fontSize: "0.75rem" } }) }) }) }), _jsx(Tooltip, { title: "Delete network", children: _jsx(Delete, { onClick: (e) => {
|
|
137
130
|
e.stopPropagation();
|
|
138
131
|
onDeleteNetwork?.(itemId, isExpired);
|
|
139
132
|
}, sx: {
|
|
140
133
|
color: "var(--bs-secondary)",
|
|
141
134
|
"&:hover": { color: (theme) => theme.palette.warning.main },
|
|
142
135
|
"&.Mui-disabled": {
|
|
143
|
-
color: "var(--bs-secondary)",
|
|
144
136
|
opacity: 0.3,
|
|
145
137
|
},
|
|
146
138
|
cursor: "pointer",
|
|
@@ -6,14 +6,12 @@ export declare const SPARKLE_HIGHLIGHT_CLASS = "sparkle-highlight";
|
|
|
6
6
|
export interface SidebarProps {
|
|
7
7
|
readonly id: string;
|
|
8
8
|
readonly isAwaitingLlm: boolean;
|
|
9
|
-
readonly isImporting: boolean;
|
|
10
9
|
readonly networkIconSuggestions?: NetworkIconSuggestions;
|
|
11
10
|
readonly networks: readonly AgentInfo[];
|
|
12
11
|
readonly neuroSanServerURL: string;
|
|
13
12
|
readonly newlyAddedTemporaryNetworks?: Set<string>;
|
|
14
13
|
readonly onDeleteNetwork?: (network: string, isExpired: boolean) => void;
|
|
15
14
|
readonly onEditNetwork?: (network: string) => void;
|
|
16
|
-
readonly onImportClick?: () => void;
|
|
17
15
|
readonly setSelectedNetwork: (network: string) => void;
|
|
18
16
|
readonly temporaryNetworks?: readonly TemporaryNetwork[];
|
|
19
17
|
}
|