@cognizant-ai-lab/ui-common 1.4.2 → 1.5.0-main.0068ed2.127
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/README.md +3 -3
- package/dist/Theme/Palettes.d.ts +0 -9
- package/dist/Theme/Palettes.js +0 -18
- package/dist/Theme/Theme.js +3 -3
- package/dist/components/AgentChat/{ChatCommon.d.ts → ChatCommon/ChatCommon.d.ts} +34 -10
- package/dist/components/AgentChat/ChatCommon/ChatCommon.js +723 -0
- package/dist/components/AgentChat/ChatCommon/ChatHistory.d.ts +18 -0
- package/dist/components/AgentChat/ChatCommon/ChatHistory.js +38 -0
- package/dist/components/AgentChat/ChatCommon/Const.d.ts +1 -0
- package/dist/components/AgentChat/ChatCommon/Const.js +2 -0
- package/dist/components/AgentChat/{ControlButtons.d.ts → ChatCommon/ControlButtons.d.ts} +5 -3
- package/dist/components/AgentChat/ChatCommon/ControlButtons.js +35 -0
- package/dist/components/AgentChat/ChatCommon/Conversation.d.ts +13 -0
- package/dist/components/AgentChat/ChatCommon/Conversation.js +80 -0
- package/dist/components/AgentChat/ChatCommon/ConversationTurn.d.ts +23 -0
- package/dist/components/AgentChat/ChatCommon/ConversationTurn.js +12 -0
- package/dist/components/AgentChat/{FormattedMarkdown.js → ChatCommon/FormattedMarkdown.js} +9 -4
- package/dist/components/AgentChat/ChatCommon/SampleQueries.d.ts +19 -0
- package/dist/components/AgentChat/ChatCommon/SampleQueries.js +32 -0
- package/dist/components/AgentChat/{SendButton.js → ChatCommon/SendButton.js} +8 -7
- package/dist/components/AgentChat/{SyntaxHighlighterThemes.js → ChatCommon/SyntaxHighlighterThemes.js} +1 -1
- package/dist/components/AgentChat/ChatCommon/Thinking.d.ts +13 -0
- package/dist/components/AgentChat/ChatCommon/Thinking.js +54 -0
- package/dist/components/AgentChat/Common/LlmChatButton.d.ts +4 -0
- package/dist/components/AgentChat/{LlmChatButton.js → Common/LlmChatButton.js} +4 -9
- package/dist/components/AgentChat/{Types.d.ts → Common/Types.d.ts} +6 -5
- package/dist/components/AgentChat/{Types.js → Common/Types.js} +5 -0
- package/dist/components/AgentChat/Common/Utils.d.ts +5 -0
- package/dist/components/AgentChat/{Utils.js → Common/Utils.js} +15 -21
- package/dist/components/AgentChat/VoiceChat/MicrophoneButton.js +13 -11
- package/dist/components/ChatBot/ChatBot.d.ts +0 -4
- package/dist/components/ChatBot/ChatBot.js +4 -4
- package/dist/components/Common/AccordionLite.d.ts +14 -0
- package/dist/components/Common/AccordionLite.js +25 -0
- package/dist/components/Common/Breadcrumbs.js +1 -1
- package/dist/components/Common/ConfirmationModal.d.ts +3 -1
- package/dist/components/Common/ConfirmationModal.js +1 -1
- package/dist/components/Common/Footer.js +4 -0
- package/dist/components/Common/MUIAlert.d.ts +1 -0
- package/dist/components/Common/MUIAlert.js +3 -4
- package/dist/components/Common/MUIDialog.d.ts +1 -0
- package/dist/components/Common/MUIDialog.js +2 -2
- package/dist/components/Common/Navbar.d.ts +2 -1
- package/dist/components/Common/Navbar.js +30 -24
- package/dist/components/Common/StatusLight.d.ts +9 -0
- package/dist/components/Common/StatusLight.js +21 -0
- package/dist/components/Common/notification.d.ts +5 -5
- package/dist/components/Common/notification.js +17 -12
- package/dist/components/ErrorPage/ErrorBoundary.js +1 -1
- package/dist/components/ErrorPage/ErrorPage.d.ts +3 -3
- package/dist/components/ErrorPage/ErrorPage.js +4 -3
- package/dist/components/Logo/Common.d.ts +4 -0
- package/dist/components/Logo/Common.js +8 -0
- package/dist/components/Logo/CustomerLogo.d.ts +23 -0
- package/dist/components/Logo/CustomerLogo.js +41 -0
- package/dist/components/MultiAgentAccelerator/AgentConversations.js +0 -1
- package/dist/components/MultiAgentAccelerator/AgentCounts.d.ts +2 -2
- package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.d.ts +53 -0
- package/dist/components/MultiAgentAccelerator/AgentFlow/AgentFlow.js +761 -0
- package/dist/components/MultiAgentAccelerator/{AgentNode.d.ts → AgentFlow/AgentNode.d.ts} +4 -1
- package/dist/components/MultiAgentAccelerator/{AgentNode.js → AgentFlow/AgentNode.js} +87 -48
- package/dist/components/MultiAgentAccelerator/AgentFlow/GraphLayouts.d.ts +43 -0
- package/dist/components/MultiAgentAccelerator/{GraphLayouts.js → AgentFlow/GraphLayouts.js} +41 -55
- package/dist/components/MultiAgentAccelerator/AgentFlow/GraphStructure.d.ts +21 -0
- package/dist/components/MultiAgentAccelerator/AgentFlow/GraphStructure.js +27 -0
- package/dist/components/MultiAgentAccelerator/AgentFlow/PlasmaEdge.d.ts +7 -0
- package/dist/components/MultiAgentAccelerator/{PlasmaEdge.js → AgentFlow/PlasmaEdge.js} +13 -8
- package/dist/components/MultiAgentAccelerator/AgentNetworkDesigner.d.ts +10 -0
- package/dist/components/MultiAgentAccelerator/AgentNetworkDesigner.js +20 -0
- package/dist/components/MultiAgentAccelerator/AgentNodePopup.d.ts +30 -0
- package/dist/components/MultiAgentAccelerator/AgentNodePopup.js +80 -0
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.d.ts +4 -9
- package/dist/components/MultiAgentAccelerator/MultiAgentAccelerator.js +467 -103
- package/dist/components/MultiAgentAccelerator/NeuroSanStudioCallout.d.ts +2 -0
- package/dist/components/MultiAgentAccelerator/NeuroSanStudioCallout.js +38 -0
- package/dist/components/MultiAgentAccelerator/Schema/SlyData.d.ts +17 -0
- package/dist/components/MultiAgentAccelerator/Schema/SlyData.js +23 -0
- package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.d.ts +3 -5
- package/dist/components/MultiAgentAccelerator/Sidebar/AgentNetworkTreeItem.js +66 -48
- package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.d.ts +4 -3
- package/dist/components/MultiAgentAccelerator/Sidebar/Sidebar.js +106 -174
- package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.d.ts +32 -13
- package/dist/components/MultiAgentAccelerator/Sidebar/TreeBuilder.js +179 -96
- package/dist/components/MultiAgentAccelerator/TemporaryNetworks.d.ts +39 -0
- package/dist/components/MultiAgentAccelerator/TemporaryNetworks.js +109 -1
- package/dist/components/MultiAgentAccelerator/{ThoughtBubbleEdge.d.ts → ThoughtBubbles/ThoughtBubbleEdge.d.ts} +1 -1
- package/dist/components/MultiAgentAccelerator/{ThoughtBubbleOverlay.js → ThoughtBubbles/ThoughtBubbleOverlay.js} +35 -21
- package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.d.ts +7 -0
- package/dist/components/MultiAgentAccelerator/Tour/MainTourSteps.js +96 -0
- package/dist/components/MultiAgentAccelerator/const.d.ts +28 -3
- package/dist/components/MultiAgentAccelerator/const.js +32 -6
- package/dist/components/Settings/ApiKeyInput.d.ts +16 -0
- package/dist/components/Settings/ApiKeyInput.js +69 -0
- package/dist/components/Settings/InfoTip.d.ts +8 -0
- package/dist/components/Settings/InfoTip.js +14 -0
- package/dist/components/Settings/SettingsDialog.js +396 -179
- package/dist/components/Settings/SettingsRow.d.ts +18 -0
- package/dist/components/Settings/SettingsRow.js +35 -0
- package/dist/const.d.ts +5 -1
- package/dist/const.js +5 -2
- package/dist/controller/agent/Agent.d.ts +19 -18
- package/dist/controller/agent/Agent.js +36 -50
- package/dist/controller/agent/IconSuggestions.d.ts +35 -0
- package/dist/controller/agent/IconSuggestions.js +85 -0
- package/dist/controller/llm/LlmChat.js +3 -3
- package/dist/controller/llm/Providers.d.ts +2 -0
- package/dist/controller/llm/Providers.js +41 -0
- package/dist/index.d.ts +9 -11
- package/dist/index.js +9 -11
- package/dist/state/Announcements.d.ts +24 -0
- package/dist/state/Announcements.js +29 -0
- package/dist/state/ChatHistory.d.ts +50 -0
- package/dist/state/ChatHistory.js +98 -0
- package/dist/state/IconSuggestions.d.ts +27 -0
- package/dist/state/IconSuggestions.js +50 -0
- package/dist/state/IndexedDBStorage.d.ts +14 -0
- package/dist/state/IndexedDBStorage.js +65 -0
- package/dist/state/Settings.d.ts +98 -5
- package/dist/state/Settings.js +111 -8
- package/dist/state/TemporaryNetworks.d.ts +13 -0
- package/dist/state/TemporaryNetworks.js +15 -0
- package/dist/state/Tour.d.ts +29 -0
- package/dist/state/Tour.js +22 -0
- package/dist/state/UserInfo.d.ts +2 -1
- 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.js +12 -3
- package/dist/utils/BrowserNavigation.js +2 -0
- package/dist/utils/File.d.ts +11 -1
- package/dist/utils/File.js +18 -12
- package/dist/utils/text.js +4 -8
- package/dist/utils/title.js +2 -2
- package/dist/utils/zIndexLayers.js +3 -0
- package/package.json +26 -13
- package/dist/components/AgentChat/ChatCommon.js +0 -617
- package/dist/components/AgentChat/ControlButtons.js +0 -26
- package/dist/components/AgentChat/Greetings.d.ts +0 -1
- package/dist/components/AgentChat/Greetings.js +0 -38
- package/dist/components/AgentChat/LlmChatButton.d.ts +0 -8
- package/dist/components/AgentChat/UserQueryDisplay.d.ts +0 -5
- package/dist/components/AgentChat/UserQueryDisplay.js +0 -31
- package/dist/components/AgentChat/Utils.d.ts +0 -12
- package/dist/components/Common/CustomerLogo.d.ts +0 -17
- package/dist/components/Common/CustomerLogo.js +0 -49
- package/dist/components/Common/LlmChatOptionsButton.d.ts +0 -6
- package/dist/components/Common/LlmChatOptionsButton.js +0 -31
- package/dist/components/Common/MUIAccordion.d.ts +0 -17
- package/dist/components/Common/MUIAccordion.js +0 -66
- package/dist/components/MultiAgentAccelerator/AgentFlow.d.ts +0 -23
- package/dist/components/MultiAgentAccelerator/AgentFlow.js +0 -315
- package/dist/components/MultiAgentAccelerator/GraphLayouts.d.ts +0 -36
- package/dist/components/MultiAgentAccelerator/PlasmaEdge.d.ts +0 -3
- package/dist/utils/useLocalStorage.d.ts +0 -1
- package/dist/utils/useLocalStorage.js +0 -55
- /package/dist/components/AgentChat/{FormattedMarkdown.d.ts → ChatCommon/FormattedMarkdown.d.ts} +0 -0
- /package/dist/components/AgentChat/{SendButton.d.ts → ChatCommon/SendButton.d.ts} +0 -0
- /package/dist/components/AgentChat/{SyntaxHighlighterThemes.d.ts → ChatCommon/SyntaxHighlighterThemes.d.ts} +0 -0
- /package/dist/components/MultiAgentAccelerator/{ThoughtBubbleEdge.js → ThoughtBubbles/ThoughtBubbleEdge.js} +0 -0
- /package/dist/components/MultiAgentAccelerator/{ThoughtBubbleOverlay.d.ts → ThoughtBubbles/ThoughtBubbleOverlay.d.ts} +0 -0
package/README.md
CHANGED
|
@@ -72,7 +72,7 @@ via the chat interface, and visualize the agent network flow.
|
|
|
72
72
|
Among the technologies and libraries used in this package are:
|
|
73
73
|
|
|
74
74
|
- ESLint and Prettier (for code quality)
|
|
75
|
-
-
|
|
75
|
+
- Vitest and React Testing Library (for testing)
|
|
76
76
|
- MUI
|
|
77
77
|
- next-auth (for authentication)
|
|
78
78
|
- React
|
|
@@ -160,9 +160,9 @@ async function checkServer() {
|
|
|
160
160
|
const result = await testConnection("https://api.example.com")
|
|
161
161
|
|
|
162
162
|
if (result.success) {
|
|
163
|
-
console.log(`Connected
|
|
163
|
+
console.log(`Connected!`)
|
|
164
164
|
} else {
|
|
165
|
-
console.error(`Connection failed: ${result.
|
|
165
|
+
console.error(`Connection failed: ${result.statusText}`)
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
168
|
```
|
package/dist/Theme/Palettes.d.ts
CHANGED
|
@@ -7,12 +7,3 @@ export declare const PALETTES: {
|
|
|
7
7
|
coldToHot: string[];
|
|
8
8
|
visionImpaired: string[];
|
|
9
9
|
};
|
|
10
|
-
export type PaletteKey = keyof typeof PALETTES | "brand";
|
|
11
|
-
/**
|
|
12
|
-
* Custom hook to get the current color palette based on user settings.
|
|
13
|
-
* If the user has selected custom branding, it will return the palette for that.
|
|
14
|
-
* Otherwise, it will return one of the predefined palettes from the PALETTES object based on the user's selection.
|
|
15
|
-
*
|
|
16
|
-
* @returns An array of color hex codes representing the current color palette.
|
|
17
|
-
*/
|
|
18
|
-
export declare const usePalette: () => string[];
|
package/dist/Theme/Palettes.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
// Palettes for progressive coloring of nodes based on depth or heatmap value
|
|
2
|
-
import { useSettingsStore } from "../state/Settings.js";
|
|
3
2
|
export const PALETTES = {
|
|
4
3
|
blue: [
|
|
5
4
|
"#f7fbff",
|
|
@@ -75,20 +74,3 @@ export const PALETTES = {
|
|
|
75
74
|
"#b6dbff",
|
|
76
75
|
],
|
|
77
76
|
};
|
|
78
|
-
/**
|
|
79
|
-
* Custom hook to get the current color palette based on user settings.
|
|
80
|
-
* If the user has selected custom branding, it will return the palette for that.
|
|
81
|
-
* Otherwise, it will return one of the predefined palettes from the PALETTES object based on the user's selection.
|
|
82
|
-
*
|
|
83
|
-
* @returns An array of color hex codes representing the current color palette.
|
|
84
|
-
*/
|
|
85
|
-
export const usePalette = () => {
|
|
86
|
-
const brandPalette = useSettingsStore((state) => state.settings.branding.rangePalette);
|
|
87
|
-
const paletteKey = useSettingsStore((state) => state.settings.appearance.rangePalette);
|
|
88
|
-
if (paletteKey === "brand" && brandPalette) {
|
|
89
|
-
return brandPalette;
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
return PALETTES[paletteKey];
|
|
93
|
-
}
|
|
94
|
-
};
|
package/dist/Theme/Theme.js
CHANGED
|
@@ -48,9 +48,9 @@ export const isLightColor = (color) => {
|
|
|
48
48
|
// Remove # if present
|
|
49
49
|
const colorWithoutHash = hexColor.replace("#", "");
|
|
50
50
|
// Convert to RGB
|
|
51
|
-
const r = parseInt(colorWithoutHash.
|
|
52
|
-
const g = parseInt(colorWithoutHash.
|
|
53
|
-
const b = parseInt(colorWithoutHash.
|
|
51
|
+
const r = parseInt(colorWithoutHash.slice(0, 2), 16);
|
|
52
|
+
const g = parseInt(colorWithoutHash.slice(2, 4), 16);
|
|
53
|
+
const b = parseInt(colorWithoutHash.slice(4, 6), 16);
|
|
54
54
|
// Calculate relative luminance (perceived brightness)
|
|
55
55
|
const luminance = (0.299 * r + 0.587 * g + 0.114 * b) / 255;
|
|
56
56
|
// Return true if light (threshold 0.5)
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Dispatch, Ref, SetStateAction } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { MessageRole } from "./ConversationTurn.js";
|
|
3
|
+
import { CombinedAgentType } from "../Common/Types.js";
|
|
3
4
|
export interface ChatCommonProps {
|
|
4
5
|
/**
|
|
5
6
|
* HTML id to use for the outer component
|
|
@@ -9,10 +10,6 @@ export interface ChatCommonProps {
|
|
|
9
10
|
* The current username of the logged-in user. Used for fetching things from APIs mainly
|
|
10
11
|
*/
|
|
11
12
|
readonly currentUser: string;
|
|
12
|
-
/**
|
|
13
|
-
* Path to image for user avatar
|
|
14
|
-
*/
|
|
15
|
-
readonly userImage: string;
|
|
16
13
|
/**
|
|
17
14
|
* Function to set the state of the component to indicate whether we are awaiting a response from the LLM
|
|
18
15
|
*/
|
|
@@ -22,9 +19,13 @@ export interface ChatCommonProps {
|
|
|
22
19
|
*/
|
|
23
20
|
readonly isAwaitingLlm: boolean;
|
|
24
21
|
/**
|
|
25
|
-
* The
|
|
22
|
+
* The network to send the request to.
|
|
23
|
+
*/
|
|
24
|
+
readonly selectedNetwork: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Setter for changing the selected network.
|
|
26
27
|
*/
|
|
27
|
-
readonly
|
|
28
|
+
readonly setSelectedNetwork?: (network: string | null) => void;
|
|
28
29
|
/**
|
|
29
30
|
* Special endpoint for legacy agents since they do not have a single unified endpoint like Neuro-san agents.
|
|
30
31
|
*/
|
|
@@ -57,10 +58,9 @@ export interface ChatCommonProps {
|
|
|
57
58
|
*/
|
|
58
59
|
readonly agentPlaceholders?: Partial<Record<CombinedAgentType, string>>;
|
|
59
60
|
/**
|
|
60
|
-
*
|
|
61
|
-
* Defaults to not clearing the chat.
|
|
61
|
+
* Optional greetings for specific agents to display
|
|
62
62
|
*/
|
|
63
|
-
readonly
|
|
63
|
+
readonly customAgentGreetings?: Partial<Record<CombinedAgentType, string>>;
|
|
64
64
|
/**
|
|
65
65
|
* Extra parameters to send to the server to be forwarded to the agent or used by the server.
|
|
66
66
|
* @note This is only used for legacy agents to aid in UI consolidation, only Neuro-san agents.
|
|
@@ -82,10 +82,34 @@ export interface ChatCommonProps {
|
|
|
82
82
|
* The neuro-san server URL
|
|
83
83
|
*/
|
|
84
84
|
readonly neuroSanURL?: string;
|
|
85
|
+
/**
|
|
86
|
+
* Extra sly_data entries to merge into each outgoing request. Used by parent components (e.g. temp networks)
|
|
87
|
+
* to re-supply data that lives outside the IndexedDB slyData store (e.g. localStorage).
|
|
88
|
+
*/
|
|
89
|
+
readonly extraSlyData?: Record<string, unknown>;
|
|
90
|
+
/**
|
|
91
|
+
* Optional description of the network to display in the UI.
|
|
92
|
+
*/
|
|
93
|
+
readonly networkDescription?: string;
|
|
94
|
+
/**
|
|
95
|
+
* Sample queries for the current network that the user can "click to send"
|
|
96
|
+
*/
|
|
97
|
+
readonly sampleQueries?: string[];
|
|
98
|
+
/**
|
|
99
|
+
* If true, indicates that the user is missing API keys for one or more LLM providers.
|
|
100
|
+
*/
|
|
101
|
+
readonly hasMissingApiKeys?: boolean;
|
|
85
102
|
}
|
|
86
103
|
export type ChatCommonHandle = {
|
|
87
104
|
handleStop: () => void;
|
|
105
|
+
handleClearChat: () => void;
|
|
88
106
|
};
|
|
107
|
+
/**
|
|
108
|
+
* Helper function to convert a message role to a label for exporting chat history.
|
|
109
|
+
* @param role The message role to convert
|
|
110
|
+
* @returns The label for the message role
|
|
111
|
+
*/
|
|
112
|
+
export declare const roleToExportLabel: (role: MessageRole) => string;
|
|
89
113
|
/**
|
|
90
114
|
* Common chat component for agent chat. This component is used by all agent chat components to provide a consistent
|
|
91
115
|
* experience for users when chatting with agents. It handles user input as well as displaying and nicely formatting
|