@cognizant-ai-lab/ui-common 1.11.0 → 1.12.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.d.ts +5 -0
- package/dist/components/AgentChat/ChatCommon/ChatCommon.js +2 -2
- package/dist/components/AgentChat/ChatCommon/SlyDataDialog.d.ts +5 -0
- package/dist/components/AgentChat/ChatCommon/SlyDataDialog.js +49 -12
- package/dist/components/Common/GoogleAnalytics.d.ts +16 -0
- package/dist/components/Common/GoogleAnalytics.js +32 -0
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +5 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/SlyDataSchema.d.ts +31 -0
- package/dist/utils/SlyDataSchema.js +149 -0
- package/package.json +3 -3
|
@@ -99,6 +99,11 @@ export interface ChatCommonProps {
|
|
|
99
99
|
* If true, indicates that the user is missing API keys for one or more LLM providers.
|
|
100
100
|
*/
|
|
101
101
|
readonly hasMissingApiKeys?: boolean;
|
|
102
|
+
/**
|
|
103
|
+
* The sly_data_schema the selected network's front man advertises, if any. Enables schema hints in the
|
|
104
|
+
* sly_data dialog.
|
|
105
|
+
*/
|
|
106
|
+
readonly slyDataSchema?: Record<string, unknown>;
|
|
102
107
|
}
|
|
103
108
|
export type ChatCommonHandle = {
|
|
104
109
|
handleStop: () => void;
|
|
@@ -97,7 +97,7 @@ export const roleToExportLabel = (role) => EXPORT_ROLE_LABELS[role];
|
|
|
97
97
|
* agent responses. Customization for inputs and outputs is provided via event handlers-like props.
|
|
98
98
|
*/
|
|
99
99
|
export const ChatCommon = ({ ref, ...props }) => {
|
|
100
|
-
const { agentPlaceholders = EMPTY, backgroundColor, currentUser, customAgentGreetings = EMPTY, extraParams, extraSlyData, id, isAwaitingLlm, legacyAgentEndpoint, hasMissingApiKeys = false, networkDescription, neuroSanURL, onChunkReceived, onClose, onSend, onStreamingComplete, onStreamingStarted, sampleQueries, selectedNetwork, setIsAwaitingLlm, setPreviousResponse, setSelectedNetwork, title, } = props;
|
|
100
|
+
const { agentPlaceholders = EMPTY, backgroundColor, currentUser, customAgentGreetings = EMPTY, extraParams, extraSlyData, id, isAwaitingLlm, legacyAgentEndpoint, hasMissingApiKeys = false, networkDescription, neuroSanURL, onChunkReceived, onClose, onSend, onStreamingComplete, onStreamingStarted, sampleQueries, selectedNetwork, setIsAwaitingLlm, setPreviousResponse, setSelectedNetwork, slyDataSchema, title, } = props;
|
|
101
101
|
// MUI theme
|
|
102
102
|
const theme = useTheme();
|
|
103
103
|
// User LLM chat input
|
|
@@ -670,7 +670,7 @@ export const ChatCommon = ({ ref, ...props }) => {
|
|
|
670
670
|
resetHistory(selectedNetwork);
|
|
671
671
|
setPreviousUserQuery("");
|
|
672
672
|
currentResponse.current = "";
|
|
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: {
|
|
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), slyDataSchema: slyDataSchema })) : null, _jsxs(Box, { id: "llm-responses", ref: chatOutputRef, sx: {
|
|
674
674
|
backgroundColor,
|
|
675
675
|
borderRadius: "0.5rem",
|
|
676
676
|
fontSize: "16px",
|
|
@@ -13,6 +13,11 @@ export interface SlyDataDialogProps {
|
|
|
13
13
|
/** Human-readable name of the network, for display only */
|
|
14
14
|
readonly networkDisplayName: string;
|
|
15
15
|
readonly onClose: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* The sly_data_schema the network's front man advertises, if any. When present and usable, the dialog lists
|
|
18
|
+
* the expected keys and offers to seed them as a template.
|
|
19
|
+
*/
|
|
20
|
+
readonly slyDataSchema?: Record<string, unknown>;
|
|
16
21
|
}
|
|
17
22
|
/**
|
|
18
23
|
* Dialog for viewing and editing the sly_data of the selected agent network.
|
|
@@ -18,9 +18,11 @@ import DataObjectIcon from "@mui/icons-material/DataObject";
|
|
|
18
18
|
import DeleteOutlined from "@mui/icons-material/DeleteOutlined";
|
|
19
19
|
import FileDownloadOutlined from "@mui/icons-material/FileDownloadOutlined";
|
|
20
20
|
import FileUploadOutlined from "@mui/icons-material/FileUploadOutlined";
|
|
21
|
+
import PlaylistAddOutlined from "@mui/icons-material/PlaylistAddOutlined";
|
|
21
22
|
import Alert from "@mui/material/Alert";
|
|
22
23
|
import Box from "@mui/material/Box";
|
|
23
24
|
import IconButton from "@mui/material/IconButton";
|
|
25
|
+
import { styled } from "@mui/material/styles";
|
|
24
26
|
import TextField from "@mui/material/TextField";
|
|
25
27
|
import Tooltip from "@mui/material/Tooltip";
|
|
26
28
|
import Typography from "@mui/material/Typography";
|
|
@@ -28,6 +30,7 @@ import { Fragment, useMemo, useRef, useState } from "react";
|
|
|
28
30
|
import { useAgentChatHistoryStore } from "../../../state/ChatHistory.js";
|
|
29
31
|
import { downloadFile, toSafeFilename } from "../../../utils/File.js";
|
|
30
32
|
import { findImageValues, formatSlyData, parseSlyData } from "../../../utils/SlyData.js";
|
|
33
|
+
import { buildSlyDataTemplate, describeSlyDataSchema } from "../../../utils/SlyDataSchema.js";
|
|
31
34
|
import { StyledButton } from "../../Common/ConfirmationModal.js";
|
|
32
35
|
import { MUIDialog } from "../../Common/MUIDialog.js";
|
|
33
36
|
import InfoTip from "../../Settings/InfoTip.js";
|
|
@@ -43,6 +46,24 @@ const IMAGE_PREVIEW_SIZE = 96;
|
|
|
43
46
|
// belong with the request but must stay out of the LLM conversation.
|
|
44
47
|
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
48
|
//#endregion: Constants
|
|
49
|
+
// A sly_data key name rendered as an inline code chip
|
|
50
|
+
const KeyChip = styled("code")(({ theme }) => ({
|
|
51
|
+
backgroundColor: theme.palette.action.hover,
|
|
52
|
+
borderRadius: `calc(${theme.shape.borderRadius}px * 0.5)`,
|
|
53
|
+
fontFamily: "monospace",
|
|
54
|
+
paddingLeft: theme.spacing(0.5),
|
|
55
|
+
paddingRight: theme.spacing(0.5),
|
|
56
|
+
}));
|
|
57
|
+
/**
|
|
58
|
+
* Renders the parenthetical qualifiers after a schema key name, eg. " (float, required)".
|
|
59
|
+
* Empty when the schema declares neither a type nor requiredness.
|
|
60
|
+
* @param entry The schema entry to describe.
|
|
61
|
+
* @returns The qualifier text, with a leading space, or an empty string.
|
|
62
|
+
*/
|
|
63
|
+
const describeEntryQualifiers = (entry) => {
|
|
64
|
+
const qualifiers = [entry.type, entry.isRequired ? "required" : undefined].filter(Boolean);
|
|
65
|
+
return qualifiers.length > 0 ? ` (${qualifiers.join(", ")})` : "";
|
|
66
|
+
};
|
|
46
67
|
/**
|
|
47
68
|
* Dialog for viewing and editing the sly_data of the selected agent network.
|
|
48
69
|
* <br>
|
|
@@ -55,17 +76,26 @@ const SLY_DATA_EXPLAINER = "Data is sent to the agent network in a private chann
|
|
|
55
76
|
* writes server-echoed sly_data and the same place the send path reads from. There is therefore no separate plumbing
|
|
56
77
|
* to the server: whatever is saved here goes out with the next request.
|
|
57
78
|
*/
|
|
58
|
-
export const SlyDataDialog = ({ extraSlyDataKeys = NO_EXTRA_KEYS, id, isOpen, networkId, networkDisplayName, onClose, }) => {
|
|
79
|
+
export const SlyDataDialog = ({ extraSlyDataKeys = NO_EXTRA_KEYS, id, isOpen, networkId, networkDisplayName, onClose, slyDataSchema, }) => {
|
|
59
80
|
const storedSlyData = useAgentChatHistoryStore((state) => networkId ? state.history[networkId]?.slyData : undefined);
|
|
60
81
|
const setSlyData = useAgentChatHistoryStore((state) => state.setSlyData);
|
|
61
82
|
const storedText = useMemo(() => formatSlyData(storedSlyData), [storedSlyData]);
|
|
83
|
+
// The keys the network says it expects, minus the ones the app supplies on its own. Empty for the many
|
|
84
|
+
// networks that do not advertise a schema, in which case the dialog looks exactly as it always has.
|
|
85
|
+
const schemaEntries = useMemo(() => describeSlyDataSchema(slyDataSchema, extraSlyDataKeys), [slyDataSchema, extraSlyDataKeys]);
|
|
86
|
+
// The network's sly_data skeleton, pretty-printed, or null when it advertises no usable schema
|
|
87
|
+
const templateText = useMemo(() => schemaEntries.length > 0 ? formatSlyData(buildSlyDataTemplate(slyDataSchema, {}, extraSlyDataKeys)) : null, [schemaEntries, slyDataSchema, extraSlyDataKeys]);
|
|
88
|
+
// When the dialog opens onto an empty store and the network declares a schema, start from the template so
|
|
89
|
+
// the user fills in blanks instead of typing structure. It is an ordinary unsaved draft: nothing touches
|
|
90
|
+
// the store unless they save. The dialog is mounted fresh on every open, so this is per-open behavior.
|
|
91
|
+
const prefillText = storedText === "{}" ? templateText : null;
|
|
62
92
|
// The user's unsaved edit, or null while they have none. While null, the editor simply renders the store,
|
|
63
93
|
// so server-echoed updates show up without any syncing code. Once the user edits, their draft is what
|
|
64
94
|
// renders, and we offer a reload instead of overwriting it (see below).
|
|
65
|
-
const [draft, setDraft] = useState(
|
|
95
|
+
const [draft, setDraft] = useState(prefillText);
|
|
66
96
|
// What the store held when the user started editing, so we can tell "the server changed sly_data" apart
|
|
67
97
|
// from "the user changed sly_data"
|
|
68
|
-
const [draftBaseline, setDraftBaseline] = useState(null);
|
|
98
|
+
const [draftBaseline, setDraftBaseline] = useState(prefillText === null ? null : storedText);
|
|
69
99
|
const fileInputRef = useRef(null);
|
|
70
100
|
// Derived rather than stored: dirtiness is simply "a draft exists"
|
|
71
101
|
const isDirty = draft !== null;
|
|
@@ -89,8 +119,13 @@ export const SlyDataDialog = ({ extraSlyDataKeys = NO_EXTRA_KEYS, id, isOpen, ne
|
|
|
89
119
|
setDraft(null);
|
|
90
120
|
setDraftBaseline(null);
|
|
91
121
|
};
|
|
122
|
+
// On a network with a schema, "clear" means back to the blank template rather than to nothing:
|
|
123
|
+
// stranding the user on {} would force them to rebuild the structure the network just told us about.
|
|
92
124
|
const handleClear = () => {
|
|
93
|
-
startOrUpdateDraft("{}");
|
|
125
|
+
startOrUpdateDraft(templateText ?? "{}");
|
|
126
|
+
};
|
|
127
|
+
const handleFillTemplate = () => {
|
|
128
|
+
startOrUpdateDraft(formatSlyData(buildSlyDataTemplate(slyDataSchema, parseResult.value, extraSlyDataKeys)));
|
|
94
129
|
};
|
|
95
130
|
const handleExport = () => {
|
|
96
131
|
if (parseResult.error) {
|
|
@@ -118,7 +153,14 @@ export const SlyDataDialog = ({ extraSlyDataKeys = NO_EXTRA_KEYS, id, isOpen, ne
|
|
|
118
153
|
onClose();
|
|
119
154
|
};
|
|
120
155
|
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: "
|
|
156
|
+
const getToolbar = () => (_jsxs(Box, { sx: { display: "flex", gap: 0.5, justifyContent: "flex-end" }, children: [schemaEntries.length > 0 && (_jsx(Tooltip, { title: "Insert the keys this network expects (keeps your values)", children: _jsx("span", { children: _jsx(IconButton, { "aria-label": "Fill sly data template", disabled: Boolean(parseResult.error), id: `${id}-template-button`, onClick: handleFillTemplate, size: "small", children: _jsx(PlaylistAddOutlined, { fontSize: "small" }) }) }) })), _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: templateText === null
|
|
157
|
+
? "Clear all sly data (takes effect when you save)"
|
|
158
|
+
: "Reset to the network's expected keys (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" })] }));
|
|
159
|
+
/**
|
|
160
|
+
* Lists the keys the network says it expects, so the user knows what to fill in without reading the
|
|
161
|
+
* network's source. Renders nothing when the network advertises no usable schema.
|
|
162
|
+
*/
|
|
163
|
+
const getSchemaHints = () => schemaEntries.length > 0 && (_jsxs(Box, { "data-testid": `${id}-schema-hints`, id: `${id}-schema-hints`, sx: { mb: 0.5 }, children: [_jsx(Typography, { sx: { fontSize: "0.75rem" }, variant: "caption", children: "This network expects:" }), _jsx(Box, { component: "ul", sx: { listStyle: "none", m: 0, pl: 1.5 }, children: schemaEntries.map((entry) => (_jsxs(Typography, { component: "li", sx: { display: "block", fontSize: "0.75rem" }, variant: "caption", children: [_jsx(KeyChip, { children: entry.key }), describeEntryQualifiers(entry), entry.description ? `: ${entry.description}` : ""] }, entry.key))) })] }));
|
|
122
164
|
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
165
|
/**
|
|
124
166
|
* Preview strip for any values that look like images. Read-only: the underlying value stays editable as text.
|
|
@@ -133,14 +175,9 @@ export const SlyDataDialog = ({ extraSlyDataKeys = NO_EXTRA_KEYS, id, isOpen, ne
|
|
|
133
175
|
/**
|
|
134
176
|
* Explains the keys that this dialog deliberately does not show, so that their absence doesn't look like a bug.
|
|
135
177
|
*/
|
|
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(
|
|
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."] }));
|
|
178
|
+
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(KeyChip, { children: key })] }, key))), ". Supplied by the app, not from this editor."] }));
|
|
142
179
|
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: {
|
|
180
|
+
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(), getSchemaHints(), 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
181
|
htmlInput: {
|
|
145
182
|
"aria-label": "Sly data",
|
|
146
183
|
spellCheck: false,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
export declare const GOOGLE_ANALYTICS_URL = "https://www.googletagmanager.com/gtag/js";
|
|
3
|
+
declare global {
|
|
4
|
+
interface Window {
|
|
5
|
+
dataLayer: unknown[];
|
|
6
|
+
gtag: (...args: unknown[]) => void;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
interface GoogleAnalyticsProps {
|
|
10
|
+
readonly gaMeasurementID: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* This component injects the Google Analytics tracking script
|
|
14
|
+
*/
|
|
15
|
+
export declare const GoogleAnalytics: FC<GoogleAnalyticsProps>;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
// The URL for the Google Analytics script
|
|
3
|
+
export const GOOGLE_ANALYTICS_URL = "https://www.googletagmanager.com/gtag/js";
|
|
4
|
+
/**
|
|
5
|
+
* This component injects the Google Analytics tracking script
|
|
6
|
+
*/
|
|
7
|
+
export const GoogleAnalytics = ({ gaMeasurementID }) => {
|
|
8
|
+
/*
|
|
9
|
+
Effect to inject the Google Analytics script into the document head.
|
|
10
|
+
This has to be an Effect because React intentionally does not run inline <script> elements that it creates
|
|
11
|
+
in the browser. By making this an Effect, we can create a <script> element and append it to the document head,
|
|
12
|
+
which will cause the browser to execute it.
|
|
13
|
+
*/
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
const script = document.createElement("script");
|
|
16
|
+
script.async = true;
|
|
17
|
+
script.src = `${GOOGLE_ANALYTICS_URL}?id=${gaMeasurementID}`;
|
|
18
|
+
document.head.append(script);
|
|
19
|
+
window.dataLayer = window.dataLayer || [];
|
|
20
|
+
window.gtag = function () {
|
|
21
|
+
// gtag must push the `arguments` object itself, not an array, for GA to process it
|
|
22
|
+
// eslint-disable-next-line prefer-rest-params
|
|
23
|
+
window.dataLayer.push(arguments);
|
|
24
|
+
};
|
|
25
|
+
window.gtag("js", new Date());
|
|
26
|
+
window.gtag("config", gaMeasurementID);
|
|
27
|
+
return () => {
|
|
28
|
+
script.remove();
|
|
29
|
+
};
|
|
30
|
+
}, [gaMeasurementID]);
|
|
31
|
+
return null;
|
|
32
|
+
};
|
|
@@ -92,6 +92,8 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
92
92
|
const networkDisplayName = useMemo(() => toDisplayName(selectedNetwork, useNativeNames), [selectedNetwork, useNativeNames]);
|
|
93
93
|
// LLM providers for which BYOK keys are supported by the current network
|
|
94
94
|
const [supportedByokProviders, setSupportedByokProviders] = useState(new Set());
|
|
95
|
+
// The sly_data_schema advertised by the current network, if any. Drives schema hints in the sly_data dialog.
|
|
96
|
+
const [slyDataSchema, setSlyDataSchema] = useState(undefined);
|
|
95
97
|
const neuroSanURL = useSettingsStore((state) => state.settings.externalServices.neuroSanUrl) ?? defaultNeuroSanUrl;
|
|
96
98
|
// Tracks how many times each agent has been involved in the conversation
|
|
97
99
|
const [agentCounts, setAgentCounts] = useState(new Map());
|
|
@@ -279,11 +281,13 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
279
281
|
// Reset before fetching
|
|
280
282
|
setNetworkDescription("");
|
|
281
283
|
setSupportedByokProviders(new Set());
|
|
284
|
+
setSlyDataSchema(undefined);
|
|
282
285
|
// Get agent function from server
|
|
283
286
|
const agentFunction = await getAgentFunction(neuroSanURL, selectedNetwork, username);
|
|
284
287
|
setNetworkDescription(agentFunction?.function?.description || "");
|
|
285
288
|
const schema = agentFunction?.function?.sly_data_schema;
|
|
286
289
|
setSupportedByokProviders(getSupportedLlmProviders(schema));
|
|
290
|
+
setSlyDataSchema(schema);
|
|
287
291
|
}
|
|
288
292
|
catch (e) {
|
|
289
293
|
console.warn(`Unable to get agent details for network ${selectedNetwork}:`, e);
|
|
@@ -587,7 +591,7 @@ export const MultiAgentAccelerator = ({ defaultNeuroSanUrl, username, }) => {
|
|
|
587
591
|
[AGENT_NETWORK_DESIGNER_ID]: "Describe in plain language the network you would like to build.",
|
|
588
592
|
}, currentUser: username, customAgentGreetings: {
|
|
589
593
|
[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") }));
|
|
594
|
+
}, 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, slyDataSchema: slyDataSchema }, selectedNetwork ?? "no-network") }));
|
|
591
595
|
const getStopButton = () => isAwaitingLlm &&
|
|
592
596
|
enableZenMode && (_jsx(Box, { id: "stop-button-container", sx: {
|
|
593
597
|
position: "absolute",
|