@uipath/ui-widgets-conversational-agent-chat 1.0.0-beta.1
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 +165 -0
- package/dist/ConversationalAgentChat.css +22 -0
- package/dist/ConversationalAgentChat.d.ts +4 -0
- package/dist/ConversationalAgentChat.d.ts.map +1 -0
- package/dist/ConversationalAgentChat.js +426 -0
- package/dist/ConversationalAgentChat.js.map +1 -0
- package/dist/ConversationalAgentChat.stories.d.ts +80 -0
- package/dist/ConversationalAgentChat.stories.d.ts.map +1 -0
- package/dist/ConversationalAgentChat.stories.js +172 -0
- package/dist/ConversationalAgentChat.stories.js.map +1 -0
- package/dist/components/FeedbackDialog.d.ts +9 -0
- package/dist/components/FeedbackDialog.d.ts.map +1 -0
- package/dist/components/FeedbackDialog.js +16 -0
- package/dist/components/FeedbackDialog.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +29 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +21 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/telemetryUtils.d.ts +3 -0
- package/dist/utils/telemetryUtils.d.ts.map +1 -0
- package/dist/utils/telemetryUtils.js +10 -0
- package/dist/utils/telemetryUtils.js.map +1 -0
- package/dist/utils.d.ts +12 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +167 -0
- package/dist/utils.js.map +1 -0
- package/package.json +71 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import type { StoryObj } from "@storybook/react-vite";
|
|
2
|
+
import "./ConversationalAgentChat.scss";
|
|
3
|
+
import type { ConversationalAgentChatProps } from "./types";
|
|
4
|
+
interface ConversationalAgentChatStoryArgs extends Omit<ConversationalAgentChatProps, "sdk"> {
|
|
5
|
+
baseUrl: string;
|
|
6
|
+
orgName: string;
|
|
7
|
+
tenantName: string;
|
|
8
|
+
secret: string;
|
|
9
|
+
}
|
|
10
|
+
declare const meta: {
|
|
11
|
+
title: string;
|
|
12
|
+
component: ({ baseUrl, orgName, tenantName, secret, ...chatProps }: ConversationalAgentChatStoryArgs) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
decorators: ((Story: import("storybook/internal/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
|
|
14
|
+
baseUrl: string;
|
|
15
|
+
orgName: string;
|
|
16
|
+
tenantName: string;
|
|
17
|
+
secret: string;
|
|
18
|
+
agentId: number;
|
|
19
|
+
folderId: number;
|
|
20
|
+
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
21
|
+
parameters: {
|
|
22
|
+
layout: string;
|
|
23
|
+
docs: {
|
|
24
|
+
description: {
|
|
25
|
+
component: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
tags: string[];
|
|
30
|
+
argTypes: {
|
|
31
|
+
baseUrl: {
|
|
32
|
+
description: string;
|
|
33
|
+
control: "text";
|
|
34
|
+
table: {
|
|
35
|
+
category: string;
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
orgName: {
|
|
39
|
+
description: string;
|
|
40
|
+
control: "text";
|
|
41
|
+
table: {
|
|
42
|
+
category: string;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
tenantName: {
|
|
46
|
+
description: string;
|
|
47
|
+
control: "text";
|
|
48
|
+
table: {
|
|
49
|
+
category: string;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
secret: {
|
|
53
|
+
description: string;
|
|
54
|
+
control: "text";
|
|
55
|
+
table: {
|
|
56
|
+
category: string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
agentId: {
|
|
60
|
+
description: string;
|
|
61
|
+
control: "number";
|
|
62
|
+
};
|
|
63
|
+
folderId: {
|
|
64
|
+
description: string;
|
|
65
|
+
control: "number";
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
args: {
|
|
69
|
+
baseUrl: string;
|
|
70
|
+
orgName: string;
|
|
71
|
+
tenantName: string;
|
|
72
|
+
secret: string;
|
|
73
|
+
agentId: number;
|
|
74
|
+
folderId: number;
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
export default meta;
|
|
78
|
+
type Story = StoryObj<typeof meta>;
|
|
79
|
+
export declare const Default: Story;
|
|
80
|
+
//# sourceMappingURL=ConversationalAgentChat.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationalAgentChat.stories.d.ts","sourceRoot":"","sources":["../src/ConversationalAgentChat.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI5D,OAAO,gCAAgC,CAAC;AACxC,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC;AAE5D,UAAU,gCAAiC,SAAQ,IAAI,CACrD,4BAA4B,EAC5B,KAAK,CACN;IACC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AA8ED,QAAA,MAAM,IAAI;;wEAtEP,gCAAgC;;iBAZxB,MAAM;iBACN,MAAM;oBACH,MAAM;gBACV,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6LuC,CAAC;AAExD,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAEnC,eAAO,MAAM,OAAO,EAAE,KASrB,CAAC"}
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { UiPath } from "@uipath/uipath-typescript/core";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { ConversationalAgentChat } from "./ConversationalAgentChat";
|
|
5
|
+
import "./ConversationalAgentChat.scss";
|
|
6
|
+
const ConversationalAgentChatWithSdk = ({ baseUrl, orgName, tenantName, secret, ...chatProps }) => {
|
|
7
|
+
const [state, setState] = useState({ sdk: null, error: null });
|
|
8
|
+
useEffect(() => {
|
|
9
|
+
if (!baseUrl || !orgName || !tenantName || !secret) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
let cancelled = false;
|
|
13
|
+
const initSdk = async () => {
|
|
14
|
+
try {
|
|
15
|
+
const normalizedBaseUrl = baseUrl.match(/^https?:\/\//)
|
|
16
|
+
? baseUrl
|
|
17
|
+
: `https://${baseUrl}`;
|
|
18
|
+
const uipath = new UiPath({
|
|
19
|
+
baseUrl: normalizedBaseUrl,
|
|
20
|
+
orgName,
|
|
21
|
+
tenantName,
|
|
22
|
+
secret,
|
|
23
|
+
});
|
|
24
|
+
await uipath.initialize();
|
|
25
|
+
if (!cancelled) {
|
|
26
|
+
setState({ sdk: uipath, error: null });
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
if (!cancelled) {
|
|
31
|
+
setState({
|
|
32
|
+
sdk: null,
|
|
33
|
+
error: err instanceof Error ? err.message : "Failed to initialize SDK",
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
initSdk();
|
|
39
|
+
return () => {
|
|
40
|
+
cancelled = true;
|
|
41
|
+
};
|
|
42
|
+
}, [baseUrl, orgName, tenantName, secret]);
|
|
43
|
+
const { sdk, error } = state;
|
|
44
|
+
if (!baseUrl || !orgName || !tenantName || !secret) {
|
|
45
|
+
return (_jsx("div", { style: { padding: 24, color: "#666" }, children: "Please provide baseUrl, orgName, tenantName, and secret in the controls panel below." }));
|
|
46
|
+
}
|
|
47
|
+
if (error) {
|
|
48
|
+
return (_jsxs("div", { style: { padding: 24, color: "#d32f2f" }, children: ["SDK initialization failed: ", error] }));
|
|
49
|
+
}
|
|
50
|
+
if (!sdk) {
|
|
51
|
+
return _jsx("div", { style: { padding: 24 }, children: "Initializing SDK..." });
|
|
52
|
+
}
|
|
53
|
+
return _jsx(ConversationalAgentChat, { sdk: sdk, ...chatProps });
|
|
54
|
+
};
|
|
55
|
+
const meta = {
|
|
56
|
+
title: "Components/ConversationalAgentChat",
|
|
57
|
+
component: ConversationalAgentChatWithSdk,
|
|
58
|
+
decorators: [
|
|
59
|
+
(Story) => (_jsx("div", { style: { height: "600px" }, children: _jsx(Story, {}) })),
|
|
60
|
+
],
|
|
61
|
+
parameters: {
|
|
62
|
+
layout: "padded",
|
|
63
|
+
docs: {
|
|
64
|
+
description: {
|
|
65
|
+
component: `
|
|
66
|
+
A React chat widget for interacting with UiPath Conversational AI agents.
|
|
67
|
+
|
|
68
|
+
## Features
|
|
69
|
+
|
|
70
|
+
- Real-time streaming responses
|
|
71
|
+
- File attachment support with drag and drop
|
|
72
|
+
- Tool call visualization
|
|
73
|
+
- Conversation history management
|
|
74
|
+
- Start new conversations or continue existing ones
|
|
75
|
+
- Built on Apollo React chat components
|
|
76
|
+
|
|
77
|
+
## Installation
|
|
78
|
+
|
|
79
|
+
\`\`\`bash
|
|
80
|
+
npm install @uipath/ui-widgets-conversational-agent-chat
|
|
81
|
+
\`\`\`
|
|
82
|
+
|
|
83
|
+
## Usage
|
|
84
|
+
|
|
85
|
+
> **Note:** Add either \`light\` or \`dark\` class to your HTML \`<body>\` element to enable proper theming.
|
|
86
|
+
|
|
87
|
+
\`\`\`tsx
|
|
88
|
+
import { ConversationalAgentChat } from '@uipath/ui-widgets-conversational-agent-chat';
|
|
89
|
+
import "@uipath/ui-widgets-conversational-agent-chat/ConversationalAgentChat.css";
|
|
90
|
+
import { UiPath } from '@uipath/uipath-typescript/core';
|
|
91
|
+
|
|
92
|
+
function App() {
|
|
93
|
+
const sdk = new UiPath({
|
|
94
|
+
baseUrl: 'https://cloud.uipath.com',
|
|
95
|
+
orgName: 'your-org',
|
|
96
|
+
tenantName: 'your-tenant',
|
|
97
|
+
secret: 'your-secret'
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
await sdk.initialize();
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<ConversationalAgentChat
|
|
104
|
+
sdk={sdk}
|
|
105
|
+
agentId={123}
|
|
106
|
+
folderId={456}
|
|
107
|
+
/>
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
\`\`\`
|
|
111
|
+
|
|
112
|
+
## Requirements
|
|
113
|
+
|
|
114
|
+
- React 19.2.0+
|
|
115
|
+
- React DOM 19.2.0+
|
|
116
|
+
- @uipath/uipath-typescript
|
|
117
|
+
- @uipath/apollo-react
|
|
118
|
+
- @uipath/apollo-wind`,
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
tags: ["autodocs"],
|
|
123
|
+
argTypes: {
|
|
124
|
+
baseUrl: {
|
|
125
|
+
description: "UiPath API base URL",
|
|
126
|
+
control: "text",
|
|
127
|
+
table: { category: "SDK Configuration" },
|
|
128
|
+
},
|
|
129
|
+
orgName: {
|
|
130
|
+
description: "UiPath organization name",
|
|
131
|
+
control: "text",
|
|
132
|
+
table: { category: "SDK Configuration" },
|
|
133
|
+
},
|
|
134
|
+
tenantName: {
|
|
135
|
+
description: "UiPath tenant name",
|
|
136
|
+
control: "text",
|
|
137
|
+
table: { category: "SDK Configuration" },
|
|
138
|
+
},
|
|
139
|
+
secret: {
|
|
140
|
+
description: "UiPath API secret for authentication",
|
|
141
|
+
control: "text",
|
|
142
|
+
table: { category: "SDK Configuration" },
|
|
143
|
+
},
|
|
144
|
+
agentId: {
|
|
145
|
+
description: "ID of the conversational agent to use",
|
|
146
|
+
control: "number",
|
|
147
|
+
},
|
|
148
|
+
folderId: {
|
|
149
|
+
description: "ID of the folder containing the agent",
|
|
150
|
+
control: "number",
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
args: {
|
|
154
|
+
baseUrl: "cloud.uipath.com",
|
|
155
|
+
orgName: "",
|
|
156
|
+
tenantName: "",
|
|
157
|
+
secret: "",
|
|
158
|
+
agentId: 0,
|
|
159
|
+
folderId: 0,
|
|
160
|
+
},
|
|
161
|
+
};
|
|
162
|
+
export default meta;
|
|
163
|
+
export const Default = {
|
|
164
|
+
parameters: {
|
|
165
|
+
docs: {
|
|
166
|
+
description: {
|
|
167
|
+
story: "Default conversational agent chat. Fill in the SDK configuration, agent ID, and folder ID in the controls panel to start chatting.",
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
},
|
|
171
|
+
};
|
|
172
|
+
//# sourceMappingURL=ConversationalAgentChat.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConversationalAgentChat.stories.js","sourceRoot":"","sources":["../src/ConversationalAgentChat.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,OAAO,gCAAgC,CAAC;AAaxC,MAAM,8BAA8B,GAAG,CAAC,EACtC,OAAO,EACP,OAAO,EACP,UAAU,EACV,MAAM,EACN,GAAG,SAAS,EACqB,EAAE,EAAE;IACrC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAG/B,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAE/B,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,OAAO,IAAI,CAAC,OAAO,IAAI,CAAC,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC;YACnD,OAAO;QACT,CAAC;QAED,IAAI,SAAS,GAAG,KAAK,CAAC;QACtB,MAAM,OAAO,GAAG,KAAK,IAAI,EAAE;YACzB,IAAI,CAAC;gBACH,MAAM,iBAAiB,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QACD,OAAO,EAAE;YACP,WAAW,EAAE,uCAAuC;YACpD,OAAO,EAAE,QAAQ;SAClB;QACD,QAAQ,EAAE;YACR,WAAW,EAAE,uCAAuC;YACpD,OAAO,EAAE,QAAQ;SAClB;KACF;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,kBAAkB;QAC3B,OAAO,EAAE,EAAE;QACX,UAAU,EAAE,EAAE;QACd,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,CAAC;KACZ;CACoD,CAAC;AAExD,eAAe,IAAI,CAAC;AAGpB,MAAM,CAAC,MAAM,OAAO,GAAU;IAC5B,UAAU,EAAE;QACV,IAAI,EAAE;YACJ,WAAW,EAAE;gBACX,KAAK,EACH,oIAAoI;aACvI;SACF;KACF;CACF,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
interface FeedbackDialogProps {
|
|
2
|
+
open: boolean;
|
|
3
|
+
onOpenChange: (open: boolean) => void;
|
|
4
|
+
onSubmit: (comment: string) => void;
|
|
5
|
+
onCancel: () => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const FeedbackDialog: ({ open, onOpenChange, onSubmit, onCancel, }: FeedbackDialogProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=FeedbackDialog.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeedbackDialog.d.ts","sourceRoot":"","sources":["../../src/components/FeedbackDialog.tsx"],"names":[],"mappings":"AAWA,UAAU,mBAAmB;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,cAAc,GAAI,6CAK5B,mBAAmB,4CAiCrB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button, Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle, Textarea, } from "@uipath/apollo-wind";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
export const FeedbackDialog = ({ open, onOpenChange, onSubmit, onCancel, }) => {
|
|
5
|
+
const [comment, setComment] = useState("");
|
|
6
|
+
const handleSubmit = () => {
|
|
7
|
+
onSubmit(comment);
|
|
8
|
+
setComment("");
|
|
9
|
+
};
|
|
10
|
+
const handleCancel = () => {
|
|
11
|
+
setComment("");
|
|
12
|
+
onCancel();
|
|
13
|
+
};
|
|
14
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { children: [_jsx(DialogHeader, { children: _jsx(DialogTitle, { children: "Provide additional feedback (optional)" }) }), _jsx(Textarea, { value: comment, onChange: (e) => setComment(e.target.value), placeholder: "What would you like to share?" }), _jsxs(DialogFooter, { children: [_jsx(Button, { variant: "outline", onClick: handleCancel, children: "Cancel" }), _jsx(Button, { onClick: handleSubmit, children: "Submit" })] })] }) }));
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=FeedbackDialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FeedbackDialog.js","sourceRoot":"","sources":["../../src/components/FeedbackDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,MAAM,EACN,MAAM,EACN,aAAa,EACb,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,QAAQ,GACT,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AASjC,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAC7B,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,QAAQ,GACY,EAAE,EAAE;IACxB,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAE3C,MAAM,YAAY,GAAG,GAAG,EAAE;QACxB,QAAQ,CAAC,OAAO,CAAC,CAAC;QAClB,UAAU,CAAC,EAAE,CAAC,CAAC;IACjB,CAAC,CAAC;IAEF,MAAM,YAAY,GAAG,GAAG,EAAE;QACxB,UAAU,CAAC,EAAE,CAAC,CAAC;QACf,QAAQ,EAAE,CAAC;IACb,CAAC,CAAC;IAEF,OAAO,CACL,KAAC,MAAM,IAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,YAC5C,MAAC,aAAa,eACZ,KAAC,YAAY,cACX,KAAC,WAAW,yDAAqD,GACpD,EACf,KAAC,QAAQ,IACP,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC3C,WAAW,EAAC,+BAA+B,GAC3C,EACF,MAAC,YAAY,eACX,KAAC,MAAM,IAAC,OAAO,EAAC,SAAS,EAAC,OAAO,EAAE,YAAY,uBAEtC,EACT,KAAC,MAAM,IAAC,OAAO,EAAE,YAAY,uBAAiB,IACjC,IACD,GACT,CACV,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACpE,YAAY,EAAE,4BAA4B,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { UiPath } from "@uipath/uipath-typescript/core";
|
|
2
|
+
export interface ConversationalAgentChatProps {
|
|
3
|
+
sdk: UiPath;
|
|
4
|
+
agentId: number;
|
|
5
|
+
folderId: number;
|
|
6
|
+
}
|
|
7
|
+
export declare enum MessageWidget {
|
|
8
|
+
AI = "ai",
|
|
9
|
+
Human = "human",
|
|
10
|
+
ApolloAgentsToolCall = "apollo-agents-tool-call",
|
|
11
|
+
ToolConfirmation = "apollo-cas-tool-confirmation"
|
|
12
|
+
}
|
|
13
|
+
export interface AttachFileOutput {
|
|
14
|
+
uri: string;
|
|
15
|
+
name: string;
|
|
16
|
+
mimeType: string;
|
|
17
|
+
}
|
|
18
|
+
export declare enum TelemetryEvent {
|
|
19
|
+
NewChat = "CAC.NewChat",
|
|
20
|
+
SendMessage = "CAC.SendMessage",
|
|
21
|
+
OpenConversation = "CAC.OpenConversation",
|
|
22
|
+
FileAttached = "CAC.FileAttached",
|
|
23
|
+
Feedback = "CAC.Feedback"
|
|
24
|
+
}
|
|
25
|
+
export declare enum TelemetryStatus {
|
|
26
|
+
Success = "CAC.Success",
|
|
27
|
+
Error = "CAC.Error"
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,gCAAgC,CAAC;AAExD,MAAM,WAAW,4BAA4B;IAC3C,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,aAAa;IACvB,EAAE,OAAO;IACT,KAAK,UAAU;IACf,oBAAoB,4BAA4B;IAChD,gBAAgB,iCAAiC;CAClD;AAED,MAAM,WAAW,gBAAgB;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,oBAAY,cAAc;IACxB,OAAO,gBAAgB;IACvB,WAAW,oBAAoB;IAC/B,gBAAgB,yBAAyB;IACzC,YAAY,qBAAqB;IACjC,QAAQ,iBAAiB;CAC1B;AAED,oBAAY,eAAe;IACzB,OAAO,gBAAgB;IACvB,KAAK,cAAc;CACpB"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export var MessageWidget;
|
|
2
|
+
(function (MessageWidget) {
|
|
3
|
+
MessageWidget["AI"] = "ai";
|
|
4
|
+
MessageWidget["Human"] = "human";
|
|
5
|
+
MessageWidget["ApolloAgentsToolCall"] = "apollo-agents-tool-call";
|
|
6
|
+
MessageWidget["ToolConfirmation"] = "apollo-cas-tool-confirmation";
|
|
7
|
+
})(MessageWidget || (MessageWidget = {}));
|
|
8
|
+
export var TelemetryEvent;
|
|
9
|
+
(function (TelemetryEvent) {
|
|
10
|
+
TelemetryEvent["NewChat"] = "CAC.NewChat";
|
|
11
|
+
TelemetryEvent["SendMessage"] = "CAC.SendMessage";
|
|
12
|
+
TelemetryEvent["OpenConversation"] = "CAC.OpenConversation";
|
|
13
|
+
TelemetryEvent["FileAttached"] = "CAC.FileAttached";
|
|
14
|
+
TelemetryEvent["Feedback"] = "CAC.Feedback";
|
|
15
|
+
})(TelemetryEvent || (TelemetryEvent = {}));
|
|
16
|
+
export var TelemetryStatus;
|
|
17
|
+
(function (TelemetryStatus) {
|
|
18
|
+
TelemetryStatus["Success"] = "CAC.Success";
|
|
19
|
+
TelemetryStatus["Error"] = "CAC.Error";
|
|
20
|
+
})(TelemetryStatus || (TelemetryStatus = {}));
|
|
21
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAQA,MAAM,CAAN,IAAY,aAKX;AALD,WAAY,aAAa;IACvB,0BAAS,CAAA;IACT,gCAAe,CAAA;IACf,iEAAgD,CAAA;IAChD,kEAAiD,CAAA;AACnD,CAAC,EALW,aAAa,KAAb,aAAa,QAKxB;AAQD,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,yCAAuB,CAAA;IACvB,iDAA+B,CAAA;IAC/B,2DAAyC,CAAA;IACzC,mDAAiC,CAAA;IACjC,2CAAyB,CAAA;AAC3B,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB;AAED,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,sCAAmB,CAAA;AACrB,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetryUtils.d.ts","sourceRoot":"","sources":["../../src/utils/telemetryUtils.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAE3D,eAAO,MAAM,cAAc,GACzB,OAAO,cAAc,EACrB,QAAQ,eAAe,EACvB,aAAa,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SAOrC,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { telemetryClient } from "@uipath/uipath-typescript/core";
|
|
2
|
+
import { version } from "../../package.json";
|
|
3
|
+
export const trackTelemetry = (event, status, properties) => {
|
|
4
|
+
telemetryClient.track(event, status, {
|
|
5
|
+
ApplicationName: "Widget.ConversationalAgentChat",
|
|
6
|
+
WidgetVersion: version,
|
|
7
|
+
...properties,
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=telemetryUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"telemetryUtils.js","sourceRoot":"","sources":["../../src/utils/telemetryUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAC;AACjE,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAG7C,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,KAAqB,EACrB,MAAuB,EACvB,UAAoC,EACpC,EAAE;IACF,eAAe,CAAC,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE;QACnC,eAAe,EAAE,gCAAgC;QACjD,aAAa,EAAE,OAAO;QACtB,GAAG,UAAU;KACd,CAAC,CAAC;AACL,CAAC,CAAC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { AutopilotChatFileInfo, AutopilotChatMessage } from "@uipath/apollo-react/ap-chat";
|
|
2
|
+
import { ExchangeGetResponse, RawConversationGetResponse } from "@uipath/uipath-typescript/conversational-agent";
|
|
3
|
+
export declare const createFileKey: (attachment: AutopilotChatFileInfo) => string;
|
|
4
|
+
export declare const normalizeInput: (obj: any) => any;
|
|
5
|
+
export declare const convertAttachmentToFile: (attachment: AutopilotChatFileInfo) => File;
|
|
6
|
+
export declare const getConversationHistoryDisplayItems: (conversations: RawConversationGetResponse[]) => {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
timestamp: string;
|
|
10
|
+
}[];
|
|
11
|
+
export declare const mapExchangesToChatMessages: (exchanges: ExchangeGetResponse[]) => AutopilotChatMessage[];
|
|
12
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,oBAAoB,EAGrB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAGL,mBAAmB,EACnB,0BAA0B,EAC3B,MAAM,gDAAgD,CAAC;AAGxD,eAAO,MAAM,aAAa,GAAI,YAAY,qBAAqB,WAM9D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,KAAK,GAAG,KAAG,GAUzC,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAClC,YAAY,qBAAqB,KAChC,IAuBF,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAC7C,eAAe,0BAA0B,EAAE;;;;GAS5C,CAAC;AAiHF,eAAO,MAAM,0BAA0B,GACrC,WAAW,mBAAmB,EAAE,KAC/B,oBAAoB,EAiDpB,CAAC"}
|
package/dist/utils.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { AutopilotChatRole, } from "@uipath/apollo-react/ap-chat";
|
|
3
|
+
import { MessageWidget } from "./types";
|
|
4
|
+
export const createFileKey = (attachment) => {
|
|
5
|
+
const name = attachment.name;
|
|
6
|
+
const size = attachment.content.binary?.length || attachment.content.text?.length || 0;
|
|
7
|
+
const type = attachment.type;
|
|
8
|
+
return `${name}-${size}-${type}`;
|
|
9
|
+
};
|
|
10
|
+
export const normalizeInput = (obj) => {
|
|
11
|
+
if (!obj)
|
|
12
|
+
return obj;
|
|
13
|
+
if (obj instanceof Date)
|
|
14
|
+
return obj.toISOString();
|
|
15
|
+
if (typeof obj !== "object")
|
|
16
|
+
return obj;
|
|
17
|
+
if (Array.isArray(obj))
|
|
18
|
+
return obj.map(normalizeInput);
|
|
19
|
+
const normalized = {};
|
|
20
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
21
|
+
normalized[key] = normalizeInput(value);
|
|
22
|
+
}
|
|
23
|
+
return normalized;
|
|
24
|
+
};
|
|
25
|
+
export const convertAttachmentToFile = (attachment) => {
|
|
26
|
+
let blob;
|
|
27
|
+
if (attachment.content.binary) {
|
|
28
|
+
blob = new Uint8Array(attachment.content.binary);
|
|
29
|
+
}
|
|
30
|
+
else if (attachment.content.base64) {
|
|
31
|
+
// Remove data URL prefix (e.g., "data:image/jpeg;base64,")
|
|
32
|
+
const base64Data = attachment.content.base64.startsWith("data:")
|
|
33
|
+
? attachment.content.base64.split(",")[1]
|
|
34
|
+
: attachment.content.base64;
|
|
35
|
+
// Remove any whitespace
|
|
36
|
+
const cleanBase64 = base64Data.replace(/\s/g, "");
|
|
37
|
+
const binary = atob(cleanBase64);
|
|
38
|
+
const bytes = new Uint8Array(Array.from(binary, (char) => char.charCodeAt(0)));
|
|
39
|
+
blob = new Blob([bytes], { type: attachment.type });
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
throw new Error(`No content found for attachment: ${attachment.name}`);
|
|
43
|
+
}
|
|
44
|
+
return new File([blob], attachment.name, { type: attachment.type });
|
|
45
|
+
};
|
|
46
|
+
export const getConversationHistoryDisplayItems = (conversations) => {
|
|
47
|
+
return conversations.map((conversation) => {
|
|
48
|
+
return {
|
|
49
|
+
id: conversation.id,
|
|
50
|
+
name: conversation.label || `New chat`,
|
|
51
|
+
timestamp: new Date(conversation.lastActivityTime).toISOString(),
|
|
52
|
+
};
|
|
53
|
+
});
|
|
54
|
+
};
|
|
55
|
+
const isCompletedContentPart = (cp) => !("createdTime" in cp);
|
|
56
|
+
const isExternalValue = (data) => data && typeof data === "object" && "uri" in data;
|
|
57
|
+
const getContentPartData = (cp) => {
|
|
58
|
+
if (isCompletedContentPart(cp)) {
|
|
59
|
+
if (cp.externalValue)
|
|
60
|
+
throw new Error(`Expected inline value but got external. (ContentPartId: ${cp.contentPartId})`);
|
|
61
|
+
return cp.data;
|
|
62
|
+
}
|
|
63
|
+
if (isExternalValue(cp.data))
|
|
64
|
+
throw new Error(`Expected inline value but got external. (ContentPartId: ${cp.contentPartId})`);
|
|
65
|
+
return cp.data?.inline || "";
|
|
66
|
+
};
|
|
67
|
+
const mapCitationSource = (source) => ({
|
|
68
|
+
id: source.number,
|
|
69
|
+
title: source.title,
|
|
70
|
+
url: source.url || "",
|
|
71
|
+
download_url: source.downloadUrl || "",
|
|
72
|
+
page_number: source.pageNumber ? parseInt(source.pageNumber) : 0,
|
|
73
|
+
});
|
|
74
|
+
const mapTextContentPartToChatContentParts = (cp) => {
|
|
75
|
+
const data = getContentPartData(cp);
|
|
76
|
+
const citations = [...(cp.citations || [])].sort((a, b) => a.offset - b.offset);
|
|
77
|
+
if (!citations.length)
|
|
78
|
+
return [{ text: data }];
|
|
79
|
+
const parts = [];
|
|
80
|
+
let offset = 0;
|
|
81
|
+
for (const c of citations) {
|
|
82
|
+
if (c.offset > offset)
|
|
83
|
+
parts.push({ text: data.substring(offset, c.offset) });
|
|
84
|
+
parts.push({
|
|
85
|
+
text: data.substring(c.offset, c.offset + c.length),
|
|
86
|
+
citations: c.sources?.map(mapCitationSource),
|
|
87
|
+
});
|
|
88
|
+
offset = c.offset + c.length;
|
|
89
|
+
}
|
|
90
|
+
if (offset < data.length)
|
|
91
|
+
parts.push({ text: data.substring(offset) });
|
|
92
|
+
return parts;
|
|
93
|
+
};
|
|
94
|
+
const mapContentPartToChatContentParts = (cp) => cp.mimeType.startsWith("text/")
|
|
95
|
+
? mapTextContentPartToChatContentParts(cp)
|
|
96
|
+
: [];
|
|
97
|
+
const getByteCount = (cp) => {
|
|
98
|
+
if (isCompletedContentPart(cp))
|
|
99
|
+
return cp.externalValue?.byteCount ?? null;
|
|
100
|
+
return isExternalValue(cp.data) ? (cp.data.byteCount ?? 0) : null;
|
|
101
|
+
};
|
|
102
|
+
const mapContentPartsToChatAttachments = (contentParts) => {
|
|
103
|
+
const nonAttachmentContentParts = [];
|
|
104
|
+
const chatAttachments = [];
|
|
105
|
+
for (const cp of contentParts) {
|
|
106
|
+
const byteCount = getByteCount(cp);
|
|
107
|
+
if (byteCount === null) {
|
|
108
|
+
nonAttachmentContentParts.push(cp);
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
chatAttachments.push({
|
|
112
|
+
name: cp.name ?? `${cp.mimeType} file`,
|
|
113
|
+
type: cp.mimeType,
|
|
114
|
+
size: byteCount,
|
|
115
|
+
lastModified: 0,
|
|
116
|
+
content: { text: null, binary: null, base64: null },
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
return { nonAttachmentContentParts, chatAttachments };
|
|
120
|
+
};
|
|
121
|
+
const mapContentPartsToChatContentPartsAndAttachments = (contentParts) => {
|
|
122
|
+
const { chatAttachments, nonAttachmentContentParts } = mapContentPartsToChatAttachments(contentParts);
|
|
123
|
+
return {
|
|
124
|
+
chatAttachments,
|
|
125
|
+
chatContentParts: nonAttachmentContentParts.flatMap(mapContentPartToChatContentParts),
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
export const mapExchangesToChatMessages = (exchanges) => exchanges.flatMap((exchange) => exchange.messages.flatMap((message) => {
|
|
129
|
+
const { chatAttachments, chatContentParts } = mapContentPartsToChatContentPartsAndAttachments(message.contentParts || []);
|
|
130
|
+
const role = message.role === "user"
|
|
131
|
+
? AutopilotChatRole.User
|
|
132
|
+
: AutopilotChatRole.Assistant;
|
|
133
|
+
const mainMessage = {
|
|
134
|
+
id: message.messageId,
|
|
135
|
+
groupId: `${exchange.exchangeId}-${role}`,
|
|
136
|
+
content: "",
|
|
137
|
+
contentParts: chatContentParts,
|
|
138
|
+
attachments: chatAttachments,
|
|
139
|
+
created_at: message.createdTime,
|
|
140
|
+
role,
|
|
141
|
+
widget: message.role === "user" ? MessageWidget.Human : MessageWidget.AI,
|
|
142
|
+
...(exchange.feedbackRating && {
|
|
143
|
+
feedback: { isPositive: exchange.feedbackRating === "positive" },
|
|
144
|
+
}),
|
|
145
|
+
toCopy: chatContentParts.map((part) => part.text).join(""),
|
|
146
|
+
meta: { exchangeId: exchange.exchangeId },
|
|
147
|
+
};
|
|
148
|
+
const toolCallMessages = (message.toolCalls || []).map((toolCall) => ({
|
|
149
|
+
id: toolCall.toolCallId,
|
|
150
|
+
groupId: `${exchange.exchangeId}-${AutopilotChatRole.Assistant}`,
|
|
151
|
+
content: `Performing ${toolCall.name}`,
|
|
152
|
+
created_at: toolCall.createdTime,
|
|
153
|
+
role: AutopilotChatRole.Assistant,
|
|
154
|
+
widget: MessageWidget.ApolloAgentsToolCall,
|
|
155
|
+
meta: {
|
|
156
|
+
toolName: toolCall.name,
|
|
157
|
+
input: toolCall.input,
|
|
158
|
+
startTime: toolCall.createdTime,
|
|
159
|
+
output: toolCall.result?.output,
|
|
160
|
+
endTime: toolCall.result?.timestamp,
|
|
161
|
+
isError: toolCall.result?.isError,
|
|
162
|
+
exchangeId: exchange.exchangeId,
|
|
163
|
+
},
|
|
164
|
+
}));
|
|
165
|
+
return [mainMessage, ...toolCallMessages];
|
|
166
|
+
}));
|
|
167
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,OAAO,EAGL,iBAAiB,GAElB,MAAM,8BAA8B,CAAC;AAOtC,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,UAAiC,EAAE,EAAE;IACjE,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAC7B,MAAM,IAAI,GACR,UAAU,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC,CAAC;IAC5E,MAAM,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC;IAC7B,OAAO,GAAG,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,GAAQ,EAAO,EAAE;IAC9C,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAC;IACrB,IAAI,GAAG,YAAY,IAAI;QAAE,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC;IAClD,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,GAAG,CAAC;IACxC,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;QAAE,OAAO,GAAG,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACvD,MAAM,UAAU,GAAQ,EAAE,CAAC;I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