@cognizant-ai-lab/ui-common 1.4.0 → 1.4.2
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.js +3 -3
- package/dist/components/Common/Navbar.js +6 -5
- package/dist/components/MultiAgentAccelerator/AgentNode.js +3 -3
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +11 -30
- package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.d.ts +1 -0
- package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +21 -2
- package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +5 -0
- package/dist/components/MultiAgentAccelerator/TemporaryNetworks.d.ts +7 -0
- package/dist/components/MultiAgentAccelerator/TemporaryNetworks.js +17 -2
- package/dist/components/MultiAgentAccelerator/const.d.ts +2 -0
- package/dist/components/MultiAgentAccelerator/const.js +4 -0
- package/dist/controller/agent/Agent.d.ts +6 -4
- package/dist/controller/agent/Agent.js +7 -6
- package/dist/controller/llm/LlmChat.d.ts +11 -1
- package/dist/controller/llm/LlmChat.js +60 -13
- package/dist/generated/neuro-san/NeuroSanClient.d.ts +3 -1
- package/dist/state/TemporaryNetworks.d.ts +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/File.d.ts +29 -0
- package/dist/utils/File.js +61 -0
- package/package.json +9 -10
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export declare const toSafeFilename: (input: string) => string;
|
|
2
|
+
/**
|
|
3
|
+
* Splits a given filename into its name and extension components.
|
|
4
|
+
* @param filename Filename as string like foo.csv or just "foo" with no extension
|
|
5
|
+
* @return An object with properties <code>name</code> containing the filename part and <code>ext</code> containing
|
|
6
|
+
* the extension, or <code>""</code> if none.
|
|
7
|
+
*/
|
|
8
|
+
export declare const splitFilename: (filename: string) => {
|
|
9
|
+
ext: string;
|
|
10
|
+
name: string;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Obtains the filename from a full path, returning only the last component of the path -- the file name
|
|
14
|
+
* with extensions.
|
|
15
|
+
* <br>
|
|
16
|
+
* Handles forward-slash and backslash-delimited paths.
|
|
17
|
+
* @example
|
|
18
|
+
* // returns baz.csv
|
|
19
|
+
* getFileName("/tmp/foo/bar/qux/baz.csv")
|
|
20
|
+
* @param path The path to be parsed
|
|
21
|
+
* @return The filename part of the path only
|
|
22
|
+
*/
|
|
23
|
+
export declare const getFileName: (path: string) => string;
|
|
24
|
+
/**
|
|
25
|
+
* Downloads a file containing the supplied content with the specified filename
|
|
26
|
+
* @param messageContents The contents of the file to be downloaded
|
|
27
|
+
* @param fileName Local filename for the file to be downloaded
|
|
28
|
+
*/
|
|
29
|
+
export declare const downloadFile: (messageContents: string | Uint8Array, fileName: string) => void;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
// Miscellaneous local file related utilities
|
|
2
|
+
// Sanitize filename before saving
|
|
3
|
+
export const toSafeFilename = (input) => {
|
|
4
|
+
// handle null-ish cases
|
|
5
|
+
if (!input) {
|
|
6
|
+
return "";
|
|
7
|
+
}
|
|
8
|
+
// Replace any non-alphanumeric characters with underscores
|
|
9
|
+
let safeFilename = input.replace(/[^a-zA-Z0-9]/gu, "_");
|
|
10
|
+
// Trim any leading or trailing underscores
|
|
11
|
+
safeFilename = safeFilename.replace(/^_+|_+$/gu, "");
|
|
12
|
+
return safeFilename;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Splits a given filename into its name and extension components.
|
|
16
|
+
* @param filename Filename as string like foo.csv or just "foo" with no extension
|
|
17
|
+
* @return An object with properties <code>name</code> containing the filename part and <code>ext</code> containing
|
|
18
|
+
* the extension, or <code>""</code> if none.
|
|
19
|
+
*/
|
|
20
|
+
export const splitFilename = (filename) => {
|
|
21
|
+
const indexOfDot = filename.lastIndexOf(".");
|
|
22
|
+
if (indexOfDot === -1) {
|
|
23
|
+
return { name: filename, ext: "" };
|
|
24
|
+
}
|
|
25
|
+
return { name: filename.slice(0, indexOfDot), ext: filename.slice(indexOfDot + 1) };
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Obtains the filename from a full path, returning only the last component of the path -- the file name
|
|
29
|
+
* with extensions.
|
|
30
|
+
* <br>
|
|
31
|
+
* Handles forward-slash and backslash-delimited paths.
|
|
32
|
+
* @example
|
|
33
|
+
* // returns baz.csv
|
|
34
|
+
* getFileName("/tmp/foo/bar/qux/baz.csv")
|
|
35
|
+
* @param path The path to be parsed
|
|
36
|
+
* @return The filename part of the path only
|
|
37
|
+
*/
|
|
38
|
+
export const getFileName = (path) =>
|
|
39
|
+
// conflicts with ESLint newline-per-chained-call rule
|
|
40
|
+
// prettier-ignore
|
|
41
|
+
path.split("\\")
|
|
42
|
+
.pop()
|
|
43
|
+
.split("/")
|
|
44
|
+
.pop();
|
|
45
|
+
/**
|
|
46
|
+
* Downloads a file containing the supplied content with the specified filename
|
|
47
|
+
* @param messageContents The contents of the file to be downloaded
|
|
48
|
+
* @param fileName Local filename for the file to be downloaded
|
|
49
|
+
*/
|
|
50
|
+
export const downloadFile = (messageContents, fileName) => {
|
|
51
|
+
const downloadLink = document.createElement("a");
|
|
52
|
+
const blob = new Blob([messageContents]);
|
|
53
|
+
// Apply the url and filename to the anchor tag
|
|
54
|
+
downloadLink.href = URL.createObjectURL(blob);
|
|
55
|
+
downloadLink.download = fileName;
|
|
56
|
+
// Add the anchor to the page, click it, then remove it
|
|
57
|
+
document.body.append(downloadLink);
|
|
58
|
+
downloadLink.click();
|
|
59
|
+
downloadLink.remove();
|
|
60
|
+
URL.revokeObjectURL(downloadLink.href);
|
|
61
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cognizant-ai-lab/ui-common",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "yarn clean && yarn generate && yarn run --top-level tsc --project tsconfig.build.json && fix-esm-import-path dist > /dev/null",
|
|
@@ -14,15 +14,13 @@
|
|
|
14
14
|
"@xyflow/react": "12.10.1",
|
|
15
15
|
"http-status": "1.7.3",
|
|
16
16
|
"jsonrepair": "3.8.0",
|
|
17
|
-
"lodash-es": "4.
|
|
18
|
-
"next": "16.1.6",
|
|
17
|
+
"lodash-es": "4.18.1",
|
|
19
18
|
"notistack": "3.0.2",
|
|
20
|
-
"react-dom": "19.2.4",
|
|
21
19
|
"react-markdown": "10.1.0",
|
|
22
20
|
"react-syntax-highlighter": "16.1.0",
|
|
23
21
|
"rehype-raw": "7.0.0",
|
|
24
22
|
"rehype-slug": "6.0.0",
|
|
25
|
-
"zustand": "4.
|
|
23
|
+
"zustand": "4.5.7"
|
|
26
24
|
},
|
|
27
25
|
"devDependencies": {
|
|
28
26
|
"@babel/core": "7.23.7",
|
|
@@ -35,19 +33,20 @@
|
|
|
35
33
|
"babel-jest": "30.2.0",
|
|
36
34
|
"fix-esm-import-path": "1.10.3",
|
|
37
35
|
"globals": "16.3.0",
|
|
38
|
-
"openapi-typescript": "7.8.0"
|
|
36
|
+
"openapi-typescript": "7.8.0",
|
|
37
|
+
"react": "19.2.4",
|
|
38
|
+
"react-dom": "19.2.4",
|
|
39
|
+
"typescript": "5.9.3"
|
|
39
40
|
},
|
|
40
41
|
"peerDependencies": {
|
|
41
|
-
"@emotion/react": "^11.13.3",
|
|
42
|
-
"@emotion/styled": "^11.13.0",
|
|
43
42
|
"@mui/icons-material": "^7.3.1",
|
|
44
43
|
"@mui/material": "^7.3.1",
|
|
45
|
-
"@mui/system": "^7.3.1",
|
|
46
44
|
"@mui/x-tree-view": "^8.22.0",
|
|
45
|
+
"next": "^16.2.1",
|
|
47
46
|
"next-auth": "5.0.0-beta.30",
|
|
48
47
|
"react": "^19.2.4",
|
|
49
48
|
"react-dom": "^19.2.4",
|
|
50
|
-
"typescript": "^5.9.
|
|
49
|
+
"typescript": "^5.9.3"
|
|
51
50
|
},
|
|
52
51
|
"repository": {
|
|
53
52
|
"type": "git",
|