@epam/ai-dial-conversation-stages 1.1.0-dev.298 → 1.1.0-dev.299
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/components/CollapsedGroup/CollapsedGroup.d.ts.map +1 -1
- package/components/StageIcon/StageIcon.d.ts.map +1 -1
- package/components/StageItem/StageItem.d.ts.map +1 -1
- package/components/StageMarkdownContent/StageCodeBlock.d.ts.map +1 -1
- package/components/StagesPanel/StagesPanel.d.ts.map +1 -1
- package/index.js +237 -227
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CollapsedGroup.d.ts","sourceRoot":"","sources":["../../../src/components/CollapsedGroup/CollapsedGroup.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CollapsedGroup.d.ts","sourceRoot":"","sources":["../../../src/components/CollapsedGroup/CollapsedGroup.tsx"],"names":[],"mappings":"AAiBA,OAAO,EAAE,EAAE,EAA+B,MAAM,OAAO,CAAC;AACxD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAUxE,gJAAgJ;AAChJ,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,mBAAmB,CA+OlD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StageIcon.d.ts","sourceRoot":"","sources":["../../../src/components/StageIcon/StageIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"StageIcon.d.ts","sourceRoot":"","sources":["../../../src/components/StageIcon/StageIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAOxD,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAG3B,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,4EAA4E;IAC5E,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;IAC3B,kEAAkE;IAClE,MAAM,EAAE,OAAO,CAAC;IAChB,mFAAmF;IACnF,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4GAA4G;IAC5G,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,8FAA8F;AAC9F,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAgCxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StageItem.d.ts","sourceRoot":"","sources":["../../../src/components/StageItem/StageItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"StageItem.d.ts","sourceRoot":"","sources":["../../../src/components/StageItem/StageItem.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,2BAA2B,CAAC;AAQvD,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EACV,iBAAiB,EACjB,eAAe,EAChB,MAAM,2BAA2B,CAAC;AAMnC,mCAAmC;AACnC,MAAM,WAAW,cAAc;IAC7B,gCAAgC;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,kEAAkE;IAClE,MAAM,EAAE,OAAO,CAAC;IAChB,+DAA+D;IAC/D,UAAU,CAAC,EAAE,eAAe,CAAC;IAC7B,4BAA4B;IAC5B,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,kHAAkH;IAClH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,6EAA6E;AAC7E,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CA+HxC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StageCodeBlock.d.ts","sourceRoot":"","sources":["../../../src/components/StageMarkdownContent/StageCodeBlock.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StageCodeBlock.d.ts","sourceRoot":"","sources":["../../../src/components/StageMarkdownContent/StageCodeBlock.tsx"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,EAAE,EACP,KAAK,SAAS,EAKf,MAAM,OAAO,CAAC;AAGf,UAAU,KAAK;IACb,6BAA6B;IAC7B,QAAQ,EAAE,SAAS,CAAC;IACpB,iEAAiE;IACjE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,qFAAqF;IACrF,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,4CAA4C;IAC5C,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,mEAAmE;AACnE,eAAO,MAAM,cAAc,EAAE,EAAE,CAAC,KAAK,CA4DpC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StagesPanel.d.ts","sourceRoot":"","sources":["../../../src/components/StagesPanel/StagesPanel.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"StagesPanel.d.ts","sourceRoot":"","sources":["../../../src/components/StagesPanel/StagesPanel.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAEV,gBAAgB,EAEjB,MAAM,2BAA2B,CAAC;AA8InC,+FAA+F;AAC/F,eAAO,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA+D5C,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
1
|
import { MarkdownRenderer as e, StageStatus as t, buildCssVars as n, copyToClipboard as r, mergeClasses as i } from "@epam/ai-dial-chat-shared";
|
|
2
|
-
import { DIAL_ICON_SIZE as a,
|
|
3
|
-
import { IconAlertCircle as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { Fragment as
|
|
2
|
+
import { DIAL_ICON_SIZE as a, DIAL_KIT_ICON_STROKE as o, ElementSize as s, EllipsisTooltip as c, GhostIconButton as l, LinkButton as u, Spinner as d } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconAlertCircle as f, IconCheck as p, IconChevronDown as m, IconChevronRight as h, IconCopy as g } from "@tabler/icons-react";
|
|
4
|
+
import { memo as _, useCallback as v, useEffect as y, useRef as b, useState as x } from "react";
|
|
5
|
+
import { Fragment as S, jsx as C, jsxs as w } from "react/jsx-runtime";
|
|
6
6
|
//#region src/utils/stage-name.ts
|
|
7
|
-
var
|
|
7
|
+
var T = /[([][^()[\]]*[)\]]/g, E = /(\d+(?:\.\d+)?)\s*s\b/, D = /:\s*$/, O = (e) => {
|
|
8
8
|
let t = e ?? "";
|
|
9
|
-
|
|
9
|
+
T.lastIndex = 0;
|
|
10
10
|
let n, r = null, i = -1, a = 0;
|
|
11
|
-
for (; n =
|
|
12
|
-
let e = n[0].slice(1, -1), t =
|
|
11
|
+
for (; n = T.exec(t);) {
|
|
12
|
+
let e = n[0].slice(1, -1), t = E.exec(e);
|
|
13
13
|
if (t) {
|
|
14
14
|
r = t, i = n.index, a = n[0].length;
|
|
15
15
|
break;
|
|
16
16
|
}
|
|
17
17
|
}
|
|
18
18
|
return {
|
|
19
|
-
name: (r && i >= 0 ? t.slice(0, i) + t.slice(i + a) : t).replace(
|
|
19
|
+
name: (r && i >= 0 ? t.slice(0, i) + t.slice(i + a) : t).replace(D, "").trim().replace(/ {2,}/g, " "),
|
|
20
20
|
durationLabel: r ? `${r[1]}s` : void 0
|
|
21
21
|
};
|
|
22
|
-
},
|
|
22
|
+
}, k = (e) => e.length > 0 && !/\s/.test(e) && e.includes("_"), A = (e) => e >= 60 ? `${Math.floor(e / 60)}m ${Math.round(e % 60)}s` : `${e.toFixed(1)}s`, j = (e) => {
|
|
23
23
|
if (!e) return;
|
|
24
24
|
let t = /^(\d+(?:\.\d+)?)s$/.exec(e);
|
|
25
25
|
return t ? parseFloat(t[1]) : void 0;
|
|
26
|
-
},
|
|
26
|
+
}, M = (e) => [...e].reverse().find((e) => e.status == null), N = (e, t) => e.findIndex((e) => e.index === t.index) + 1, P = (e) => {
|
|
27
27
|
let t = [], n = 0;
|
|
28
28
|
for (; n < e.length;) {
|
|
29
|
-
let r = e[n], i =
|
|
30
|
-
for (; a < e.length &&
|
|
29
|
+
let r = e[n], i = O(r.name).name, a = n + 1;
|
|
30
|
+
for (; a < e.length && O(e[a].name).name === i;) a += 1;
|
|
31
31
|
let o = e.slice(n, a);
|
|
32
32
|
o.length > 1 ? t.push({
|
|
33
33
|
key: r.index,
|
|
@@ -39,7 +39,7 @@ var w = /[([][^()[\]]*[)\]]/g, T = /(\d+(?:\.\d+)?)\s*s\b/, E = /:\s*$/, D = (e)
|
|
|
39
39
|
}), n = a;
|
|
40
40
|
}
|
|
41
41
|
return t;
|
|
42
|
-
},
|
|
42
|
+
}, F = {
|
|
43
43
|
panel: "_panel_vd48n_1",
|
|
44
44
|
row: "_row_vd48n_5",
|
|
45
45
|
collapseButton: "_collapseButton_vd48n_9",
|
|
@@ -57,47 +57,50 @@ var w = /[([][^()[\]]*[)\]]/g, T = /(\d+(?:\.\d+)?)\s*s\b/, E = /:\s*$/, D = (e)
|
|
|
57
57
|
codeInline: "_codeInline_vd48n_62",
|
|
58
58
|
blockquote: "_blockquote_vd48n_68",
|
|
59
59
|
tableCell: "_tableCell_vd48n_73"
|
|
60
|
-
},
|
|
60
|
+
}, I = ({ status: e, isLive: n, runningLabel: r = "Running", failedLabel: i = "Failed" }) => n ? /* @__PURE__ */ C(d, {
|
|
61
61
|
size: 16,
|
|
62
62
|
ariaLabel: r
|
|
63
|
-
}) : e === t.Failed ? /* @__PURE__ */
|
|
63
|
+
}) : e === t.Failed ? /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(f, {
|
|
64
64
|
size: a.MD,
|
|
65
|
-
className:
|
|
66
|
-
"aria-hidden": !0
|
|
67
|
-
|
|
65
|
+
className: F.iconError,
|
|
66
|
+
"aria-hidden": !0,
|
|
67
|
+
stroke: o
|
|
68
|
+
}), /* @__PURE__ */ C("span", {
|
|
68
69
|
className: "sr-only",
|
|
69
70
|
children: i
|
|
70
|
-
})] }) : /* @__PURE__ */
|
|
71
|
+
})] }) : /* @__PURE__ */ C(p, {
|
|
71
72
|
size: a.SM,
|
|
72
|
-
className:
|
|
73
|
-
"aria-hidden": !0
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
73
|
+
className: F.iconCompleted,
|
|
74
|
+
"aria-hidden": !0,
|
|
75
|
+
stroke: o
|
|
76
|
+
}), L = ({ children: e, codeClassName: t, blockClassName: n = "dial-code-text", copyAriaLabel: c }) => {
|
|
77
|
+
let [u, d] = x(!1), f = b(null);
|
|
78
|
+
y(() => () => {
|
|
79
|
+
f.current != null && clearTimeout(f.current);
|
|
78
80
|
}, []);
|
|
79
|
-
let
|
|
80
|
-
r(typeof e == "string" ? e : String(e ?? "")),
|
|
81
|
+
let m = v(() => {
|
|
82
|
+
r(typeof e == "string" ? e : String(e ?? "")), f.current && clearTimeout(f.current), d(!0), f.current = setTimeout(() => d(!1), 2e3);
|
|
81
83
|
}, [e]);
|
|
82
|
-
return /* @__PURE__ */
|
|
83
|
-
className: i("relative max-h-[300px] overflow-auto rounded border p-3", n,
|
|
84
|
-
children: [/* @__PURE__ */
|
|
85
|
-
size:
|
|
86
|
-
icon:
|
|
84
|
+
return /* @__PURE__ */ w("pre", {
|
|
85
|
+
className: i("relative max-h-[300px] overflow-auto rounded border p-3", n, F.codeBlock),
|
|
86
|
+
children: [/* @__PURE__ */ C(l, {
|
|
87
|
+
size: s.Small,
|
|
88
|
+
icon: C(u ? p : g, {
|
|
87
89
|
size: a.SM,
|
|
88
|
-
className:
|
|
90
|
+
className: F.iconSecondary,
|
|
91
|
+
stroke: o
|
|
89
92
|
}),
|
|
90
|
-
"aria-label":
|
|
91
|
-
onClick:
|
|
93
|
+
"aria-label": c,
|
|
94
|
+
onClick: m,
|
|
92
95
|
className: "absolute end-2 top-2"
|
|
93
|
-
}), /* @__PURE__ */
|
|
96
|
+
}), /* @__PURE__ */ C("code", {
|
|
94
97
|
className: t,
|
|
95
98
|
children: e
|
|
96
99
|
})]
|
|
97
100
|
});
|
|
98
|
-
},
|
|
99
|
-
let a = "mb-1.5 last:mb-0", o = i(n?.headingClassName ?? "dial-small-semi-text",
|
|
100
|
-
return /* @__PURE__ */
|
|
101
|
+
}, R = _(({ content: t, typography: n, copyAriaLabel: r = "Copy" }) => {
|
|
102
|
+
let a = "mb-1.5 last:mb-0", o = i(n?.headingClassName ?? "dial-small-semi-text", F.stageContent, a);
|
|
103
|
+
return /* @__PURE__ */ C(e, {
|
|
101
104
|
content: t,
|
|
102
105
|
classNames: {
|
|
103
106
|
h1: o,
|
|
@@ -106,154 +109,158 @@ var w = /[([][^()[\]]*[)\]]/g, T = /(\d+(?:\.\d+)?)\s*s\b/, E = /:\s*$/, D = (e)
|
|
|
106
109
|
h4: o,
|
|
107
110
|
h5: o,
|
|
108
111
|
h6: o,
|
|
109
|
-
p: i(n?.contentClassName ?? "dial-tiny-text",
|
|
110
|
-
ul: i(n?.contentClassName ?? "dial-tiny-text",
|
|
111
|
-
ol: i(n?.contentClassName ?? "dial-tiny-text",
|
|
112
|
-
strong: i(n?.strongClassName ?? n?.contentClassName ?? "dial-tiny-text",
|
|
113
|
-
codeInline:
|
|
114
|
-
blockquote: i(n?.contentClassName ?? "dial-tiny-text",
|
|
115
|
-
link: i(n?.contentClassName ?? "dial-tiny-text",
|
|
116
|
-
tableCell: i(n?.contentClassName ?? "dial-tiny-text",
|
|
112
|
+
p: i(n?.contentClassName ?? "dial-tiny-text", F.stageContent, "mb-1.5"),
|
|
113
|
+
ul: i(n?.contentClassName ?? "dial-tiny-text", F.stageContent, a),
|
|
114
|
+
ol: i(n?.contentClassName ?? "dial-tiny-text", F.stageContent, a),
|
|
115
|
+
strong: i(n?.strongClassName ?? n?.contentClassName ?? "dial-tiny-text", F.stageContent),
|
|
116
|
+
codeInline: F.codeInline,
|
|
117
|
+
blockquote: i(n?.contentClassName ?? "dial-tiny-text", F.blockquote, a),
|
|
118
|
+
link: i(n?.contentClassName ?? "dial-tiny-text", F.stageContent),
|
|
119
|
+
tableCell: i(n?.contentClassName ?? "dial-tiny-text", F.tableCell)
|
|
117
120
|
},
|
|
118
|
-
components: { code: ({ children: e, className: t }) => t?.includes("language-") ? /* @__PURE__ */
|
|
121
|
+
components: { code: ({ children: e, className: t }) => t?.includes("language-") ? /* @__PURE__ */ C(L, {
|
|
119
122
|
codeClassName: t,
|
|
120
123
|
blockClassName: n?.codeBlockClassName,
|
|
121
124
|
copyAriaLabel: r,
|
|
122
125
|
children: e
|
|
123
|
-
}) : /* @__PURE__ */
|
|
124
|
-
className: i("inline-block px-1.5 py-1", n?.codeClassName ?? "dial-code-text rounded-md",
|
|
126
|
+
}) : /* @__PURE__ */ C("code", {
|
|
127
|
+
className: i("inline-block px-1.5 py-1", n?.codeClassName ?? "dial-code-text rounded-md", F.codeInline),
|
|
125
128
|
children: e
|
|
126
129
|
}) }
|
|
127
130
|
});
|
|
128
|
-
}),
|
|
129
|
-
let [
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
+
}), z = ({ stage: e, isLive: n, typography: r, labels: s, nameOverride: l }) => {
|
|
132
|
+
let [u, d] = x(!1), { copyAriaLabel: f = "Copy stage content", runningAriaLabel: p, failedAriaLabel: g } = s ?? {}, { name: _, durationLabel: v } = O(e.name), y = l ?? _, b = !l && k(_), T = e.status === t.Failed, E = !!e.content, D = /* @__PURE__ */ w(S, { children: [
|
|
133
|
+
/* @__PURE__ */ C("span", {
|
|
131
134
|
className: "flex flex-none items-center",
|
|
132
|
-
children: /* @__PURE__ */
|
|
135
|
+
children: /* @__PURE__ */ C(I, {
|
|
133
136
|
status: e.status,
|
|
134
137
|
isLive: n,
|
|
135
|
-
runningLabel:
|
|
136
|
-
failedLabel:
|
|
138
|
+
runningLabel: p,
|
|
139
|
+
failedLabel: g
|
|
137
140
|
})
|
|
138
141
|
}),
|
|
139
|
-
/* @__PURE__ */
|
|
140
|
-
className: i("min-w-0 max-w-[22rem] truncate", r?.fontClassName ?? "dial-small-text",
|
|
141
|
-
children: /* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ C("span", {
|
|
143
|
+
className: i("min-w-0 max-w-[22rem] truncate", r?.fontClassName ?? "dial-small-text", F.stageName, T && F.stageNameFailed, b && F.monoName),
|
|
144
|
+
children: /* @__PURE__ */ C(c, { text: y || e.status || "" })
|
|
142
145
|
}),
|
|
143
|
-
e.tag && /* @__PURE__ */
|
|
144
|
-
className: i("flex-none", r?.tagClassName ?? "dial-tiny-lead-text",
|
|
146
|
+
e.tag && /* @__PURE__ */ C("span", {
|
|
147
|
+
className: i("flex-none", r?.tagClassName ?? "dial-tiny-lead-text", F.tag),
|
|
145
148
|
children: e.tag
|
|
146
149
|
}),
|
|
147
|
-
|
|
148
|
-
className: i("flex-none", r?.countFontClassName ?? "dial-tiny-text",
|
|
149
|
-
children:
|
|
150
|
+
v && /* @__PURE__ */ C("span", {
|
|
151
|
+
className: i("flex-none", r?.countFontClassName ?? "dial-tiny-text", F.duration),
|
|
152
|
+
children: v
|
|
150
153
|
}),
|
|
151
|
-
|
|
152
|
-
className: i("flex-none",
|
|
153
|
-
children:
|
|
154
|
+
E && /* @__PURE__ */ C("span", {
|
|
155
|
+
className: i("flex-none", F.iconSecondary),
|
|
156
|
+
children: u ? /* @__PURE__ */ C(m, {
|
|
154
157
|
size: a.SM,
|
|
155
|
-
"aria-hidden": !0
|
|
156
|
-
|
|
158
|
+
"aria-hidden": !0,
|
|
159
|
+
stroke: o
|
|
160
|
+
}) : /* @__PURE__ */ C(h, {
|
|
157
161
|
size: a.SM,
|
|
158
162
|
className: "rtl:scale-x-[-1]",
|
|
159
|
-
"aria-hidden": !0
|
|
163
|
+
"aria-hidden": !0,
|
|
164
|
+
stroke: o
|
|
160
165
|
})
|
|
161
166
|
})
|
|
162
|
-
] }),
|
|
163
|
-
return
|
|
164
|
-
className:
|
|
165
|
-
children: /* @__PURE__ */
|
|
167
|
+
] }), A = i("flex w-full items-center gap-2 px-2 py-1.5", F.row);
|
|
168
|
+
return E ? /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C("div", {
|
|
169
|
+
className: A,
|
|
170
|
+
children: /* @__PURE__ */ C("button", {
|
|
166
171
|
type: "button",
|
|
167
|
-
onClick: () =>
|
|
168
|
-
"aria-expanded":
|
|
172
|
+
onClick: () => d((e) => !e),
|
|
173
|
+
"aria-expanded": u,
|
|
169
174
|
className: "flex min-w-0 flex-1 cursor-pointer items-center gap-2 text-start",
|
|
170
|
-
children:
|
|
175
|
+
children: D
|
|
171
176
|
})
|
|
172
|
-
}), /* @__PURE__ */
|
|
173
|
-
className: i("grid overflow-hidden transition-[grid-template-rows] duration-[250ms] ease-in-out",
|
|
174
|
-
children: /* @__PURE__ */
|
|
177
|
+
}), /* @__PURE__ */ C("div", {
|
|
178
|
+
className: i("grid overflow-hidden transition-[grid-template-rows] duration-[250ms] ease-in-out", u ? "grid-rows-[1fr]" : "grid-rows-[0fr]"),
|
|
179
|
+
children: /* @__PURE__ */ C("div", {
|
|
175
180
|
className: "overflow-hidden",
|
|
176
|
-
children: /* @__PURE__ */
|
|
181
|
+
children: /* @__PURE__ */ C("div", {
|
|
177
182
|
className: "mt-2 flex flex-col gap-3 py-1 ps-8",
|
|
178
|
-
children: e.content && /* @__PURE__ */
|
|
183
|
+
children: e.content && /* @__PURE__ */ C("div", {
|
|
179
184
|
className: "max-h-[300px] overflow-y-auto",
|
|
180
|
-
children: /* @__PURE__ */
|
|
185
|
+
children: /* @__PURE__ */ C(R, {
|
|
181
186
|
content: e.content,
|
|
182
187
|
typography: r,
|
|
183
|
-
copyAriaLabel:
|
|
188
|
+
copyAriaLabel: f
|
|
184
189
|
})
|
|
185
190
|
})
|
|
186
191
|
})
|
|
187
192
|
})
|
|
188
|
-
})] }) : /* @__PURE__ */
|
|
189
|
-
className:
|
|
190
|
-
children:
|
|
193
|
+
})] }) : /* @__PURE__ */ C("div", {
|
|
194
|
+
className: A,
|
|
195
|
+
children: D
|
|
191
196
|
});
|
|
192
|
-
},
|
|
193
|
-
let { runningAriaLabel:
|
|
194
|
-
let { durationLabel: n } =
|
|
195
|
-
return e + (
|
|
196
|
-
}, 0),
|
|
197
|
-
return /* @__PURE__ */
|
|
197
|
+
}, B = ({ row: e, isLive: n, typography: r, labels: s }) => {
|
|
198
|
+
let { runningAriaLabel: l, failedAriaLabel: u, attemptLabel: d = (e) => `Attempt ${e}` } = s ?? {}, [f, p] = x(!1), g = e.attempts?.some((e) => e.status === t.Failed), _ = (e.attempts || []).reduce((e, t) => {
|
|
199
|
+
let { durationLabel: n } = O(t.name);
|
|
200
|
+
return e + (j(n) ?? 0);
|
|
201
|
+
}, 0), v = _ > 0 ? A(_) : void 0;
|
|
202
|
+
return /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ w("button", {
|
|
198
203
|
type: "button",
|
|
199
|
-
onClick: () =>
|
|
200
|
-
"aria-expanded":
|
|
201
|
-
className: i("flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-start",
|
|
204
|
+
onClick: () => p((e) => !e),
|
|
205
|
+
"aria-expanded": f,
|
|
206
|
+
className: i("flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-start", F.collapseButton, F.row),
|
|
202
207
|
children: [
|
|
203
|
-
/* @__PURE__ */
|
|
208
|
+
/* @__PURE__ */ C("span", {
|
|
204
209
|
className: "flex flex-none items-center",
|
|
205
|
-
children: /* @__PURE__ */
|
|
206
|
-
status:
|
|
210
|
+
children: /* @__PURE__ */ C(I, {
|
|
211
|
+
status: g ? t.Failed : t.Completed,
|
|
207
212
|
isLive: n,
|
|
208
|
-
runningLabel:
|
|
209
|
-
failedLabel:
|
|
213
|
+
runningLabel: l,
|
|
214
|
+
failedLabel: u
|
|
210
215
|
})
|
|
211
216
|
}),
|
|
212
|
-
/* @__PURE__ */ S("span", {
|
|
213
|
-
className: i("min-w-0 max-w-[22rem] truncate", r?.fontClassName ?? "dial-small-text", P.stageName, h && P.stageNameFailed),
|
|
214
|
-
children: /* @__PURE__ */ S(s, { text: e.name })
|
|
215
|
-
}),
|
|
216
217
|
/* @__PURE__ */ C("span", {
|
|
217
|
-
className: i("
|
|
218
|
+
className: i("min-w-0 max-w-[22rem] truncate", r?.fontClassName ?? "dial-small-text", F.stageName, g && F.stageNameFailed),
|
|
219
|
+
children: /* @__PURE__ */ C(c, { text: e.name })
|
|
220
|
+
}),
|
|
221
|
+
/* @__PURE__ */ w("span", {
|
|
222
|
+
className: i("flex-none", r?.countFontClassName ?? "dial-tiny-text", F.count),
|
|
218
223
|
children: ["×", e.attempts?.length ?? 0]
|
|
219
224
|
}),
|
|
220
|
-
|
|
221
|
-
className: i("flex-none", r?.countFontClassName ?? "dial-tiny-text",
|
|
222
|
-
children:
|
|
225
|
+
v && /* @__PURE__ */ C("span", {
|
|
226
|
+
className: i("flex-none", r?.countFontClassName ?? "dial-tiny-text", F.duration),
|
|
227
|
+
children: v
|
|
223
228
|
}),
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
className: i("flex-none",
|
|
226
|
-
children:
|
|
229
|
+
/* @__PURE__ */ C("span", {
|
|
230
|
+
className: i("flex-none", F.iconSecondary),
|
|
231
|
+
children: f ? /* @__PURE__ */ C(m, {
|
|
227
232
|
size: a.SM,
|
|
228
|
-
"aria-hidden": !0
|
|
229
|
-
|
|
233
|
+
"aria-hidden": !0,
|
|
234
|
+
stroke: o
|
|
235
|
+
}) : /* @__PURE__ */ C(h, {
|
|
230
236
|
size: a.SM,
|
|
231
237
|
className: "rtl:scale-x-[-1]",
|
|
232
|
-
"aria-hidden": !0
|
|
238
|
+
"aria-hidden": !0,
|
|
239
|
+
stroke: o
|
|
233
240
|
})
|
|
234
241
|
})
|
|
235
242
|
]
|
|
236
|
-
}), /* @__PURE__ */
|
|
237
|
-
className: i("grid overflow-hidden transition-[grid-template-rows] duration-[250ms] ease-in-out",
|
|
238
|
-
children: /* @__PURE__ */
|
|
243
|
+
}), /* @__PURE__ */ C("div", {
|
|
244
|
+
className: i("grid overflow-hidden transition-[grid-template-rows] duration-[250ms] ease-in-out", f ? "grid-rows-[1fr]" : "grid-rows-[0fr]"),
|
|
245
|
+
children: /* @__PURE__ */ C("div", {
|
|
239
246
|
className: "overflow-hidden",
|
|
240
|
-
children: /* @__PURE__ */
|
|
247
|
+
children: /* @__PURE__ */ C("ul", {
|
|
241
248
|
role: "list",
|
|
242
249
|
className: "mt-1 flex flex-col gap-0.5 ps-6",
|
|
243
|
-
children: e.attempts?.map((t, i) => /* @__PURE__ */
|
|
250
|
+
children: e.attempts?.map((t, i) => /* @__PURE__ */ C("li", {
|
|
244
251
|
role: "listitem",
|
|
245
|
-
children: /* @__PURE__ */
|
|
252
|
+
children: /* @__PURE__ */ C(z, {
|
|
246
253
|
stage: t,
|
|
247
|
-
nameOverride:
|
|
254
|
+
nameOverride: d(i + 1),
|
|
248
255
|
isLive: n && t.index === e.attempts?.[e.attempts.length - 1]?.index,
|
|
249
256
|
typography: r,
|
|
250
|
-
labels:
|
|
257
|
+
labels: s
|
|
251
258
|
})
|
|
252
259
|
}, t.index))
|
|
253
260
|
})
|
|
254
261
|
})
|
|
255
262
|
})] });
|
|
256
|
-
},
|
|
263
|
+
}, V = ({ stages: e, isStreaming: t, className: r, styles: a, labels: o }) => {
|
|
257
264
|
let { colors: s, typography: c } = a ?? {}, l = n({
|
|
258
265
|
"--cs-text": s?.text,
|
|
259
266
|
"--cs-row-hover": s?.rowHoverColor,
|
|
@@ -270,24 +277,24 @@ var w = /[([][^()[\]]*[)\]]/g, T = /(\d+(?:\.\d+)?)\s*s\b/, E = /:\s*$/, D = (e)
|
|
|
270
277
|
"--cs-code-border": s?.codeBorderColor,
|
|
271
278
|
"--cs-code-text": s?.codeTextColor,
|
|
272
279
|
"--cs-border": s?.borderColor
|
|
273
|
-
}), u = t ?
|
|
274
|
-
return /* @__PURE__ */
|
|
280
|
+
}), u = t ? M(e) : void 0, d = P(e);
|
|
281
|
+
return /* @__PURE__ */ C("div", {
|
|
275
282
|
style: l,
|
|
276
|
-
className: i("w-full",
|
|
277
|
-
children: /* @__PURE__ */
|
|
283
|
+
className: i("w-full", F.panel, r),
|
|
284
|
+
children: /* @__PURE__ */ C("ul", {
|
|
278
285
|
role: "list",
|
|
279
286
|
className: "flex w-full flex-col gap-0.5 ps-5",
|
|
280
|
-
children: d.map((e) => e.stage ? /* @__PURE__ */
|
|
287
|
+
children: d.map((e) => e.stage ? /* @__PURE__ */ C("li", {
|
|
281
288
|
role: "listitem",
|
|
282
|
-
children: /* @__PURE__ */
|
|
289
|
+
children: /* @__PURE__ */ C(z, {
|
|
283
290
|
stage: e.stage,
|
|
284
291
|
isLive: u?.index === e.stage.index,
|
|
285
292
|
typography: c,
|
|
286
293
|
labels: o
|
|
287
294
|
})
|
|
288
|
-
}, e.key) : /* @__PURE__ */
|
|
295
|
+
}, e.key) : /* @__PURE__ */ C("li", {
|
|
289
296
|
role: "listitem",
|
|
290
|
-
children: /* @__PURE__ */
|
|
297
|
+
children: /* @__PURE__ */ C(B, {
|
|
291
298
|
row: e,
|
|
292
299
|
isLive: u?.index === e.attempts?.[e.attempts.length - 1].index,
|
|
293
300
|
typography: c,
|
|
@@ -296,163 +303,166 @@ var w = /[([][^()[\]]*[)\]]/g, T = /(\d+(?:\.\d+)?)\s*s\b/, E = /:\s*$/, D = (e)
|
|
|
296
303
|
}, e.key))
|
|
297
304
|
})
|
|
298
305
|
});
|
|
299
|
-
},
|
|
306
|
+
}, H = {
|
|
300
307
|
toggleButton: "_toggleButton_1sa5v_1",
|
|
301
308
|
executedLabel: "_executedLabel_1sa5v_13",
|
|
302
309
|
stepsCount: "_stepsCount_1sa5v_17",
|
|
303
310
|
doneIcon: "_doneIcon_1sa5v_22",
|
|
304
311
|
failedText: "_failedText_1sa5v_26",
|
|
305
312
|
liveName: "_liveName_1sa5v_30"
|
|
306
|
-
},
|
|
307
|
-
let { executedLabel:
|
|
308
|
-
|
|
309
|
-
|
|
313
|
+
}, U = ({ stages: e, isStreaming: r, labels: s, className: l, styles: f }) => {
|
|
314
|
+
let { executedLabel: g = "Executed", stepsLabel: _ = () => "steps", failedCountLabel: v = (e) => `${e} failed`, runningStepLabel: S = (e, t) => `Step ${e} of ${t}`, runningAriaLabel: T = "Running", copyAriaLabel: E, failedAriaLabel: D, attemptLabel: k } = s ?? {}, [P, F] = x(r), I = b(r);
|
|
315
|
+
y(() => {
|
|
316
|
+
I.current && !r && F(!1), I.current = r;
|
|
310
317
|
}, [r]);
|
|
311
|
-
let { colors:
|
|
312
|
-
"--cs-cg-label":
|
|
313
|
-
"--cs-cg-label-hover":
|
|
314
|
-
"--cs-cg-steps-count":
|
|
315
|
-
"--cs-cg-done":
|
|
316
|
-
"--cs-cg-failed":
|
|
317
|
-
"--cs-text":
|
|
318
|
-
"--cs-row-hover":
|
|
319
|
-
"--cs-button-bg":
|
|
320
|
-
"--cs-stage-text":
|
|
321
|
-
"--cs-failed-text":
|
|
322
|
-
"--cs-tag-text":
|
|
323
|
-
"--cs-count-text":
|
|
324
|
-
"--cs-duration-text":
|
|
325
|
-
"--cs-icon-secondary":
|
|
326
|
-
"--cs-icon-completed":
|
|
327
|
-
"--cs-icon-error":
|
|
328
|
-
"--cs-code-bg":
|
|
329
|
-
"--cs-code-border":
|
|
330
|
-
"--cs-code-text":
|
|
331
|
-
"--cs-border":
|
|
318
|
+
let { colors: L, panel: R } = f ?? {}, z = f?.typography ?? { fontClassName: "dial-small-text" }, B = n({
|
|
319
|
+
"--cs-cg-label": L?.labelColor,
|
|
320
|
+
"--cs-cg-label-hover": L?.labelHoverColor,
|
|
321
|
+
"--cs-cg-steps-count": L?.stepsCountColor,
|
|
322
|
+
"--cs-cg-done": L?.doneColor,
|
|
323
|
+
"--cs-cg-failed": L?.failedColor,
|
|
324
|
+
"--cs-text": R?.text,
|
|
325
|
+
"--cs-row-hover": R?.rowHoverColor,
|
|
326
|
+
"--cs-button-bg": R?.collapsedButtonBg,
|
|
327
|
+
"--cs-stage-text": R?.stageTextColor,
|
|
328
|
+
"--cs-failed-text": R?.failedColor,
|
|
329
|
+
"--cs-tag-text": R?.tagTextColor,
|
|
330
|
+
"--cs-count-text": R?.countTextColor,
|
|
331
|
+
"--cs-duration-text": R?.durationTextColor,
|
|
332
|
+
"--cs-icon-secondary": R?.iconSecondaryColor,
|
|
333
|
+
"--cs-icon-completed": R?.iconCompletedColor,
|
|
334
|
+
"--cs-icon-error": R?.iconErrorColor,
|
|
335
|
+
"--cs-code-bg": R?.codeBg,
|
|
336
|
+
"--cs-code-border": R?.codeBorderColor,
|
|
337
|
+
"--cs-code-text": R?.codeTextColor,
|
|
338
|
+
"--cs-border": R?.borderColor
|
|
332
339
|
});
|
|
333
340
|
if (e.length === 0) return null;
|
|
334
|
-
let
|
|
335
|
-
copyAriaLabel:
|
|
336
|
-
runningAriaLabel:
|
|
337
|
-
failedAriaLabel:
|
|
338
|
-
attemptLabel:
|
|
341
|
+
let U = {
|
|
342
|
+
copyAriaLabel: E,
|
|
343
|
+
runningAriaLabel: T,
|
|
344
|
+
failedAriaLabel: D,
|
|
345
|
+
attemptLabel: k
|
|
339
346
|
};
|
|
340
|
-
if (e.length === 1) return /* @__PURE__ */
|
|
347
|
+
if (e.length === 1) return /* @__PURE__ */ C(V, {
|
|
341
348
|
stages: e,
|
|
342
349
|
isStreaming: r,
|
|
343
|
-
className:
|
|
350
|
+
className: l,
|
|
344
351
|
styles: {
|
|
345
|
-
colors:
|
|
346
|
-
typography:
|
|
352
|
+
colors: R,
|
|
353
|
+
typography: f?.typography
|
|
347
354
|
},
|
|
348
|
-
labels:
|
|
355
|
+
labels: U
|
|
349
356
|
});
|
|
350
|
-
let
|
|
351
|
-
let { durationLabel: n } =
|
|
352
|
-
return e + (
|
|
353
|
-
}, 0),
|
|
357
|
+
let W = e.some((e) => e.status === t.Failed), G = e.reduce((e, t) => {
|
|
358
|
+
let { durationLabel: n } = O(t.name);
|
|
359
|
+
return e + (j(n) ?? 0);
|
|
360
|
+
}, 0), K = G > 0 ? A(G) : void 0, q = r ? M(e) : void 0, J;
|
|
354
361
|
if (r) {
|
|
355
|
-
let t =
|
|
356
|
-
|
|
362
|
+
let t = q ? N(e, q) : e.length, n = q ? O(q.name).name : "";
|
|
363
|
+
J = /* @__PURE__ */ w("span", {
|
|
357
364
|
role: "status",
|
|
358
365
|
"aria-live": "polite",
|
|
359
366
|
className: "flex min-w-0 items-center gap-2",
|
|
360
367
|
children: [
|
|
361
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ C("span", {
|
|
362
369
|
className: "flex flex-none items-center",
|
|
363
|
-
children: /* @__PURE__ */
|
|
370
|
+
children: /* @__PURE__ */ C(d, {
|
|
364
371
|
size: 14,
|
|
365
|
-
ariaLabel:
|
|
372
|
+
ariaLabel: T
|
|
366
373
|
})
|
|
367
374
|
}),
|
|
368
|
-
/* @__PURE__ */
|
|
369
|
-
className: i("flex-none whitespace-nowrap",
|
|
370
|
-
children:
|
|
375
|
+
/* @__PURE__ */ C("span", {
|
|
376
|
+
className: i("flex-none whitespace-nowrap", z.fontClassName, H.liveName),
|
|
377
|
+
children: S(t, e.length)
|
|
371
378
|
}),
|
|
372
|
-
n && /* @__PURE__ */
|
|
373
|
-
className: i("min-w-0 max-w-[22rem] truncate",
|
|
374
|
-
children: /* @__PURE__ */
|
|
379
|
+
n && /* @__PURE__ */ C("span", {
|
|
380
|
+
className: i("min-w-0 max-w-[22rem] truncate", z.fontClassName, H.executedLabel),
|
|
381
|
+
children: /* @__PURE__ */ C(c, { text: n })
|
|
375
382
|
})
|
|
376
383
|
]
|
|
377
384
|
});
|
|
378
|
-
} else if (
|
|
385
|
+
} else if (W) {
|
|
379
386
|
let n = e.filter((e) => e.status === t.Failed).length;
|
|
380
|
-
|
|
387
|
+
J = /* @__PURE__ */ w("span", {
|
|
381
388
|
className: "inline-flex items-center gap-1",
|
|
382
389
|
children: [
|
|
383
|
-
/* @__PURE__ */
|
|
384
|
-
className: i(
|
|
390
|
+
/* @__PURE__ */ w("span", {
|
|
391
|
+
className: i(z.fontClassName, H.executedLabel),
|
|
385
392
|
children: [
|
|
386
|
-
|
|
393
|
+
g,
|
|
387
394
|
" ",
|
|
388
395
|
e.length,
|
|
389
396
|
" ",
|
|
390
|
-
|
|
397
|
+
_(e.length)
|
|
391
398
|
]
|
|
392
399
|
}),
|
|
393
|
-
/* @__PURE__ */
|
|
394
|
-
className: i(
|
|
395
|
-
children:
|
|
400
|
+
/* @__PURE__ */ C("span", {
|
|
401
|
+
className: i(z.fontClassName, H.failedText),
|
|
402
|
+
children: v(n)
|
|
396
403
|
}),
|
|
397
|
-
|
|
398
|
-
className: i(
|
|
399
|
-
children:
|
|
404
|
+
K && /* @__PURE__ */ C("span", {
|
|
405
|
+
className: i(z.fontClassName, H.stepsCount),
|
|
406
|
+
children: K
|
|
400
407
|
})
|
|
401
408
|
]
|
|
402
409
|
});
|
|
403
|
-
} else
|
|
410
|
+
} else J = /* @__PURE__ */ w("span", {
|
|
404
411
|
className: "inline-flex items-center gap-1",
|
|
405
412
|
children: [
|
|
406
|
-
/* @__PURE__ */
|
|
413
|
+
/* @__PURE__ */ C(p, {
|
|
407
414
|
size: a.SM,
|
|
408
|
-
className:
|
|
409
|
-
"aria-hidden": !0
|
|
415
|
+
className: H.doneIcon,
|
|
416
|
+
"aria-hidden": !0,
|
|
417
|
+
stroke: o
|
|
410
418
|
}),
|
|
411
|
-
/* @__PURE__ */
|
|
412
|
-
className: i(
|
|
419
|
+
/* @__PURE__ */ w("span", {
|
|
420
|
+
className: i(z.fontClassName, H.executedLabel),
|
|
413
421
|
children: [
|
|
414
|
-
|
|
422
|
+
g,
|
|
415
423
|
" ",
|
|
416
424
|
e.length,
|
|
417
425
|
" ",
|
|
418
|
-
|
|
426
|
+
_(e.length)
|
|
419
427
|
]
|
|
420
428
|
}),
|
|
421
|
-
|
|
422
|
-
className: i(
|
|
423
|
-
children:
|
|
429
|
+
K && /* @__PURE__ */ C("span", {
|
|
430
|
+
className: i(z.fontClassName, H.stepsCount),
|
|
431
|
+
children: K
|
|
424
432
|
})
|
|
425
433
|
]
|
|
426
434
|
});
|
|
427
|
-
return /* @__PURE__ */
|
|
428
|
-
style:
|
|
429
|
-
className: i("flex w-full flex-col gap-1",
|
|
430
|
-
children: [/* @__PURE__ */
|
|
431
|
-
className:
|
|
435
|
+
return /* @__PURE__ */ w("div", {
|
|
436
|
+
style: B,
|
|
437
|
+
className: i("flex w-full flex-col gap-1", l),
|
|
438
|
+
children: [/* @__PURE__ */ C(u, {
|
|
439
|
+
className: H.toggleButton,
|
|
432
440
|
textClassName: "min-w-0",
|
|
433
|
-
onClick: () =>
|
|
434
|
-
"aria-expanded":
|
|
435
|
-
iconAfter:
|
|
441
|
+
onClick: () => F((e) => !e),
|
|
442
|
+
"aria-expanded": P,
|
|
443
|
+
iconAfter: P ? /* @__PURE__ */ C(m, {
|
|
436
444
|
size: 12,
|
|
437
|
-
"aria-hidden": !0
|
|
438
|
-
|
|
445
|
+
"aria-hidden": !0,
|
|
446
|
+
stroke: o
|
|
447
|
+
}) : /* @__PURE__ */ C(h, {
|
|
439
448
|
size: 12,
|
|
440
449
|
className: "rtl:scale-x-[-1]",
|
|
441
|
-
"aria-hidden": !0
|
|
450
|
+
"aria-hidden": !0,
|
|
451
|
+
stroke: o
|
|
442
452
|
}),
|
|
443
|
-
label:
|
|
444
|
-
}), /* @__PURE__ */
|
|
445
|
-
className: i("grid transition-[grid-template-rows] duration-300 ease-in-out",
|
|
446
|
-
children: /* @__PURE__ */
|
|
453
|
+
label: J
|
|
454
|
+
}), /* @__PURE__ */ C("div", {
|
|
455
|
+
className: i("grid transition-[grid-template-rows] duration-300 ease-in-out", P ? "grid-rows-[1fr]" : "grid-rows-[0fr]"),
|
|
456
|
+
children: /* @__PURE__ */ C("div", {
|
|
447
457
|
className: "overflow-hidden",
|
|
448
|
-
children: /* @__PURE__ */
|
|
458
|
+
children: /* @__PURE__ */ C(V, {
|
|
449
459
|
stages: e,
|
|
450
460
|
isStreaming: r,
|
|
451
461
|
styles: {
|
|
452
|
-
colors:
|
|
453
|
-
typography:
|
|
462
|
+
colors: R,
|
|
463
|
+
typography: f?.typography
|
|
454
464
|
},
|
|
455
|
-
labels:
|
|
465
|
+
labels: U,
|
|
456
466
|
className: "pt-1"
|
|
457
467
|
})
|
|
458
468
|
})
|
|
@@ -460,4 +470,4 @@ var w = /[([][^()[\]]*[)\]]/g, T = /(\d+(?:\.\d+)?)\s*s\b/, E = /:\s*$/, D = (e)
|
|
|
460
470
|
});
|
|
461
471
|
};
|
|
462
472
|
//#endregion
|
|
463
|
-
export {
|
|
473
|
+
export { U as CollapsedGroup, V as StagesPanel };
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@epam/ai-dial-conversation-stages",
|
|
3
3
|
"description": "Panel for displaying agent processing stages during LLM response streaming",
|
|
4
|
-
"version": "1.1.0-dev.
|
|
4
|
+
"version": "1.1.0-dev.299",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"react": "^19.0.0",
|
|
21
21
|
"@tabler/icons-react": "^3.0.0",
|
|
22
|
-
"@epam/ai-dial-chat-shared": "1.1.0-dev.
|
|
23
|
-
"@epam/ai-dial-ui-kit": "^0.14.0-dev.
|
|
22
|
+
"@epam/ai-dial-chat-shared": "1.1.0-dev.299",
|
|
23
|
+
"@epam/ai-dial-ui-kit": "^0.14.0-dev.15"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|
|
26
26
|
"type": "git",
|