@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
|
@@ -21,6 +21,7 @@ import { AIMessage, HumanMessage } from "@langchain/core/messages";
|
|
|
21
21
|
import AddBoxRounded from "@mui/icons-material/AddBoxRounded";
|
|
22
22
|
import ClearIcon from "@mui/icons-material/Clear";
|
|
23
23
|
import CloseIcon from "@mui/icons-material/Close";
|
|
24
|
+
import DataObjectIcon from "@mui/icons-material/DataObject";
|
|
24
25
|
import TuneIcon from "@mui/icons-material/Tune";
|
|
25
26
|
import Box from "@mui/material/Box";
|
|
26
27
|
import Checkbox from "@mui/material/Checkbox";
|
|
@@ -38,28 +39,30 @@ import { isEmpty } from "lodash-es";
|
|
|
38
39
|
import { useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState, } from "react";
|
|
39
40
|
import { v4 as uuid } from "uuid";
|
|
40
41
|
import { ChatHistory, toTurns } from "./ChatHistory.js";
|
|
41
|
-
import { MAX_TURNS } from "./Const.js";
|
|
42
|
+
import { MAX_TURNS, SLY_DATA_LOGIN_KEY } from "./Const.js";
|
|
42
43
|
import { ControlButtons } from "./ControlButtons.js";
|
|
43
44
|
import { Conversation } from "./Conversation.js";
|
|
44
45
|
import { MessageRole } from "./ConversationTurn.js";
|
|
45
46
|
import { SampleQueries } from "./SampleQueries.js";
|
|
46
47
|
import { SendButton } from "./SendButton.js";
|
|
48
|
+
import { SlyDataDialog } from "./SlyDataDialog.js";
|
|
47
49
|
import { Thinking } from "./Thinking.js";
|
|
48
50
|
import { sendChatQuery } from "../../../controller/agent/Agent.js";
|
|
49
51
|
import { sendLlmRequest, StreamingUnit } from "../../../controller/llm/LlmChat.js";
|
|
50
52
|
import { ChatMessageType } from "../../../generated/neuro-san/NeuroSanClient.js";
|
|
51
53
|
import { useAgentChatHistoryStore } from "../../../state/ChatHistory.js";
|
|
52
54
|
import { useSettingsStore } from "../../../state/Settings.js";
|
|
55
|
+
import { toDisplayName } from "../../../utils/AgentName.js";
|
|
53
56
|
import { downloadFile, toSafeFilename } from "../../../utils/File.js";
|
|
54
57
|
import { hasOnlyWhitespace } from "../../../utils/text.js";
|
|
55
58
|
import { getZIndex } from "../../../utils/zIndexLayers.js";
|
|
56
59
|
import { ConfirmationModal } from "../../Common/ConfirmationModal.js";
|
|
57
60
|
import { AGENT_NETWORK_DESIGNER_ID } from "../../MultiAgentAccelerator/const.js";
|
|
58
61
|
import { givesFinalAnswer, isLegacyAgentType } from "../Common/Types.js";
|
|
59
|
-
import { chatMessageFromChunk, checkError
|
|
62
|
+
import { chatMessageFromChunk, checkError } from "../Common/Utils.js";
|
|
60
63
|
import { MicrophoneButton } from "../VoiceChat/MicrophoneButton.js";
|
|
61
64
|
import { cleanupAndStopSpeechRecognition, setupSpeechRecognition } from "../VoiceChat/VoiceChat.js";
|
|
62
|
-
//#endregion
|
|
65
|
+
//#endregion Types and Interfaces
|
|
63
66
|
//#region Constants
|
|
64
67
|
// Define fancy EMPTY constant to avoid linter error about using object literals as default props
|
|
65
68
|
const EMPTY = {};
|
|
@@ -81,7 +84,7 @@ const EXPORT_ROLE_LABELS = {
|
|
|
81
84
|
[MessageRole.Warning]: "Warning",
|
|
82
85
|
[MessageRole.Error]: "Error",
|
|
83
86
|
};
|
|
84
|
-
//#endregion
|
|
87
|
+
//#endregion Constants
|
|
85
88
|
/**
|
|
86
89
|
* Helper function to convert a message role to a label for exporting chat history.
|
|
87
90
|
* @param role The message role to convert
|
|
@@ -119,6 +122,8 @@ export const ChatCommon = ({ ref, ...props }) => {
|
|
|
119
122
|
// Options menu control
|
|
120
123
|
const [optionsMenuAnchorEl, setOptionsMenuAnchorEl] = useState(null);
|
|
121
124
|
const [optionsMenuOpen, setOptionsMenuOpen] = useState(false);
|
|
125
|
+
// Whether the sly_data editor is showing
|
|
126
|
+
const [slyDataDialogOpen, setSlyDataDialogOpen] = useState(false);
|
|
122
127
|
// Persistent agent chat history store, which is where we store both kinds of chat histories
|
|
123
128
|
// (see store implementation for details)
|
|
124
129
|
const storedChatHistory = useAgentChatHistoryStore((state) => selectedNetwork ? state?.history?.[selectedNetwork] : undefined);
|
|
@@ -163,7 +168,7 @@ export const ChatCommon = ({ ref, ...props }) => {
|
|
|
163
168
|
};
|
|
164
169
|
// Keeps track of whether the agent completed its task
|
|
165
170
|
const succeeded = useRef(false);
|
|
166
|
-
const networkDisplayName = useMemo(() => (
|
|
171
|
+
const networkDisplayName = useMemo(() => toDisplayName(selectedNetwork, useNativeNames), [selectedNetwork, useNativeNames]);
|
|
167
172
|
useEffect(() => {
|
|
168
173
|
// Set up speech recognition
|
|
169
174
|
const handlers = setupSpeechRecognition(setChatInput, setVoiceInputState, speechRecognitionRef);
|
|
@@ -222,9 +227,12 @@ export const ChatCommon = ({ ref, ...props }) => {
|
|
|
222
227
|
// But don't want to spam output by logging errors for every bad message.
|
|
223
228
|
return;
|
|
224
229
|
}
|
|
225
|
-
// Shallow merge existing slyData with incoming chatMessage.sly_data
|
|
230
|
+
// Shallow merge existing slyData with incoming chatMessage.sly_data.
|
|
231
|
+
// Defense in depth: never let BYOK API keys enter the persistent store, even if a network echoes
|
|
232
|
+
// them back -- the store is displayed and exportable via the sly_data editor.
|
|
226
233
|
if (chatMessage.sly_data) {
|
|
227
|
-
|
|
234
|
+
const { llm_config: _, ...echoedSlyData } = chatMessage.sly_data;
|
|
235
|
+
updateSlyData(selectedNetwork, echoedSlyData);
|
|
228
236
|
}
|
|
229
237
|
// It's a ChatMessage. Does it have chat context? Only AGENT_FRAMEWORK messages can have chat context.
|
|
230
238
|
if (chatMessage.type === ChatMessageType.AGENT_FRAMEWORK && chatMessage.chat_context) {
|
|
@@ -310,7 +318,11 @@ export const ChatCommon = ({ ref, ...props }) => {
|
|
|
310
318
|
else {
|
|
311
319
|
// It's a Neuro-san agent.
|
|
312
320
|
// Some coded tools (data generator...) expect the username provided in slyData.
|
|
313
|
-
const slyDataWithUsername = {
|
|
321
|
+
const slyDataWithUsername = {
|
|
322
|
+
...agentChatHistory?.slyData,
|
|
323
|
+
...extraSlyData,
|
|
324
|
+
[SLY_DATA_LOGIN_KEY]: currentUser,
|
|
325
|
+
};
|
|
314
326
|
await sendChatQuery(neuroSanURL, controller?.current.signal, query, selectedNetwork, handleChunk, agentChatHistory.chatContext, slyDataWithUsername, currentUser, StreamingUnit.Line);
|
|
315
327
|
}
|
|
316
328
|
}
|
|
@@ -604,6 +616,16 @@ export const ChatCommon = ({ ref, ...props }) => {
|
|
|
604
616
|
const handleToggleWrapOutput = () => {
|
|
605
617
|
setShouldWrapOutput((prev) => !prev);
|
|
606
618
|
};
|
|
619
|
+
const handleShowSlyData = () => {
|
|
620
|
+
handleOptionsMenuClose();
|
|
621
|
+
setSlyDataDialogOpen(true);
|
|
622
|
+
};
|
|
623
|
+
/**
|
|
624
|
+
* The sly_data keys that this component merges in on every request, on top of whatever is in the store. The
|
|
625
|
+
* sly_data editor lists them so that the user isn't surprised by keys arriving at the server that they never
|
|
626
|
+
* typed -- and, for the API keys among them, so that we never have to display their values.
|
|
627
|
+
*/
|
|
628
|
+
const getMergedSlyDataKeys = () => [...Object.keys(extraSlyData ?? {}), SLY_DATA_LOGIN_KEY];
|
|
607
629
|
const getOptionsMenu = () => (_jsxs(Menu, { id: `${id}-options-menu`, anchorEl: optionsMenuAnchorEl, open: optionsMenuOpen, onClose: handleOptionsMenuClose, slotProps: {
|
|
608
630
|
list: {
|
|
609
631
|
dense: true,
|
|
@@ -614,7 +636,7 @@ export const ChatCommon = ({ ref, ...props }) => {
|
|
|
614
636
|
"& .MuiListItemText-primary": { fontSize: "smaller" },
|
|
615
637
|
},
|
|
616
638
|
},
|
|
617
|
-
}, children: [_jsxs(MenuItem, { onClick: handleToggleAutoScroll, children: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { checked: autoScrollEnabled, tabIndex: -1, sx: { pointerEvents: "none" } }) }), _jsx(ListItemText, { primary: "Auto-scroll output" })] }), _jsxs(MenuItem, { onClick: handleToggleWrapOutput, children: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { checked: shouldWrapOutput, tabIndex: -1, sx: { pointerEvents: "none" } }) }), _jsx(ListItemText, { primary: "Wrap output" })] })] }));
|
|
639
|
+
}, children: [_jsxs(MenuItem, { onClick: handleToggleAutoScroll, children: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { checked: autoScrollEnabled, tabIndex: -1, sx: { pointerEvents: "none" } }) }), _jsx(ListItemText, { primary: "Auto-scroll output" })] }), _jsxs(MenuItem, { onClick: handleToggleWrapOutput, children: [_jsx(ListItemIcon, { children: _jsx(Checkbox, { checked: shouldWrapOutput, tabIndex: -1, sx: { pointerEvents: "none" } }) }), _jsx(ListItemText, { primary: "Wrap output" })] }), !isLegacyAgentType(selectedNetwork) && (_jsxs(MenuItem, { id: `${id}-sly-data-menu-item`, onClick: handleShowSlyData, children: [_jsx(ListItemIcon, { children: _jsx(DataObjectIcon, { fontSize: "small" }) }), _jsx(ListItemText, { primary: "Sly data..." })] }))] }));
|
|
618
640
|
const getNetworkIntro = () => (_jsxs(Box, { sx: { marginBottom: "0.5rem", marginTop: "1rem" }, children: [_jsxs(Typography, { component: "span", sx: { fontWeight: 700 }, variant: "inherit", children: [networkDisplayName, networkDescription && ":"] }), networkDescription && (_jsxs(Typography, { component: "span", sx: { ml: 0.5 }, variant: "inherit", children: [" ", networkDescription] }))] }));
|
|
619
641
|
const getChatHistory = () => (_jsx(_Fragment, { children: agentChatHistory?.chatHistory?.length > 0 && (_jsx(Box, { sx: { my: "0.5rem" }, children: _jsx(ChatHistory, { id: id, messages: agentChatHistory.chatHistory }) })) }));
|
|
620
642
|
const getAgentGreeting = () => _jsx(Box, { sx: { marginBottom: "0.5rem", marginTop: "1rem" }, children: agentGreeting });
|
|
@@ -648,7 +670,7 @@ export const ChatCommon = ({ ref, ...props }) => {
|
|
|
648
670
|
resetHistory(selectedNetwork);
|
|
649
671
|
setPreviousUserQuery("");
|
|
650
672
|
currentResponse.current = "";
|
|
651
|
-
}, okBtnLabel: "Yes, clear chat", title: `Clear all chat including history for ${networkDisplayName}?` })) : null, _jsxs(Box, { id: "llm-responses", ref: chatOutputRef, sx: {
|
|
673
|
+
}, okBtnLabel: "Yes, clear chat", title: `Clear all chat including history for ${networkDisplayName}?` })) : null, slyDataDialogOpen ? (_jsx(SlyDataDialog, { extraSlyDataKeys: getMergedSlyDataKeys(), id: `${id}-sly-data-dialog`, isOpen: slyDataDialogOpen, networkDisplayName: networkDisplayName, networkId: selectedNetwork, onClose: () => setSlyDataDialogOpen(false) })) : null, _jsxs(Box, { id: "llm-responses", ref: chatOutputRef, sx: {
|
|
652
674
|
backgroundColor,
|
|
653
675
|
borderRadius: "0.5rem",
|
|
654
676
|
fontSize: "16px",
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
export interface SlyDataDialogProps {
|
|
3
|
+
/**
|
|
4
|
+
* Names of the sly_data keys that the UI itself merges into each request (API keys, agent network definition,
|
|
5
|
+
* login...). Shown to the user as names only -- never values, since some of them are secrets.
|
|
6
|
+
*/
|
|
7
|
+
readonly extraSlyDataKeys?: readonly string[];
|
|
8
|
+
/** HTML id to use for the outer component */
|
|
9
|
+
readonly id: string;
|
|
10
|
+
readonly isOpen: boolean;
|
|
11
|
+
/** The network whose sly_data is being edited. Sly data is stored per network. */
|
|
12
|
+
readonly networkId: string;
|
|
13
|
+
/** Human-readable name of the network, for display only */
|
|
14
|
+
readonly networkDisplayName: string;
|
|
15
|
+
readonly onClose: () => void;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Dialog for viewing and editing the sly_data of the selected agent network.
|
|
19
|
+
* <br>
|
|
20
|
+
* sly_data is the side-channel payload that rides along with every request: the server echoes it back as the
|
|
21
|
+
* conversation progresses, and the UI bounces it to the server on the next request. Until now it was invisible.
|
|
22
|
+
* This dialog exposes it as editable JSON, so a user can inspect what the agents are passing around and seed values
|
|
23
|
+
* of their own before the first turn.
|
|
24
|
+
* <br>
|
|
25
|
+
* Edits are written straight into the per-network chat history store, which is the same place the streaming code
|
|
26
|
+
* writes server-echoed sly_data and the same place the send path reads from. There is therefore no separate plumbing
|
|
27
|
+
* to the server: whatever is saved here goes out with the next request.
|
|
28
|
+
*/
|
|
29
|
+
export declare const SlyDataDialog: FC<SlyDataDialogProps>;
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2025 Cognizant Technology Solutions Corp, www.cognizant.com.
|
|
4
|
+
|
|
5
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
you may not use this file except in compliance with the License.
|
|
7
|
+
You may obtain a copy of the License at
|
|
8
|
+
|
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
|
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
See the License for the specific language governing permissions and
|
|
15
|
+
limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import DataObjectIcon from "@mui/icons-material/DataObject";
|
|
18
|
+
import DeleteOutlined from "@mui/icons-material/DeleteOutlined";
|
|
19
|
+
import FileDownloadOutlined from "@mui/icons-material/FileDownloadOutlined";
|
|
20
|
+
import FileUploadOutlined from "@mui/icons-material/FileUploadOutlined";
|
|
21
|
+
import Alert from "@mui/material/Alert";
|
|
22
|
+
import Box from "@mui/material/Box";
|
|
23
|
+
import IconButton from "@mui/material/IconButton";
|
|
24
|
+
import TextField from "@mui/material/TextField";
|
|
25
|
+
import Tooltip from "@mui/material/Tooltip";
|
|
26
|
+
import Typography from "@mui/material/Typography";
|
|
27
|
+
import { Fragment, useMemo, useRef, useState } from "react";
|
|
28
|
+
import { useAgentChatHistoryStore } from "../../../state/ChatHistory.js";
|
|
29
|
+
import { downloadFile, toSafeFilename } from "../../../utils/File.js";
|
|
30
|
+
import { findImageValues, formatSlyData, parseSlyData } from "../../../utils/SlyData.js";
|
|
31
|
+
import { StyledButton } from "../../Common/ConfirmationModal.js";
|
|
32
|
+
import { MUIDialog } from "../../Common/MUIDialog.js";
|
|
33
|
+
import InfoTip from "../../Settings/InfoTip.js";
|
|
34
|
+
//#endregion: Types
|
|
35
|
+
//#region: Constants
|
|
36
|
+
// Avoids a new array literal as a default prop value on every render
|
|
37
|
+
const NO_EXTRA_KEYS = [];
|
|
38
|
+
// Height of the JSON editor, in rows. Big enough to see a realistic payload without dominating the screen.
|
|
39
|
+
const EDITOR_ROWS = 14;
|
|
40
|
+
// Edge length of the image previews, in pixels
|
|
41
|
+
const IMAGE_PREVIEW_SIZE = 96;
|
|
42
|
+
// Tooltip explaining what sly data is, in end-user terms: it exists to carry values (credentials included) that
|
|
43
|
+
// belong with the request but must stay out of the LLM conversation.
|
|
44
|
+
const SLY_DATA_EXPLAINER = "Data is sent to the agent network in a private channel with each request but kept out of the LLM.";
|
|
45
|
+
//#endregion: Constants
|
|
46
|
+
/**
|
|
47
|
+
* Dialog for viewing and editing the sly_data of the selected agent network.
|
|
48
|
+
* <br>
|
|
49
|
+
* sly_data is the side-channel payload that rides along with every request: the server echoes it back as the
|
|
50
|
+
* conversation progresses, and the UI bounces it to the server on the next request. Until now it was invisible.
|
|
51
|
+
* This dialog exposes it as editable JSON, so a user can inspect what the agents are passing around and seed values
|
|
52
|
+
* of their own before the first turn.
|
|
53
|
+
* <br>
|
|
54
|
+
* Edits are written straight into the per-network chat history store, which is the same place the streaming code
|
|
55
|
+
* writes server-echoed sly_data and the same place the send path reads from. There is therefore no separate plumbing
|
|
56
|
+
* to the server: whatever is saved here goes out with the next request.
|
|
57
|
+
*/
|
|
58
|
+
export const SlyDataDialog = ({ extraSlyDataKeys = NO_EXTRA_KEYS, id, isOpen, networkId, networkDisplayName, onClose, }) => {
|
|
59
|
+
const storedSlyData = useAgentChatHistoryStore((state) => networkId ? state.history[networkId]?.slyData : undefined);
|
|
60
|
+
const setSlyData = useAgentChatHistoryStore((state) => state.setSlyData);
|
|
61
|
+
const storedText = useMemo(() => formatSlyData(storedSlyData), [storedSlyData]);
|
|
62
|
+
// The user's unsaved edit, or null while they have none. While null, the editor simply renders the store,
|
|
63
|
+
// so server-echoed updates show up without any syncing code. Once the user edits, their draft is what
|
|
64
|
+
// renders, and we offer a reload instead of overwriting it (see below).
|
|
65
|
+
const [draft, setDraft] = useState(null);
|
|
66
|
+
// What the store held when the user started editing, so we can tell "the server changed sly_data" apart
|
|
67
|
+
// from "the user changed sly_data"
|
|
68
|
+
const [draftBaseline, setDraftBaseline] = useState(null);
|
|
69
|
+
const fileInputRef = useRef(null);
|
|
70
|
+
// Derived rather than stored: dirtiness is simply "a draft exists"
|
|
71
|
+
const isDirty = draft !== null;
|
|
72
|
+
const text = draft ?? storedText;
|
|
73
|
+
const parseResult = useMemo(() => parseSlyData(text), [text]);
|
|
74
|
+
const images = useMemo(() => findImageValues(parseResult.value), [parseResult]);
|
|
75
|
+
// The server echoed new sly_data while the user had unsaved edits. Saying so beats silently discarding
|
|
76
|
+
// either side's version.
|
|
77
|
+
const wasUpdatedByServer = isDirty && storedText !== draftBaseline;
|
|
78
|
+
/** Records a user edit, snapshotting what the store held when editing began. */
|
|
79
|
+
const startOrUpdateDraft = (newText) => {
|
|
80
|
+
if (draft === null) {
|
|
81
|
+
setDraftBaseline(storedText);
|
|
82
|
+
}
|
|
83
|
+
setDraft(newText);
|
|
84
|
+
};
|
|
85
|
+
const handleTextChange = (event) => {
|
|
86
|
+
startOrUpdateDraft(event.target.value);
|
|
87
|
+
};
|
|
88
|
+
const handleReload = () => {
|
|
89
|
+
setDraft(null);
|
|
90
|
+
setDraftBaseline(null);
|
|
91
|
+
};
|
|
92
|
+
const handleClear = () => {
|
|
93
|
+
startOrUpdateDraft("{}");
|
|
94
|
+
};
|
|
95
|
+
const handleExport = () => {
|
|
96
|
+
if (parseResult.error) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const filename = `${toSafeFilename(`${networkId}-sly-data`)}.json`;
|
|
100
|
+
downloadFile(formatSlyData(parseResult.value), filename, "application/json");
|
|
101
|
+
};
|
|
102
|
+
const handleFileSelected = async (event) => {
|
|
103
|
+
const file = event.target.files?.[0];
|
|
104
|
+
// Reset the input so that picking the same file again still fires a change event
|
|
105
|
+
event.target.value = "";
|
|
106
|
+
if (!file) {
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// Whatever the file contains goes into the editor as-is. If it isn't usable sly_data, the same validation
|
|
110
|
+
// that guards typing will explain why.
|
|
111
|
+
startOrUpdateDraft(await file.text());
|
|
112
|
+
};
|
|
113
|
+
const handleSave = () => {
|
|
114
|
+
if (parseResult.error) {
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
setSlyData(networkId, parseResult.value);
|
|
118
|
+
onClose();
|
|
119
|
+
};
|
|
120
|
+
const getTitle = () => (_jsxs(Box, { sx: { alignItems: "center", display: "flex", gap: 0.75 }, children: [_jsx(DataObjectIcon, { fontSize: "small", id: `${id}-title-icon` }), _jsxs("span", { children: ["Sly data for ", networkDisplayName] }), _jsx(InfoTip, { title: SLY_DATA_EXPLAINER })] }));
|
|
121
|
+
const getToolbar = () => (_jsxs(Box, { sx: { display: "flex", gap: 0.5, justifyContent: "flex-end" }, children: [_jsx(Tooltip, { title: "Import from a JSON file", children: _jsx("span", { children: _jsx(IconButton, { "aria-label": "Import sly data", id: `${id}-import-button`, onClick: () => fileInputRef.current?.click(), size: "small", children: _jsx(FileUploadOutlined, { fontSize: "small" }) }) }) }), _jsx(Tooltip, { title: "Export to a JSON file", children: _jsx("span", { children: _jsx(IconButton, { "aria-label": "Export sly data", disabled: Boolean(parseResult.error), id: `${id}-export-button`, onClick: handleExport, size: "small", children: _jsx(FileDownloadOutlined, { fontSize: "small" }) }) }) }), _jsx(Tooltip, { title: "Clear all sly data (takes effect when you save)", children: _jsx("span", { children: _jsx(IconButton, { "aria-label": "Clear sly data", id: `${id}-clear-button`, onClick: handleClear, size: "small", sx: { "&:hover": { color: "error.main" } }, children: _jsx(DeleteOutlined, { fontSize: "small" }) }) }) }), _jsx("input", { accept: "application/json, .json", "aria-label": "Sly data file", "data-testid": `${id}-file-input`, id: `${id}-file-input`, onChange: handleFileSelected, ref: fileInputRef, style: { display: "none" }, type: "file" })] }));
|
|
122
|
+
const getServerUpdateAlert = () => wasUpdatedByServer && (_jsx(Alert, { action: _jsx(StyledButton, { id: `${id}-reload-button`, onClick: handleReload, variant: "outlined", children: "Reload" }), id: `${id}-server-update-alert`, severity: "info", sx: { my: 1 }, children: "The agents updated sly data while you were editing. Reloading discards your changes." }));
|
|
123
|
+
/**
|
|
124
|
+
* Preview strip for any values that look like images. Read-only: the underlying value stays editable as text.
|
|
125
|
+
* Agent networks do not have a settled convention for passing images over sly_data yet, so this displays what
|
|
126
|
+
* it can recognize rather than assuming a shape.
|
|
127
|
+
*/
|
|
128
|
+
const getImagePreviews = () => images.length > 0 && (_jsxs(Box, { id: `${id}-images`, children: [_jsx(Typography, { sx: { fontSize: "0.75rem", mt: 1 }, variant: "caption", children: "Images in sly data" }), _jsx(Box, { sx: { display: "flex", flexWrap: "wrap", gap: 1, mt: 0.5 }, children: images.map((image) => (_jsxs(Box, { sx: { maxWidth: IMAGE_PREVIEW_SIZE, textAlign: "center" }, children: [_jsx("img", { alt: image.path, loading: "lazy", referrerPolicy: "no-referrer", src: image.src, style: {
|
|
129
|
+
height: IMAGE_PREVIEW_SIZE,
|
|
130
|
+
objectFit: "contain",
|
|
131
|
+
width: IMAGE_PREVIEW_SIZE,
|
|
132
|
+
} }), _jsx(Typography, { sx: { display: "block", fontSize: "0.7rem", overflowWrap: "anywhere" }, variant: "caption", children: image.path })] }, image.path))) })] }));
|
|
133
|
+
/**
|
|
134
|
+
* Explains the keys that this dialog deliberately does not show, so that their absence doesn't look like a bug.
|
|
135
|
+
*/
|
|
136
|
+
const getMergedKeysNote = () => extraSlyDataKeys.length > 0 && (_jsxs(Alert, { id: `${id}-merged-keys`, severity: "info", sx: { mt: 0.5, py: 0, "& .MuiAlert-message": { fontSize: "0.75rem" } }, children: ["Sent automatically with every request:", " ", [...extraSlyDataKeys].sort().map((key, index) => (_jsxs(Fragment, { children: [index > 0 && ", ", _jsx(Box, { component: "code", sx: {
|
|
137
|
+
backgroundColor: "action.hover",
|
|
138
|
+
borderRadius: 0.5,
|
|
139
|
+
fontFamily: "monospace",
|
|
140
|
+
px: 0.5,
|
|
141
|
+
}, children: key })] }, key))), ". Supplied by the app, not from this editor."] }));
|
|
142
|
+
const getFooter = () => (_jsxs(_Fragment, { children: [_jsx(StyledButton, { id: `${id}-cancel-button`, onClick: onClose, variant: "outlined", children: "Cancel" }), _jsx(StyledButton, { disabled: Boolean(parseResult.error), id: `${id}-save-button`, onClick: handleSave, variant: "contained", children: "Save" })] }));
|
|
143
|
+
return (_jsxs(MUIDialog, { contentSx: { minWidth: "550px", paddingTop: "0" }, footer: getFooter(), id: id, isOpen: isOpen, onClose: onClose, paperProps: { maxWidth: "800px", width: "80vw" }, title: getTitle(), children: [getToolbar(), getServerUpdateAlert(), _jsx(TextField, { error: Boolean(parseResult.error), fullWidth: true, helperText: parseResult.error ?? " ", id: `${id}-editor`, maxRows: EDITOR_ROWS, minRows: EDITOR_ROWS, multiline: true, onChange: handleTextChange, slotProps: {
|
|
144
|
+
htmlInput: {
|
|
145
|
+
"aria-label": "Sly data",
|
|
146
|
+
spellCheck: false,
|
|
147
|
+
style: { fontFamily: "monospace", fontSize: "0.8rem" },
|
|
148
|
+
},
|
|
149
|
+
}, value: text }), getImagePreviews(), getMergedKeysNote()] }));
|
|
150
|
+
};
|
|
@@ -5,8 +5,8 @@ import { useMemo } from "react";
|
|
|
5
5
|
import ReactMarkdown from "react-markdown";
|
|
6
6
|
import { MessageRole } from "./ConversationTurn.js";
|
|
7
7
|
import { ChatMessageType } from "../../../generated/neuro-san/NeuroSanClient.js";
|
|
8
|
+
import { toDisplayName } from "../../../utils/AgentName.js";
|
|
8
9
|
import { AccordionLite } from "../../Common/AccordionLite.js";
|
|
9
|
-
import { cleanUpAgentName, removeTrailingUuid } from "../Common/Utils.js";
|
|
10
10
|
/**
|
|
11
11
|
* Set of message types that should be included in the "thinking" section.
|
|
12
12
|
*/
|
|
@@ -19,7 +19,7 @@ const THINKING_MESSAGE_TYPES = new Set([
|
|
|
19
19
|
const DEFAULT_AGENT_NAME = "agent";
|
|
20
20
|
const formatTurn = (turn, useNativeNames) => {
|
|
21
21
|
const agentName = turn.agentName ?? DEFAULT_AGENT_NAME;
|
|
22
|
-
const displayName =
|
|
22
|
+
const displayName = toDisplayName(agentName, useNativeNames);
|
|
23
23
|
const headerLine = `**${displayName}**: ${turn.text || ""}`;
|
|
24
24
|
const structureLine = turn.structure == null ? "" : `\n\`${JSON.stringify(turn.structure, null, 2)}\``;
|
|
25
25
|
return `${headerLine}${structureLine}`;
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const SmallLlmChatButton: import("@emotion/styled").StyledComponent<import("@mui/material/Button").ButtonOwnProps & Omit<import("@mui/material/ButtonBase").ButtonBaseOwnProps, keyof import("@mui/material/Button").ButtonOwnProps> & Omit<import("@mui/material/ButtonBase").ButtonBaseOwnProps, "tabIndex" | "type" | "action" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | keyof import("@mui/material/Button").ButtonOwnProps> & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "style" | "children" | "sx" | "className" | "tabIndex" | "color" | "href" | "type" | "classes" | "variant" | "action" | "size" | "disabled" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "nativeButton" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "loading" | "loadingIndicator" | "disableElevation" | "endIcon" | "fullWidth" | "loadingPosition" | "startIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & LLMChatGroupConfigBtnProps, {}, {}>;
|
|
6
|
-
export {};
|
|
1
|
+
import { ButtonProps } from "@mui/material/Button";
|
|
2
|
+
import { ComponentType } from "react";
|
|
3
|
+
export declare const LlmChatButton: ComponentType<ButtonProps>;
|
|
4
|
+
export declare const SmallLlmChatButton: ComponentType<ButtonProps>;
|
|
@@ -15,8 +15,6 @@ limitations under the License.
|
|
|
15
15
|
*/
|
|
16
16
|
import Button from "@mui/material/Button";
|
|
17
17
|
import { styled } from "@mui/material/styles";
|
|
18
|
-
//#endregion: Types
|
|
19
|
-
// In LlmChatButton.tsx
|
|
20
18
|
export const LlmChatButton = styled(Button)(({ disabled, theme }) => ({
|
|
21
19
|
backgroundColor: theme.palette.background.paper,
|
|
22
20
|
borderRadius: "var(--bs-border-radius)",
|
|
@@ -3,14 +3,3 @@ export declare const KNOWN_MESSAGE_TYPES: ChatMessageType[];
|
|
|
3
3
|
export declare const KNOWN_MESSAGE_TYPES_FOR_PLASMA: ChatMessageType[];
|
|
4
4
|
export declare const chatMessageFromChunk: (chunk: string) => ChatMessage | null;
|
|
5
5
|
export declare const checkError: (chatMessageJson: Record<string, unknown>) => string | null;
|
|
6
|
-
/**
|
|
7
|
-
* Strip a trailing canonical (hyphen-delimited) UUID appended to an agent name or
|
|
8
|
-
* reservation_id, e.g. `copy_cat-hello_world-14ecb260-4389-44f3-afad-ea315dfa1966`.
|
|
9
|
-
*/
|
|
10
|
-
export declare const removeTrailingUuid: (agentName: string) => string;
|
|
11
|
-
/**
|
|
12
|
-
* Convert FOO_BAR to more human "Foo Bar".
|
|
13
|
-
* @param agentName Agent name in SNAKE_CASE format.
|
|
14
|
-
* @returns User-friendly agent name.
|
|
15
|
-
*/
|
|
16
|
-
export declare const cleanUpAgentName: (agentName: string) => string;
|
|
@@ -14,7 +14,6 @@ See the License for the specific language governing permissions and
|
|
|
14
14
|
limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import { isEmpty } from "lodash-es";
|
|
17
|
-
import startCase from "lodash-es/startCase";
|
|
18
17
|
import { ChatMessageType } from "../../../generated/neuro-san/NeuroSanClient.js";
|
|
19
18
|
// We ignore any messages that are not of these types
|
|
20
19
|
export const KNOWN_MESSAGE_TYPES = [
|
|
@@ -60,18 +59,3 @@ export const checkError = (chatMessageJson) => {
|
|
|
60
59
|
const { error, traceback, tool } = chatMessageJson;
|
|
61
60
|
return `Error occurred. Error: "${error}", traceback: "${traceback}", tool: "${tool}"`;
|
|
62
61
|
};
|
|
63
|
-
/**
|
|
64
|
-
* Strip a trailing canonical (hyphen-delimited) UUID appended to an agent name or
|
|
65
|
-
* reservation_id, e.g. `copy_cat-hello_world-14ecb260-4389-44f3-afad-ea315dfa1966`.
|
|
66
|
-
*/
|
|
67
|
-
export const removeTrailingUuid = (agentName) => {
|
|
68
|
-
return agentName?.replace(/-[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/u, "");
|
|
69
|
-
};
|
|
70
|
-
/**
|
|
71
|
-
* Convert FOO_BAR to more human "Foo Bar".
|
|
72
|
-
* @param agentName Agent name in SNAKE_CASE format.
|
|
73
|
-
* @returns User-friendly agent name.
|
|
74
|
-
*/
|
|
75
|
-
export const cleanUpAgentName = (agentName) => {
|
|
76
|
-
return startCase(agentName);
|
|
77
|
-
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { ButtonProps } from "@mui/material/Button";
|
|
2
|
+
import { ComponentType, FC, ReactNode } from "react";
|
|
3
|
+
export declare const StyledButton: ComponentType<ButtonProps>;
|
|
3
4
|
interface ConfirmationModalProps {
|
|
4
5
|
cancelBtnLabel?: string;
|
|
5
6
|
closeable?: boolean;
|
|
@@ -7,6 +7,8 @@ import { navigateToUrl } from "../../utils/BrowserNavigation.js";
|
|
|
7
7
|
const HeaderLine = styled("h6")({
|
|
8
8
|
fontWeight: "bold",
|
|
9
9
|
fontSize: "smaller",
|
|
10
|
+
margin: 0,
|
|
11
|
+
marginBottom: "0.9rem",
|
|
10
12
|
});
|
|
11
13
|
const LinkDivider = styled("div")({
|
|
12
14
|
border: "1px solid var(--bs-accent3-medium)",
|
|
@@ -16,6 +18,7 @@ const LinkDivider = styled("div")({
|
|
|
16
18
|
const FooterSectionHeader = styled("div")({
|
|
17
19
|
display: "inline-flex",
|
|
18
20
|
flexDirection: "column",
|
|
21
|
+
alignItems: "flex-start",
|
|
19
22
|
marginTop: "0.1rem",
|
|
20
23
|
});
|
|
21
24
|
const FooterItemLink = styled("a")(({ theme }) => ({
|
|
@@ -31,6 +34,7 @@ const FooterItemLink = styled("a")(({ theme }) => ({
|
|
|
31
34
|
const FooterContainer = styled("footer")({
|
|
32
35
|
backgroundColor: "var(--bs-primary)",
|
|
33
36
|
borderTop: "var(--bs-border-width) var(--bs-border-style) var(--bs-gray-lighter)",
|
|
37
|
+
alignItems: "flex-start",
|
|
34
38
|
columnGap: "60px",
|
|
35
39
|
display: "flex",
|
|
36
40
|
justifyContent: "center",
|
|
@@ -8,6 +8,7 @@ export interface NavbarProps {
|
|
|
8
8
|
name: string;
|
|
9
9
|
image: string;
|
|
10
10
|
};
|
|
11
|
+
readonly enableAuthentication: boolean;
|
|
11
12
|
readonly authenticationType: string;
|
|
12
13
|
readonly signOut: () => void;
|
|
13
14
|
readonly supportEmailAddress: string;
|
|
@@ -15,4 +16,4 @@ export interface NavbarProps {
|
|
|
15
16
|
readonly showSettingsButton?: boolean;
|
|
16
17
|
readonly onStartTour?: () => void;
|
|
17
18
|
}
|
|
18
|
-
export declare const Navbar: ({ authenticationType, id, logo, logoServiceToken, onStartTour, pathname, query, showSettingsButton, signOut, supportEmailAddress, userInfo, }: NavbarProps) => ReactJSX.Element;
|
|
19
|
+
export declare const Navbar: ({ enableAuthentication, authenticationType, id, logo, logoServiceToken, onStartTour, pathname, query, showSettingsButton, signOut, supportEmailAddress, userInfo, }: NavbarProps) => ReactJSX.Element;
|
|
@@ -31,7 +31,7 @@ import Tooltip from "@mui/material/Tooltip";
|
|
|
31
31
|
import Typography from "@mui/material/Typography";
|
|
32
32
|
import { useState } from "react";
|
|
33
33
|
import { ConfirmationModal } from "./ConfirmationModal.js";
|
|
34
|
-
import {
|
|
34
|
+
import { DEFAULT_USER_IMAGE, getContactUsConfirmationText, NEURO_SAN_UI_VERSION } from "../../const.js";
|
|
35
35
|
import { useSettingsStore } from "../../state/Settings.js";
|
|
36
36
|
import { isDarkMode } from "../../Theme/Theme.js";
|
|
37
37
|
import { navigateToUrl } from "../../utils/BrowserNavigation.js";
|
|
@@ -53,7 +53,7 @@ const DISABLE_OUTLINE_PROPS = {
|
|
|
53
53
|
outline: "none",
|
|
54
54
|
},
|
|
55
55
|
};
|
|
56
|
-
export const Navbar = ({ authenticationType, id, logo, logoServiceToken, onStartTour, pathname, query, showSettingsButton = true, signOut, supportEmailAddress, userInfo, }) => {
|
|
56
|
+
export const Navbar = ({ enableAuthentication, authenticationType, id, logo, logoServiceToken, onStartTour, pathname, query, showSettingsButton = true, signOut, supportEmailAddress, userInfo, }) => {
|
|
57
57
|
// For email dialog
|
|
58
58
|
const [emailDialogOpen, setEmailDialogOpen] = useState(false);
|
|
59
59
|
// Dark mode
|
|
@@ -149,7 +149,7 @@ export const Navbar = ({ authenticationType, id, logo, logoServiceToken, onStart
|
|
|
149
149
|
whiteSpace: "normal",
|
|
150
150
|
wordWrap: "break-word",
|
|
151
151
|
fontSize: "smaller",
|
|
152
|
-
}, children: userInfo.name }), _jsx(MenuItem, { id: "auth-type-title", disabled: true, sx: { fontWeight: "bold" }, children: "Authentication" }), _jsx(MenuItem, { id: "authentication-type-menu-item", disabled: true, sx: { fontSize: "smaller" }, children: authenticationType }),
|
|
152
|
+
}, children: userInfo.name }), _jsx(MenuItem, { id: "auth-type-title", disabled: true, sx: { fontWeight: "bold" }, children: "Authentication" }), _jsx(MenuItem, { id: "authentication-type-menu-item", disabled: true, sx: { fontSize: "smaller" }, children: authenticationType }), enableAuthentication && (_jsx(MenuItem, { id: "user-sign-out", sx: { ...DISABLE_OUTLINE_PROPS, fontWeight: "bold" }, onClick: signOut, children: "Sign out" }))] })] })) : null, _jsx(Tooltip, { id: "dark-mode-toggle", title: hasCustomer
|
|
153
153
|
? "Dark mode toggle is not available when customer branding is active. Reset via Settings menu."
|
|
154
154
|
: "Toggle dark mode", children: _jsx(DarkModeIcon, { id: "dark-mode-icon", sx: {
|
|
155
155
|
marginRight: "1rem",
|
|
@@ -19,7 +19,7 @@ import { useRouter } from "next/router.js";
|
|
|
19
19
|
import { LOGO } from "../../const.js";
|
|
20
20
|
import { useEnvironmentStore } from "../../state/Environment.js";
|
|
21
21
|
import { useUserInfoStore } from "../../state/UserInfo.js";
|
|
22
|
-
import { smartSignOut, useAuthentication } from "../../utils/Authentication.js";
|
|
22
|
+
import { getAuthenticationType, smartSignOut, useAuthentication } from "../../utils/Authentication.js";
|
|
23
23
|
import { NeuroAIBreadcrumbs } from "../Common/Breadcrumbs.js";
|
|
24
24
|
import { Footer } from "../Common/Footer.js";
|
|
25
25
|
import { Navbar } from "../Common/Navbar.js";
|
|
@@ -29,13 +29,13 @@ import { Navbar } from "../Common/Navbar.js";
|
|
|
29
29
|
* @param errorText Error text to be displayed
|
|
30
30
|
*/
|
|
31
31
|
const ErrorPage = ({ id, errorText }) => {
|
|
32
|
-
const { auth0ClientId, auth0Domain,
|
|
32
|
+
const { auth0ClientId, auth0Domain, enableAuthentication, logoServiceToken, supportEmailAddress } = useEnvironmentStore();
|
|
33
33
|
// Access Next.js router
|
|
34
34
|
const router = useRouter();
|
|
35
35
|
// Access user info store
|
|
36
36
|
const { currentUser, setCurrentUser, setPicture, oidcProvider } = useUserInfoStore();
|
|
37
37
|
// Infer authentication type
|
|
38
|
-
const authenticationType = currentUser
|
|
38
|
+
const authenticationType = getAuthenticationType(enableAuthentication, currentUser, oidcProvider);
|
|
39
39
|
const { data: { user: userInfo } = {} } = useAuthentication();
|
|
40
40
|
const handleSignOut = async () => {
|
|
41
41
|
// Clear our state storage variables
|
|
@@ -43,6 +43,6 @@ const ErrorPage = ({ id, errorText }) => {
|
|
|
43
43
|
setPicture(undefined);
|
|
44
44
|
await smartSignOut(currentUser, auth0Domain, auth0ClientId, oidcProvider);
|
|
45
45
|
};
|
|
46
|
-
return (_jsxs(_Fragment, { children: [_jsx(Navbar, { authenticationType: authenticationType, id: "nav-bar", logo: LOGO, logoServiceToken: logoServiceToken, pathname: router.pathname, query: router.query, signOut: handleSignOut, supportEmailAddress: supportEmailAddress, userInfo: userInfo }), _jsxs(Box, { id: id, sx: { marginLeft: "1rem" }, children: [_jsx(NeuroAIBreadcrumbs, {}), _jsx("h4", { id: "error-header", style: { color: "var(--bs-red)", marginTop: "1rem" }, children: "Oops, an internal error occurred on our end." }), _jsxs("div", { id: "error-div-1", children: [_jsxs(Box, { id: "no-need-to-worry", sx: { marginBottom: "1.5rem" }, children: [_jsx("b", { id: "bold-1", children: "There's no need to worry \u2013 you didn't do anything wrong." }), " This is a bug in our server and we'll fix it as soon as possible."] }), _jsx(Box, { id: "try-these-steps", sx: { marginBottom: "1.5rem" }, children: "To attempt to recover from the error, try these steps:" }), _jsx(Box, { id: "refresh-page", sx: { marginBottom: "1.5rem" }, children: _jsxs("ul", { id: "error-boundary-advice-list", className: "list-decimal list-inside", children: [_jsx("li", { id: "error-advice-refresh", children: "Refresh the page to see if the error goes away." }), _jsx("li", { id: "error-advice-reload", children: "Close and re-open your browser, then navigate back to the page where you encountered the error." })] }) }), "If none of that helps, please report the following error to the LEAF team:"] }), _jsx("div", { id: "error-text-div", style: { fontFamily: "monospace", marginTop: "1.5rem", marginBottom: "1.5rem" }, children: errorText }), "More information may be available in the browser console. Please include such information in your report if possible."] }), _jsx(Footer, { supportEmailAddress: supportEmailAddress, logoLinkUrl: "https://www.cognizant.com/", logoUrl: "/cognizant-logo-white.svg" })] }));
|
|
46
|
+
return (_jsxs(_Fragment, { children: [_jsx(Navbar, { enableAuthentication: enableAuthentication, authenticationType: authenticationType, id: "nav-bar", logo: LOGO, logoServiceToken: logoServiceToken, pathname: router.pathname, query: router.query, signOut: handleSignOut, supportEmailAddress: supportEmailAddress, userInfo: userInfo }), _jsxs(Box, { id: id, sx: { marginLeft: "1rem" }, children: [_jsx(NeuroAIBreadcrumbs, {}), _jsx("h4", { id: "error-header", style: { color: "var(--bs-red)", marginTop: "1rem" }, children: "Oops, an internal error occurred on our end." }), _jsxs("div", { id: "error-div-1", children: [_jsxs(Box, { id: "no-need-to-worry", sx: { marginBottom: "1.5rem" }, children: [_jsx("b", { id: "bold-1", children: "There's no need to worry \u2013 you didn't do anything wrong." }), " This is a bug in our server and we'll fix it as soon as possible."] }), _jsx(Box, { id: "try-these-steps", sx: { marginBottom: "1.5rem" }, children: "To attempt to recover from the error, try these steps:" }), _jsx(Box, { id: "refresh-page", sx: { marginBottom: "1.5rem" }, children: _jsxs("ul", { id: "error-boundary-advice-list", className: "list-decimal list-inside", children: [_jsx("li", { id: "error-advice-refresh", children: "Refresh the page to see if the error goes away." }), _jsx("li", { id: "error-advice-reload", children: "Close and re-open your browser, then navigate back to the page where you encountered the error." })] }) }), "If none of that helps, please report the following error to the LEAF team:"] }), _jsx("div", { id: "error-text-div", style: { fontFamily: "monospace", marginTop: "1.5rem", marginBottom: "1.5rem" }, children: errorText }), "More information may be available in the browser console. Please include such information in your report if possible."] }), _jsx(Footer, { supportEmailAddress: supportEmailAddress, logoLinkUrl: "https://www.cognizant.com/", logoUrl: "/cognizant-logo-white.svg" })] }));
|
|
47
47
|
};
|
|
48
48
|
export default ErrorPage;
|
|
@@ -15,9 +15,9 @@ export interface AgentFlowProps {
|
|
|
15
15
|
readonly id: string;
|
|
16
16
|
readonly isAwaitingLlm?: boolean;
|
|
17
17
|
readonly isAgentNetworkDesignerMode?: boolean;
|
|
18
|
-
readonly
|
|
18
|
+
readonly isEditingNetwork?: boolean;
|
|
19
19
|
readonly isStreaming?: boolean;
|
|
20
|
-
readonly
|
|
20
|
+
readonly isTemporaryNetwork?: boolean;
|
|
21
21
|
/** The history key for the currently selected network (used to scope sly_data reads/writes per network). */
|
|
22
22
|
readonly networkId?: string;
|
|
23
23
|
readonly neuroSanURL?: string;
|
|
@@ -27,10 +27,11 @@ export interface AgentFlowProps {
|
|
|
27
27
|
* @param newNetworkId The agent_name of the replacement network to navigate to.
|
|
28
28
|
*/
|
|
29
29
|
readonly networkDisplayName?: string;
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
readonly
|
|
30
|
+
/**
|
|
31
|
+
* Setter for changing the selected network.
|
|
32
|
+
*/
|
|
33
|
+
readonly setSelectedNetwork?: (network: string | null) => void;
|
|
34
|
+
readonly setIsEditingNetwork?: (value: boolean) => void;
|
|
34
35
|
readonly onSaveAgent?: (agentName: string, updated: AgentNetworkDefinitionEntry[], agentNetworkName: string | undefined, signal: AbortSignal) => Promise<void>;
|
|
35
36
|
readonly thoughtBubbleEdges: Map<string, {
|
|
36
37
|
edge: ThoughtBubbleEdgeShape;
|
|
@@ -41,7 +42,6 @@ export interface AgentFlowProps {
|
|
|
41
42
|
timestamp: number;
|
|
42
43
|
}>>>;
|
|
43
44
|
}
|
|
44
|
-
export declare const DOCK_BANNER_AUTO_DISMISS_MS = 5000;
|
|
45
45
|
/**
|
|
46
46
|
* Filters node events based on the current mode. Don't allow any topological-modifying events (adding, deleting nodes)
|
|
47
47
|
* and in Agent Network Designer mode, don't allow dragging nodes (position changes) either.
|