@epam/ai-dial-conversation-stages 1.0.0-dev.513 → 1.0.0-dev.515
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.
|
@@ -11,7 +11,7 @@ interface Props {
|
|
|
11
11
|
/** Accessible label for the copy button inside stage content. */
|
|
12
12
|
copyAriaLabel?: string;
|
|
13
13
|
}
|
|
14
|
-
/** A single stage row — plain when no content, collapsible when content
|
|
14
|
+
/** A single stage row — plain when no content, collapsible when content is present. */
|
|
15
15
|
export declare const StageItem: FC<Props>;
|
|
16
16
|
export {};
|
|
17
17
|
//# sourceMappingURL=StageItem.d.ts.map
|
|
@@ -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;AAIvD,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAKjE,UAAU,KAAK;IACb,gCAAgC;IAChC,KAAK,EAAE,KAAK,CAAC;IACb,kEAAkE;IAClE,MAAM,EAAE,OAAO,CAAC;IAChB,+DAA+D;IAC/D,UAAU,EAAE,eAAe,CAAC;IAC5B,iEAAiE;IACjE,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,uFAAuF;AACvF,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,KAAK,CAyE/B,CAAC"}
|
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { MarkdownRenderer as e, StageStatus as t, buildCssVars as n, copyToClipboard as r, mergeClasses as i
|
|
2
|
-
import { DIAL_ICON_SIZE as
|
|
3
|
-
import { IconAlertCircle as
|
|
4
|
-
import { memo as
|
|
5
|
-
import { Fragment as
|
|
6
|
-
var
|
|
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, DialEllipsisTooltip as o, DialGhostIconButton as s, DialLinkButton as c, DialSpinner as l, ElementSize as u } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { IconAlertCircle as d, IconCheck as f, IconChevronDown as p, IconChevronRight as m, IconCircleCheck 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
|
+
var T = {
|
|
7
7
|
panel: "_panel_1e8hb_1",
|
|
8
8
|
collapseButton: "_collapseButton_1e8hb_7",
|
|
9
9
|
stageName: "_stageName_1e8hb_11",
|
|
@@ -13,86 +13,86 @@ var E = {
|
|
|
13
13
|
codeInline: "_codeInline_1e8hb_29",
|
|
14
14
|
blockquote: "_blockquote_1e8hb_34",
|
|
15
15
|
tableCell: "_tableCell_1e8hb_39"
|
|
16
|
-
},
|
|
17
|
-
size:
|
|
18
|
-
className:
|
|
19
|
-
}) : /* @__PURE__ */
|
|
20
|
-
size:
|
|
21
|
-
className:
|
|
22
|
-
}) : n ? /* @__PURE__ */
|
|
23
|
-
size:
|
|
24
|
-
className:
|
|
25
|
-
}),
|
|
26
|
-
let [
|
|
27
|
-
|
|
16
|
+
}, E = ({ status: e, isLive: n }) => e ? e === t.Completed ? /* @__PURE__ */ C(h, {
|
|
17
|
+
size: a.MD,
|
|
18
|
+
className: T.iconSecondary
|
|
19
|
+
}) : /* @__PURE__ */ C(d, {
|
|
20
|
+
size: a.MD,
|
|
21
|
+
className: T.iconSecondary
|
|
22
|
+
}) : n ? /* @__PURE__ */ C(l, { size: 20 }) : /* @__PURE__ */ C(d, {
|
|
23
|
+
size: a.MD,
|
|
24
|
+
className: T.iconSecondary
|
|
25
|
+
}), D = ({ children: e, codeClassName: t, copyAriaLabel: n }) => {
|
|
26
|
+
let [o, c] = x(!1), l = b(null);
|
|
27
|
+
y(() => () => {
|
|
28
28
|
l.current != null && clearTimeout(l.current);
|
|
29
29
|
}, []);
|
|
30
|
-
let
|
|
31
|
-
r(typeof e == "string" ? e : String(e ?? "")), l.current && clearTimeout(l.current),
|
|
30
|
+
let d = v(() => {
|
|
31
|
+
r(typeof e == "string" ? e : String(e ?? "")), l.current && clearTimeout(l.current), c(!0), l.current = setTimeout(() => c(!1), 2e3);
|
|
32
32
|
}, [e]);
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
-
className: i("relative max-h-[300px] overflow-auto rounded border p-3 text-sm",
|
|
35
|
-
children: [/* @__PURE__ */
|
|
36
|
-
size:
|
|
37
|
-
icon:
|
|
38
|
-
size:
|
|
39
|
-
className:
|
|
33
|
+
return /* @__PURE__ */ w("pre", {
|
|
34
|
+
className: i("relative max-h-[300px] overflow-auto rounded border p-3 text-sm", T.codeBlock),
|
|
35
|
+
children: [/* @__PURE__ */ C(s, {
|
|
36
|
+
size: u.Small,
|
|
37
|
+
icon: C(o ? f : g, {
|
|
38
|
+
size: a.SM,
|
|
39
|
+
className: T.iconSecondary
|
|
40
40
|
}),
|
|
41
41
|
"aria-label": n,
|
|
42
|
-
onClick:
|
|
42
|
+
onClick: d,
|
|
43
43
|
className: "absolute end-2 top-2"
|
|
44
|
-
}), /* @__PURE__ */
|
|
44
|
+
}), /* @__PURE__ */ C("code", {
|
|
45
45
|
className: i("font-mono", t),
|
|
46
46
|
children: e
|
|
47
47
|
})]
|
|
48
48
|
});
|
|
49
|
-
},
|
|
49
|
+
}, O = _(({ content: t, typography: n, copyAriaLabel: r = "Copy" }) => /* @__PURE__ */ C(e, {
|
|
50
50
|
content: t,
|
|
51
51
|
classNames: {
|
|
52
|
-
p: i(n.fontClassName,
|
|
53
|
-
ul: i(n.fontClassName,
|
|
54
|
-
ol: i(n.fontClassName,
|
|
55
|
-
codeInline:
|
|
56
|
-
blockquote:
|
|
57
|
-
link:
|
|
58
|
-
tableCell:
|
|
52
|
+
p: i(n.fontClassName, T.stageContent),
|
|
53
|
+
ul: i(n.fontClassName, T.stageContent),
|
|
54
|
+
ol: i(n.fontClassName, T.stageContent),
|
|
55
|
+
codeInline: T.codeInline,
|
|
56
|
+
blockquote: T.blockquote,
|
|
57
|
+
link: T.stageContent,
|
|
58
|
+
tableCell: T.tableCell
|
|
59
59
|
},
|
|
60
|
-
components: { code: ({ children: e, className: t }) => t?.includes("language-") ? /* @__PURE__ */
|
|
60
|
+
components: { code: ({ children: e, className: t }) => t?.includes("language-") ? /* @__PURE__ */ C(D, {
|
|
61
61
|
codeClassName: t,
|
|
62
62
|
copyAriaLabel: r,
|
|
63
63
|
children: e
|
|
64
|
-
}) : /* @__PURE__ */
|
|
65
|
-
className: i("px-1 py-0.5", n.codeClassName ?? "rounded font-mono text-sm",
|
|
64
|
+
}) : /* @__PURE__ */ C("code", {
|
|
65
|
+
className: i("px-1 py-0.5", n.codeClassName ?? "rounded font-mono text-sm", T.codeInline),
|
|
66
66
|
children: e
|
|
67
67
|
}) }
|
|
68
|
-
})),
|
|
69
|
-
let [
|
|
68
|
+
})), k = ({ stage: e, isLive: t, typography: n, copyAriaLabel: r = "Copy stage content" }) => {
|
|
69
|
+
let [s, c] = x(!1), l = /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C(E, {
|
|
70
70
|
status: e.status,
|
|
71
71
|
isLive: t
|
|
72
|
-
}), /* @__PURE__ */
|
|
73
|
-
className: i("min-w-0 flex-1 truncate capitalize",
|
|
74
|
-
children: /* @__PURE__ */
|
|
75
|
-
})] })
|
|
76
|
-
return e.content
|
|
72
|
+
}), /* @__PURE__ */ C("span", {
|
|
73
|
+
className: i("min-w-0 flex-1 truncate capitalize", T.stageName),
|
|
74
|
+
children: /* @__PURE__ */ C(o, { text: e.name || e.status })
|
|
75
|
+
})] });
|
|
76
|
+
return e.content ? /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ w("button", {
|
|
77
77
|
type: "button",
|
|
78
|
-
onClick: () =>
|
|
79
|
-
className: i("flex w-full cursor-pointer items-center gap-2 p-0",
|
|
80
|
-
children: [
|
|
81
|
-
size:
|
|
82
|
-
className:
|
|
83
|
-
}) : /* @__PURE__ */
|
|
84
|
-
size:
|
|
85
|
-
className: i(
|
|
78
|
+
onClick: () => c((e) => !e),
|
|
79
|
+
className: i("flex w-full cursor-pointer items-center gap-2 p-0", T.collapseButton),
|
|
80
|
+
children: [l, s ? /* @__PURE__ */ C(p, {
|
|
81
|
+
size: a.MD,
|
|
82
|
+
className: T.iconSecondary
|
|
83
|
+
}) : /* @__PURE__ */ C(m, {
|
|
84
|
+
size: a.MD,
|
|
85
|
+
className: i(T.iconSecondary, "rtl:scale-x-[-1]")
|
|
86
86
|
})]
|
|
87
|
-
}), /* @__PURE__ */
|
|
88
|
-
className: i("grid overflow-hidden transition-[grid-template-rows] duration-[250ms] ease-in-out",
|
|
89
|
-
children: /* @__PURE__ */
|
|
87
|
+
}), /* @__PURE__ */ C("div", {
|
|
88
|
+
className: i("grid overflow-hidden transition-[grid-template-rows] duration-[250ms] ease-in-out", s ? "grid-rows-[1fr]" : "grid-rows-[0fr]"),
|
|
89
|
+
children: /* @__PURE__ */ C("div", {
|
|
90
90
|
className: "overflow-hidden",
|
|
91
|
-
children: /* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ C("div", {
|
|
92
92
|
className: "mt-3 flex flex-col gap-3 ps-7",
|
|
93
|
-
children: e.content && /* @__PURE__ */
|
|
93
|
+
children: e.content && /* @__PURE__ */ C("div", {
|
|
94
94
|
className: "max-h-[300px] overflow-y-auto",
|
|
95
|
-
children: /* @__PURE__ */
|
|
95
|
+
children: /* @__PURE__ */ C(O, {
|
|
96
96
|
content: e.content,
|
|
97
97
|
typography: n,
|
|
98
98
|
copyAriaLabel: r
|
|
@@ -100,11 +100,11 @@ var E = {
|
|
|
100
100
|
})
|
|
101
101
|
})
|
|
102
102
|
})
|
|
103
|
-
})] }) : /* @__PURE__ */
|
|
103
|
+
})] }) : /* @__PURE__ */ C("div", {
|
|
104
104
|
className: "flex items-center gap-2",
|
|
105
|
-
children:
|
|
105
|
+
children: l
|
|
106
106
|
});
|
|
107
|
-
},
|
|
107
|
+
}, A = ({ stages: e, isStreaming: t, className: r, styles: a, labels: o }) => {
|
|
108
108
|
let { colors: s, typography: c = { fontClassName: "dial-small-text" } } = a ?? {}, { copyAriaLabel: l } = o ?? {}, u = n({
|
|
109
109
|
"--cs-bg": s?.background,
|
|
110
110
|
"--cs-border": s?.border,
|
|
@@ -115,16 +115,16 @@ var E = {
|
|
|
115
115
|
"--cs-failed": s?.failedColor,
|
|
116
116
|
"--cs-button-bg": s?.buttonBackground
|
|
117
117
|
}), d = t ? e.reduce((e, t, n) => t.status ? e : n, -1) : -1;
|
|
118
|
-
return /* @__PURE__ */
|
|
118
|
+
return /* @__PURE__ */ C("div", {
|
|
119
119
|
style: u,
|
|
120
|
-
className: i("w-full",
|
|
121
|
-
children: /* @__PURE__ */
|
|
120
|
+
className: i("w-full", T.panel, r),
|
|
121
|
+
children: /* @__PURE__ */ C("ul", {
|
|
122
122
|
role: "list",
|
|
123
123
|
className: "flex w-full flex-col gap-4",
|
|
124
|
-
children: e.map((e, t) => /* @__PURE__ */
|
|
124
|
+
children: e.map((e, t) => /* @__PURE__ */ C("li", {
|
|
125
125
|
role: "listitem",
|
|
126
126
|
className: i("w-full", c.fontClassName),
|
|
127
|
-
children: /* @__PURE__ */
|
|
127
|
+
children: /* @__PURE__ */ C(k, {
|
|
128
128
|
stage: e,
|
|
129
129
|
isLive: d === t,
|
|
130
130
|
typography: c,
|
|
@@ -133,13 +133,13 @@ var E = {
|
|
|
133
133
|
}, e.index))
|
|
134
134
|
})
|
|
135
135
|
});
|
|
136
|
-
},
|
|
136
|
+
}, j = {
|
|
137
137
|
toggleButton: "_toggleButton_1rkek_1",
|
|
138
138
|
stepsCount: "_stepsCount_1rkek_8",
|
|
139
139
|
contentBox: "_contentBox_1rkek_12"
|
|
140
|
-
},
|
|
141
|
-
let { executedLabel: d = "Executed", stepsLabel:
|
|
142
|
-
if (r) return /* @__PURE__ */
|
|
140
|
+
}, M = ({ stages: e, isStreaming: r, labels: o, collapseThreshold: s = 7, className: l, styles: u }) => {
|
|
141
|
+
let { executedLabel: d = "Executed", stepsLabel: h = () => "steps" } = o ?? {}, [g, _] = x(!1);
|
|
142
|
+
if (r) return /* @__PURE__ */ C(A, {
|
|
143
143
|
stages: e,
|
|
144
144
|
isStreaming: !0
|
|
145
145
|
});
|
|
@@ -149,54 +149,54 @@ var E = {
|
|
|
149
149
|
"--cs-cg-steps-count": v?.stepsCountColor,
|
|
150
150
|
"--cs-cg-border": v?.contentBorderColor
|
|
151
151
|
});
|
|
152
|
-
if (e.length < s) return /* @__PURE__ */
|
|
152
|
+
if (e.length < s) return /* @__PURE__ */ C("div", {
|
|
153
153
|
style: b,
|
|
154
|
-
className: i("flex w-full flex-col gap-1",
|
|
155
|
-
children: /* @__PURE__ */
|
|
154
|
+
className: i("flex w-full flex-col gap-1", l),
|
|
155
|
+
children: /* @__PURE__ */ C(A, {
|
|
156
156
|
stages: e,
|
|
157
157
|
isStreaming: !1
|
|
158
158
|
})
|
|
159
159
|
});
|
|
160
|
-
let
|
|
161
|
-
return /* @__PURE__ */
|
|
160
|
+
let T = e.filter((e) => e.status === t.Completed), E = e.filter((e) => e.status !== t.Completed);
|
|
161
|
+
return /* @__PURE__ */ w("div", {
|
|
162
162
|
style: b,
|
|
163
|
-
className: i("flex w-full flex-col gap-1",
|
|
164
|
-
children: [
|
|
165
|
-
className:
|
|
163
|
+
className: i("flex w-full flex-col gap-1", l),
|
|
164
|
+
children: [T.length > 0 && /* @__PURE__ */ w("div", { children: [/* @__PURE__ */ C(c, {
|
|
165
|
+
className: j.toggleButton,
|
|
166
166
|
onClick: () => _((e) => !e),
|
|
167
|
-
iconBefore: /* @__PURE__ */
|
|
168
|
-
iconAfter: g ? /* @__PURE__ */
|
|
167
|
+
iconBefore: /* @__PURE__ */ C(f, { size: a.SM }),
|
|
168
|
+
iconAfter: g ? /* @__PURE__ */ C(p, { size: 12 }) : /* @__PURE__ */ C(m, {
|
|
169
169
|
size: 12,
|
|
170
170
|
className: "rtl:scale-x-[-1]"
|
|
171
171
|
}),
|
|
172
|
-
label: /* @__PURE__ */
|
|
172
|
+
label: /* @__PURE__ */ w(S, { children: [/* @__PURE__ */ C("span", {
|
|
173
173
|
className: i(y.fontClassName, "pe-1"),
|
|
174
174
|
children: d
|
|
175
|
-
}), /* @__PURE__ */
|
|
176
|
-
className: i(y.fontClassName,
|
|
175
|
+
}), /* @__PURE__ */ w("span", {
|
|
176
|
+
className: i(y.fontClassName, j.stepsCount),
|
|
177
177
|
children: [
|
|
178
|
-
|
|
178
|
+
T.length,
|
|
179
179
|
" ",
|
|
180
|
-
|
|
180
|
+
h(T.length)
|
|
181
181
|
]
|
|
182
182
|
})] })
|
|
183
|
-
}), /* @__PURE__ */
|
|
183
|
+
}), /* @__PURE__ */ C("div", {
|
|
184
184
|
className: i("grid pt-1 transition-[grid-template-rows] duration-300 ease-in-out", g ? "grid-rows-[1fr]" : "grid-rows-[0fr]"),
|
|
185
|
-
children: /* @__PURE__ */
|
|
185
|
+
children: /* @__PURE__ */ C("div", {
|
|
186
186
|
className: "overflow-hidden",
|
|
187
|
-
children: /* @__PURE__ */
|
|
188
|
-
className: i("rounded border px-2 py-3",
|
|
189
|
-
children: /* @__PURE__ */
|
|
190
|
-
stages:
|
|
187
|
+
children: /* @__PURE__ */ C("div", {
|
|
188
|
+
className: i("rounded border px-2 py-3", j.contentBox),
|
|
189
|
+
children: /* @__PURE__ */ C(A, {
|
|
190
|
+
stages: T,
|
|
191
191
|
isStreaming: !1
|
|
192
192
|
})
|
|
193
193
|
})
|
|
194
194
|
})
|
|
195
|
-
})] }), E.length > 0 && /* @__PURE__ */
|
|
195
|
+
})] }), E.length > 0 && /* @__PURE__ */ C(A, {
|
|
196
196
|
stages: E,
|
|
197
197
|
isStreaming: !1
|
|
198
198
|
})]
|
|
199
199
|
});
|
|
200
200
|
};
|
|
201
201
|
//#endregion
|
|
202
|
-
export {
|
|
202
|
+
export { M as CollapsedGroup, A 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.0.0-dev.
|
|
4
|
+
"version": "1.0.0-dev.515",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "./index.js",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"react": "^19.0.0",
|
|
21
21
|
"@tabler/icons-react": "^3.0.0",
|
|
22
|
-
"@epam/ai-dial-chat-shared": "1.0.0-dev.
|
|
22
|
+
"@epam/ai-dial-chat-shared": "1.0.0-dev.515",
|
|
23
23
|
"@epam/ai-dial-ui-kit": "0.12.0-dev.28"
|
|
24
24
|
},
|
|
25
25
|
"repository": {
|