@qfei-design/make-ai-assistant 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/react.cjs +4 -4
- package/dist/react.mjs +627 -510
- package/dist/styles.css +246 -29
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { resolveArtifactTemplate as
|
|
3
|
-
import { extendArtifactTemplateRegistry as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { a as
|
|
6
|
-
import { d as
|
|
7
|
-
function
|
|
1
|
+
import { jsxs as r, jsx as a, Fragment as K } from "react/jsx-runtime";
|
|
2
|
+
import { resolveArtifactTemplate as At, createArtifactTemplateRegistry as We, createArtifactCapabilities as It } from "./index.mjs";
|
|
3
|
+
import { extendArtifactTemplateRegistry as ya } from "./index.mjs";
|
|
4
|
+
import { useState as x, useRef as N, useEffect as Q, useMemo as Oe } from "react";
|
|
5
|
+
import { a as fe, r as ge, c as _e, M as w, b as wt, p as Nt } from "./conversation-B7eGUXi-.js";
|
|
6
|
+
import { d as Aa, e as Ia, f as wa, g as Na, v as Ma } from "./conversation-B7eGUXi-.js";
|
|
7
|
+
function Mt({
|
|
8
8
|
artifact: e,
|
|
9
9
|
context: t,
|
|
10
10
|
fallback: s,
|
|
11
|
-
onAction:
|
|
12
|
-
onActionError:
|
|
11
|
+
onAction: i,
|
|
12
|
+
onActionError: n,
|
|
13
13
|
registry: o
|
|
14
14
|
}) {
|
|
15
|
-
const
|
|
16
|
-
if (!
|
|
17
|
-
return s ? s(e) : /* @__PURE__ */
|
|
15
|
+
const l = At(o, e, t);
|
|
16
|
+
if (!l)
|
|
17
|
+
return s ? s(e) : /* @__PURE__ */ r("section", { className: "make-ai-artifact make-ai-artifact--unsupported", role: "status", children: [
|
|
18
18
|
/* @__PURE__ */ a("strong", { children: "暂不支持展示此结果" }),
|
|
19
|
-
/* @__PURE__ */
|
|
19
|
+
/* @__PURE__ */ r("span", { children: [
|
|
20
20
|
"结果类型:",
|
|
21
21
|
e.kind
|
|
22
22
|
] })
|
|
23
23
|
] });
|
|
24
|
-
const
|
|
24
|
+
const m = {
|
|
25
25
|
context: t,
|
|
26
|
-
onAction:
|
|
27
|
-
onActionError:
|
|
26
|
+
onAction: i,
|
|
27
|
+
onActionError: n
|
|
28
28
|
};
|
|
29
|
-
return
|
|
29
|
+
return l.template.render(e, t, m);
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const z = (e, t, s) => {
|
|
32
32
|
if (e == null || e === "") return "—";
|
|
33
33
|
if (typeof e == "boolean") return e ? "是" : "否";
|
|
34
34
|
if (typeof e != "number") return `${e}${t?.unit ?? ""}`;
|
|
35
|
-
const
|
|
36
|
-
maximumFractionDigits:
|
|
37
|
-
minimumFractionDigits:
|
|
35
|
+
const i = t?.precision, n = {
|
|
36
|
+
maximumFractionDigits: i ?? 2,
|
|
37
|
+
minimumFractionDigits: i
|
|
38
38
|
};
|
|
39
|
-
t?.style === "currency" && t.currency ? (
|
|
39
|
+
t?.style === "currency" && t.currency ? (n.style = "currency", n.currency = t.currency) : t?.style === "percent" && (n.style = "percent");
|
|
40
40
|
try {
|
|
41
41
|
const o = t?.style === "percent" ? e / 100 : e;
|
|
42
|
-
return `${new Intl.NumberFormat(s,
|
|
42
|
+
return `${new Intl.NumberFormat(s, n).format(o)}${t?.unit ?? ""}`;
|
|
43
43
|
} catch {
|
|
44
44
|
return `${e}${t?.unit ?? ""}`;
|
|
45
45
|
}
|
|
46
|
-
},
|
|
46
|
+
}, Ye = (e) => {
|
|
47
47
|
let t = Number.POSITIVE_INFINITY, s = Number.NEGATIVE_INFINITY;
|
|
48
|
-
for (const
|
|
49
|
-
t = Math.min(t,
|
|
48
|
+
for (const i of e)
|
|
49
|
+
t = Math.min(t, i), s = Math.max(s, i);
|
|
50
50
|
return Number.isFinite(t) && Number.isFinite(s) ? { min: t, max: s } : { min: 0, max: 0 };
|
|
51
|
-
},
|
|
51
|
+
}, Je = (e, t, s) => {
|
|
52
52
|
if (!s.onAction) return;
|
|
53
|
-
const
|
|
53
|
+
const i = (o) => {
|
|
54
54
|
console.error("[make-ai-assistant] host action error handler failed", {
|
|
55
55
|
actionId: e.id,
|
|
56
56
|
artifactId: t.artifact.id,
|
|
57
57
|
errorType: o instanceof Error ? o.name : typeof o,
|
|
58
58
|
intent: e.intent
|
|
59
59
|
});
|
|
60
|
-
},
|
|
60
|
+
}, n = (o) => {
|
|
61
61
|
if (s.onActionError) {
|
|
62
62
|
try {
|
|
63
63
|
Promise.resolve(
|
|
64
64
|
s.onActionError(o, e, t)
|
|
65
|
-
).catch(
|
|
66
|
-
} catch (
|
|
67
|
-
|
|
65
|
+
).catch(i);
|
|
66
|
+
} catch (l) {
|
|
67
|
+
i(l);
|
|
68
68
|
}
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
@@ -76,23 +76,23 @@ const K = (e, t, s) => {
|
|
|
76
76
|
});
|
|
77
77
|
};
|
|
78
78
|
try {
|
|
79
|
-
Promise.resolve(s.onAction(e, t)).catch(
|
|
79
|
+
Promise.resolve(s.onAction(e, t)).catch(n);
|
|
80
80
|
} catch (o) {
|
|
81
|
-
|
|
81
|
+
n(o);
|
|
82
82
|
}
|
|
83
|
-
}, X = (e, t) => e.actions?.length && t.onAction ? /* @__PURE__ */ a("div", { className: "make-ai-artifact__actions", children: e.actions.map((s) => /* @__PURE__ */
|
|
83
|
+
}, X = (e, t) => e.actions?.length && t.onAction ? /* @__PURE__ */ a("div", { className: "make-ai-artifact__actions", children: e.actions.map((s) => /* @__PURE__ */ r(
|
|
84
84
|
"button",
|
|
85
85
|
{
|
|
86
86
|
className: `make-ai-artifact__action make-ai-artifact__action--${s.appearance ?? "link"}`,
|
|
87
87
|
type: "button",
|
|
88
|
-
onClick: () =>
|
|
88
|
+
onClick: () => Je(s, { artifact: e, context: t.context }, t),
|
|
89
89
|
children: [
|
|
90
90
|
s.label,
|
|
91
91
|
/* @__PURE__ */ a("span", { "aria-hidden": "true", children: "→" })
|
|
92
92
|
]
|
|
93
93
|
},
|
|
94
94
|
s.id
|
|
95
|
-
)) }) : null, ee = (e, t, s = "") => /* @__PURE__ */
|
|
95
|
+
)) }) : null, ee = (e, t, s = "") => /* @__PURE__ */ r(
|
|
96
96
|
"section",
|
|
97
97
|
{
|
|
98
98
|
"aria-label": e.title ?? `${e.kind} result`,
|
|
@@ -105,30 +105,30 @@ const K = (e, t, s) => {
|
|
|
105
105
|
t
|
|
106
106
|
]
|
|
107
107
|
}
|
|
108
|
-
),
|
|
108
|
+
), Tt = ({
|
|
109
109
|
artifact: e,
|
|
110
110
|
renderContext: t
|
|
111
111
|
}) => {
|
|
112
|
-
const s = e.data.delta,
|
|
112
|
+
const s = e.data.delta, i = s ? z(
|
|
113
113
|
s.value,
|
|
114
114
|
s.format === "percent" ? { style: "percent" } : void 0,
|
|
115
115
|
t.context.locale
|
|
116
116
|
) : void 0;
|
|
117
117
|
return ee(
|
|
118
118
|
e,
|
|
119
|
-
/* @__PURE__ */
|
|
120
|
-
/* @__PURE__ */ a("div", { className: "make-ai-artifact__metric-value", children:
|
|
119
|
+
/* @__PURE__ */ r(K, { children: [
|
|
120
|
+
/* @__PURE__ */ a("div", { className: "make-ai-artifact__metric-value", children: z(
|
|
121
121
|
e.data.value,
|
|
122
122
|
e.data.format,
|
|
123
123
|
t.context.locale
|
|
124
124
|
) }),
|
|
125
|
-
s ? /* @__PURE__ */
|
|
125
|
+
s ? /* @__PURE__ */ r(
|
|
126
126
|
"div",
|
|
127
127
|
{
|
|
128
128
|
className: `make-ai-artifact__delta make-ai-artifact__delta--${s.direction ?? "flat"}`,
|
|
129
129
|
children: [
|
|
130
130
|
/* @__PURE__ */ a("span", { "aria-hidden": "true", children: s.direction === "up" ? "↗" : s.direction === "down" ? "↘" : "→" }),
|
|
131
|
-
/* @__PURE__ */ a("span", { children:
|
|
131
|
+
/* @__PURE__ */ a("span", { children: i }),
|
|
132
132
|
s.label ? /* @__PURE__ */ a("span", { children: s.label }) : null
|
|
133
133
|
]
|
|
134
134
|
}
|
|
@@ -138,99 +138,99 @@ const K = (e, t, s) => {
|
|
|
138
138
|
] }),
|
|
139
139
|
"make-ai-artifact--metric"
|
|
140
140
|
);
|
|
141
|
-
},
|
|
141
|
+
}, $t = ({
|
|
142
142
|
artifact: e,
|
|
143
143
|
renderContext: t
|
|
144
144
|
}) => ee(
|
|
145
145
|
e,
|
|
146
|
-
/* @__PURE__ */
|
|
147
|
-
/* @__PURE__ */ a("div", { className: "make-ai-artifact__comparison", children: e.data.items.map((s) => /* @__PURE__ */
|
|
146
|
+
/* @__PURE__ */ r(K, { children: [
|
|
147
|
+
/* @__PURE__ */ a("div", { className: "make-ai-artifact__comparison", children: e.data.items.map((s) => /* @__PURE__ */ r("div", { className: "make-ai-artifact__comparison-item", children: [
|
|
148
148
|
/* @__PURE__ */ a("span", { children: s.label }),
|
|
149
|
-
/* @__PURE__ */ a("strong", { children:
|
|
149
|
+
/* @__PURE__ */ a("strong", { children: z(s.value, s.format, t.context.locale) }),
|
|
150
150
|
s.hint ? /* @__PURE__ */ a("small", { children: s.hint }) : null
|
|
151
151
|
] }, s.id)) }),
|
|
152
152
|
X(e, t)
|
|
153
153
|
] }),
|
|
154
154
|
"make-ai-artifact--comparison"
|
|
155
|
-
),
|
|
155
|
+
), Ct = ({
|
|
156
156
|
artifact: e,
|
|
157
157
|
renderContext: t
|
|
158
158
|
}) => {
|
|
159
|
-
const s = e.data.series.flatMap((
|
|
159
|
+
const s = e.data.series.flatMap((l) => l.points.map((m) => m.y)), { max: i, min: n } = Ye(s), o = i - n || 1;
|
|
160
160
|
return ee(
|
|
161
161
|
e,
|
|
162
|
-
/* @__PURE__ */
|
|
163
|
-
/* @__PURE__ */ a("div", { className: "make-ai-artifact__trend", children: e.data.series.map((
|
|
164
|
-
/* @__PURE__ */ a("div", { className: "make-ai-artifact__trend-label", children:
|
|
165
|
-
/* @__PURE__ */ a("div", { className: "make-ai-artifact__trend-bars", children:
|
|
166
|
-
const
|
|
167
|
-
return /* @__PURE__ */
|
|
162
|
+
/* @__PURE__ */ r(K, { children: [
|
|
163
|
+
/* @__PURE__ */ a("div", { className: "make-ai-artifact__trend", children: e.data.series.map((l) => /* @__PURE__ */ r("div", { className: "make-ai-artifact__trend-series", children: [
|
|
164
|
+
/* @__PURE__ */ a("div", { className: "make-ai-artifact__trend-label", children: l.label }),
|
|
165
|
+
/* @__PURE__ */ a("div", { className: "make-ai-artifact__trend-bars", children: l.points.map((m, k) => {
|
|
166
|
+
const p = 18 + (m.y - n) / o * 70;
|
|
167
|
+
return /* @__PURE__ */ r("div", { className: "make-ai-artifact__trend-point", children: [
|
|
168
168
|
/* @__PURE__ */ a(
|
|
169
169
|
"span",
|
|
170
170
|
{
|
|
171
|
-
"aria-label": `${
|
|
172
|
-
|
|
173
|
-
|
|
171
|
+
"aria-label": `${m.x}: ${z(
|
|
172
|
+
m.y,
|
|
173
|
+
l.format,
|
|
174
174
|
t.context.locale
|
|
175
175
|
)}`,
|
|
176
176
|
className: "make-ai-artifact__trend-bar",
|
|
177
177
|
role: "img",
|
|
178
|
-
style: { height: `${
|
|
179
|
-
title: `${
|
|
180
|
-
|
|
181
|
-
|
|
178
|
+
style: { height: `${p}%` },
|
|
179
|
+
title: `${m.x}: ${z(
|
|
180
|
+
m.y,
|
|
181
|
+
l.format,
|
|
182
182
|
t.context.locale
|
|
183
183
|
)}`
|
|
184
184
|
}
|
|
185
185
|
),
|
|
186
|
-
/* @__PURE__ */ a("small", { children:
|
|
187
|
-
] }, `${
|
|
186
|
+
/* @__PURE__ */ a("small", { children: m.x })
|
|
187
|
+
] }, `${m.x}-${k}`);
|
|
188
188
|
}) })
|
|
189
|
-
] },
|
|
189
|
+
] }, l.id)) }),
|
|
190
190
|
X(e, t)
|
|
191
191
|
] }),
|
|
192
192
|
"make-ai-artifact--trend"
|
|
193
193
|
);
|
|
194
|
-
},
|
|
194
|
+
}, Et = ({
|
|
195
195
|
artifact: e,
|
|
196
196
|
renderContext: t
|
|
197
197
|
}) => {
|
|
198
|
-
const { max: s } =
|
|
199
|
-
e.data.items.map((
|
|
200
|
-
),
|
|
198
|
+
const { max: s } = Ye(
|
|
199
|
+
e.data.items.map((n) => Math.abs(n.value))
|
|
200
|
+
), i = Math.max(s, 1);
|
|
201
201
|
return ee(
|
|
202
202
|
e,
|
|
203
|
-
/* @__PURE__ */
|
|
204
|
-
/* @__PURE__ */ a("ol", { className: "make-ai-artifact__ranking", children: e.data.items.map((
|
|
203
|
+
/* @__PURE__ */ r(K, { children: [
|
|
204
|
+
/* @__PURE__ */ a("ol", { className: "make-ai-artifact__ranking", children: e.data.items.map((n, o) => /* @__PURE__ */ r("li", { children: [
|
|
205
205
|
/* @__PURE__ */ a("span", { className: "make-ai-artifact__rank", children: o + 1 }),
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
/* @__PURE__ */ a("span", { children:
|
|
208
|
-
|
|
206
|
+
/* @__PURE__ */ r("span", { className: "make-ai-artifact__ranking-label", children: [
|
|
207
|
+
/* @__PURE__ */ a("span", { children: n.label }),
|
|
208
|
+
n.description ? /* @__PURE__ */ a("small", { children: n.description }) : null
|
|
209
209
|
] }),
|
|
210
|
-
/* @__PURE__ */ a("span", { className: "make-ai-artifact__ranking-track", "aria-hidden": "true", children: /* @__PURE__ */ a("span", { style: { width: `${Math.abs(
|
|
211
|
-
/* @__PURE__ */ a("strong", { children:
|
|
212
|
-
] },
|
|
210
|
+
/* @__PURE__ */ a("span", { className: "make-ai-artifact__ranking-track", "aria-hidden": "true", children: /* @__PURE__ */ a("span", { style: { width: `${Math.abs(n.value) / i * 100}%` } }) }),
|
|
211
|
+
/* @__PURE__ */ a("strong", { children: z(n.value, n.format, t.context.locale) })
|
|
212
|
+
] }, n.id)) }),
|
|
213
213
|
X(e, t)
|
|
214
214
|
] }),
|
|
215
215
|
"make-ai-artifact--ranking"
|
|
216
216
|
);
|
|
217
|
-
},
|
|
217
|
+
}, St = (e, t) => t.action ?? {
|
|
218
218
|
id: `open-${t.id}`,
|
|
219
219
|
label: t.title ?? t.id,
|
|
220
220
|
intent: "open-record",
|
|
221
221
|
target: { entityKey: e.data.entity.key, recordId: t.id }
|
|
222
|
-
},
|
|
222
|
+
}, xt = ({
|
|
223
223
|
artifact: e,
|
|
224
224
|
renderContext: t
|
|
225
225
|
}) => ee(
|
|
226
226
|
e,
|
|
227
|
-
/* @__PURE__ */
|
|
227
|
+
/* @__PURE__ */ r(K, { children: [
|
|
228
228
|
/* @__PURE__ */ a("div", { className: "make-ai-artifact__record-list", children: e.data.records.length === 0 ? /* @__PURE__ */ a("p", { className: "make-ai-artifact__empty", children: "没有符合条件的记录" }) : e.data.records.map((s) => {
|
|
229
|
-
const
|
|
229
|
+
const i = St(e, s), n = /* @__PURE__ */ r(K, { children: [
|
|
230
230
|
/* @__PURE__ */ a("strong", { children: s.title ?? s.id }),
|
|
231
|
-
/* @__PURE__ */ a("span", { className: "make-ai-artifact__record-values", children: e.data.columns.map((o) => /* @__PURE__ */
|
|
231
|
+
/* @__PURE__ */ a("span", { className: "make-ai-artifact__record-values", children: e.data.columns.map((o) => /* @__PURE__ */ r("span", { children: [
|
|
232
232
|
/* @__PURE__ */ a("small", { children: o.label }),
|
|
233
|
-
|
|
233
|
+
z(
|
|
234
234
|
s.values[o.key],
|
|
235
235
|
o.format,
|
|
236
236
|
t.context.locale
|
|
@@ -243,16 +243,16 @@ const K = (e, t, s) => {
|
|
|
243
243
|
{
|
|
244
244
|
className: "make-ai-artifact__record",
|
|
245
245
|
type: "button",
|
|
246
|
-
onClick: () =>
|
|
246
|
+
onClick: () => Je(i, {
|
|
247
247
|
artifact: e,
|
|
248
248
|
context: t.context
|
|
249
249
|
}, t),
|
|
250
|
-
children:
|
|
250
|
+
children: n
|
|
251
251
|
},
|
|
252
252
|
s.id
|
|
253
|
-
) : /* @__PURE__ */ a("div", { className: "make-ai-artifact__record", children:
|
|
253
|
+
) : /* @__PURE__ */ a("div", { className: "make-ai-artifact__record", children: n }, s.id);
|
|
254
254
|
}) }),
|
|
255
|
-
e.data.total !== void 0 ? /* @__PURE__ */
|
|
255
|
+
e.data.total !== void 0 ? /* @__PURE__ */ r("p", { className: "make-ai-artifact__record-total", children: [
|
|
256
256
|
"共 ",
|
|
257
257
|
e.data.total,
|
|
258
258
|
" 条"
|
|
@@ -260,34 +260,64 @@ const K = (e, t, s) => {
|
|
|
260
260
|
X(e, t)
|
|
261
261
|
] }),
|
|
262
262
|
"make-ai-artifact--record-list"
|
|
263
|
-
),
|
|
263
|
+
), Rt = ({
|
|
264
264
|
artifact: e,
|
|
265
265
|
renderContext: t
|
|
266
266
|
}) => ee(
|
|
267
267
|
e,
|
|
268
|
-
/* @__PURE__ */
|
|
269
|
-
/* @__PURE__ */
|
|
268
|
+
/* @__PURE__ */ r(K, { children: [
|
|
269
|
+
/* @__PURE__ */ r("div", { className: `make-ai-artifact__notice make-ai-artifact__notice--${e.data.tone}`, children: [
|
|
270
270
|
/* @__PURE__ */ a("span", { "aria-hidden": "true", children: e.data.tone === "success" ? "✓" : e.data.tone === "warning" ? "!" : e.data.tone === "danger" ? "×" : "i" }),
|
|
271
271
|
/* @__PURE__ */ a("p", { children: e.data.body })
|
|
272
272
|
] }),
|
|
273
273
|
X(e, t)
|
|
274
274
|
] }),
|
|
275
275
|
"make-ai-artifact--notice"
|
|
276
|
-
), J = (e, t, s) => ({ id: e, kinds: [t], priority: 0, render: s }),
|
|
277
|
-
J("platform.metric.default", "metric", (e, t, s) => /* @__PURE__ */ a(
|
|
278
|
-
J("platform.comparison.default", "comparison", (e, t, s) => /* @__PURE__ */ a(
|
|
279
|
-
J("platform.trend.default", "trend", (e, t, s) => /* @__PURE__ */ a(
|
|
280
|
-
J("platform.ranking.default", "ranking", (e, t, s) => /* @__PURE__ */ a(
|
|
281
|
-
J("platform.record-list.default", "record-list", (e, t, s) => /* @__PURE__ */ a(
|
|
282
|
-
J("platform.notice.default", "notice", (e, t, s) => /* @__PURE__ */ a(
|
|
283
|
-
],
|
|
276
|
+
), J = (e, t, s) => ({ id: e, kinds: [t], priority: 0, render: s }), Lt = [
|
|
277
|
+
J("platform.metric.default", "metric", (e, t, s) => /* @__PURE__ */ a(Tt, { artifact: e, renderContext: s })),
|
|
278
|
+
J("platform.comparison.default", "comparison", (e, t, s) => /* @__PURE__ */ a($t, { artifact: e, renderContext: s })),
|
|
279
|
+
J("platform.trend.default", "trend", (e, t, s) => /* @__PURE__ */ a(Ct, { artifact: e, renderContext: s })),
|
|
280
|
+
J("platform.ranking.default", "ranking", (e, t, s) => /* @__PURE__ */ a(Et, { artifact: e, renderContext: s })),
|
|
281
|
+
J("platform.record-list.default", "record-list", (e, t, s) => /* @__PURE__ */ a(xt, { artifact: e, renderContext: s })),
|
|
282
|
+
J("platform.notice.default", "notice", (e, t, s) => /* @__PURE__ */ a(Rt, { artifact: e, renderContext: s }))
|
|
283
|
+
], Ft = We(Lt).templates, Pt = (e = Ft) => We(e), Bt = (e) => `${e}-${Date.now()}-${Math.random().toString(36).slice(2, 9)}`, Dt = "Make", qt = [
|
|
284
284
|
"总结当前页面数据",
|
|
285
285
|
"找出需要关注的记录",
|
|
286
286
|
"列出我有权限查看的数据对象"
|
|
287
|
-
],
|
|
287
|
+
], Qe = (e, t) => t ?? `${e?.trim() || Dt} AI 助手`, Vt = (e) => e ?? qt;
|
|
288
288
|
class v extends Error {
|
|
289
289
|
}
|
|
290
|
-
const
|
|
290
|
+
const ve = (e, t) => {
|
|
291
|
+
if (!(typeof e != "object" || e === null))
|
|
292
|
+
return e[t];
|
|
293
|
+
}, Ht = (e) => {
|
|
294
|
+
const t = ve(e, "status");
|
|
295
|
+
return typeof t == "number" ? t : ve(
|
|
296
|
+
ve(e, "response"),
|
|
297
|
+
"status"
|
|
298
|
+
);
|
|
299
|
+
}, Ut = (e) => {
|
|
300
|
+
const t = ve(e, "code"), s = Ht(e), i = e instanceof Error ? e.message : "", n = [t, i].filter((k) => typeof k == "string").join(" ").toLowerCase(), l = globalThis.navigator?.onLine === !1 || /network|fetch|timeout|offline|connection|网络|连接|超时/.test(n), m = typeof s == "number" && s >= 500 || /server|service|服务器|服务异常/.test(n);
|
|
301
|
+
return l ? {
|
|
302
|
+
actionLabel: "重新连接",
|
|
303
|
+
description: "请检查网络后再试。",
|
|
304
|
+
kind: "network",
|
|
305
|
+
label: "网络连接",
|
|
306
|
+
title: "网络连接不可用"
|
|
307
|
+
} : m ? {
|
|
308
|
+
actionLabel: "重新加载",
|
|
309
|
+
description: "服务暂时未能响应,请稍后重试。",
|
|
310
|
+
kind: "service",
|
|
311
|
+
label: "服务异常",
|
|
312
|
+
title: "服务暂时不可用"
|
|
313
|
+
} : {
|
|
314
|
+
actionLabel: "重新加载",
|
|
315
|
+
description: "请稍后重试;若问题持续出现,请联系管理员。",
|
|
316
|
+
kind: "unknown",
|
|
317
|
+
label: "加载异常",
|
|
318
|
+
title: "暂时无法加载对话"
|
|
319
|
+
};
|
|
320
|
+
}, je = (e) => {
|
|
291
321
|
try {
|
|
292
322
|
const t = e?.return?.();
|
|
293
323
|
if (!t) return;
|
|
@@ -301,7 +331,7 @@ const Ke = (e) => {
|
|
|
301
331
|
errorType: t instanceof Error ? t.name : typeof t
|
|
302
332
|
});
|
|
303
333
|
}
|
|
304
|
-
},
|
|
334
|
+
}, Kt = async (e) => {
|
|
305
335
|
if (globalThis.navigator?.clipboard?.writeText) {
|
|
306
336
|
await globalThis.navigator.clipboard.writeText(e);
|
|
307
337
|
return;
|
|
@@ -313,140 +343,183 @@ const Ke = (e) => {
|
|
|
313
343
|
const s = document.execCommand("copy");
|
|
314
344
|
if (t.remove(), !s)
|
|
315
345
|
throw new Error("Clipboard copy failed");
|
|
316
|
-
},
|
|
346
|
+
}, Xe = () => /* @__PURE__ */ r("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
|
|
317
347
|
/* @__PURE__ */ a("path", { d: "M12 2.8c.5 4.4 2.8 6.8 7.2 7.2-4.4.5-6.8 2.8-7.2 7.2-.5-4.4-2.8-6.8-7.2-7.2 4.4-.5 6.8-2.8 7.2-7.2Z" }),
|
|
318
348
|
/* @__PURE__ */ a("path", { d: "M18.3 16.1c.2 1.8 1.2 2.8 3 3-1.8.2-2.8 1.2-3 3-.2-1.8-1.2-2.8-3-3 1.8-.2 2.8-1.2 3-3Z" })
|
|
319
|
-
] }),
|
|
349
|
+
] }), zt = () => /* @__PURE__ */ a("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: /* @__PURE__ */ a("path", { d: "m6 6 12 12M18 6 6 18" }) }), Ot = () => /* @__PURE__ */ r("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
|
|
320
350
|
/* @__PURE__ */ a("path", { d: "M8 8h10v12H8z" }),
|
|
321
351
|
/* @__PURE__ */ a("path", { d: "M6 16H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
|
|
322
|
-
] }),
|
|
352
|
+
] }), jt = () => /* @__PURE__ */ r("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
|
|
323
353
|
/* @__PURE__ */ a("path", { d: "M20 11a8 8 0 0 0-14.7-4.4L4 8" }),
|
|
324
354
|
/* @__PURE__ */ a("path", { d: "M4 4v4h4" }),
|
|
325
355
|
/* @__PURE__ */ a("path", { d: "M4 13a8 8 0 0 0 14.7 4.4L20 16" }),
|
|
326
356
|
/* @__PURE__ */ a("path", { d: "M20 20v-4h-4" })
|
|
327
|
-
] }),
|
|
357
|
+
] }), Zt = () => /* @__PURE__ */ r("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
|
|
328
358
|
/* @__PURE__ */ a("path", { d: "M5 10v4" }),
|
|
329
359
|
/* @__PURE__ */ a("path", { d: "M8 9v6l6 3V6L8 9Z" }),
|
|
330
360
|
/* @__PURE__ */ a("path", { d: "M17 9.2a4.2 4.2 0 0 1 0 5.6" }),
|
|
331
361
|
/* @__PURE__ */ a("path", { d: "M19.4 6.8a7.6 7.6 0 0 1 0 10.4" })
|
|
332
|
-
] }),
|
|
362
|
+
] }), Gt = () => /* @__PURE__ */ r("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
|
|
333
363
|
/* @__PURE__ */ a("path", { d: "M12 4v11" }),
|
|
334
364
|
/* @__PURE__ */ a("path", { d: "m7 10 5 5 5-5" }),
|
|
335
365
|
/* @__PURE__ */ a("path", { d: "M5 20h14" })
|
|
336
|
-
] }),
|
|
366
|
+
] }), Wt = () => /* @__PURE__ */ a("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: /* @__PURE__ */ a("path", { d: "M12 5v14M5 12h14" }) }), Yt = () => /* @__PURE__ */ r("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
|
|
337
367
|
/* @__PURE__ */ a("path", { d: "m4 4 17 8-17 8 3-8-3-8Z" }),
|
|
338
368
|
/* @__PURE__ */ a("path", { d: "M7 12h14" })
|
|
339
|
-
] }),
|
|
369
|
+
] }), et = () => /* @__PURE__ */ r("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
|
|
370
|
+
/* @__PURE__ */ a("path", { d: "M20 11a8 8 0 0 0-14.7-4.4L4 8" }),
|
|
371
|
+
/* @__PURE__ */ a("path", { d: "M4 4v4h4" }),
|
|
372
|
+
/* @__PURE__ */ a("path", { d: "M4 13a8 8 0 0 0 14.7 4.4L20 16" }),
|
|
373
|
+
/* @__PURE__ */ a("path", { d: "M20 20v-4h-4" })
|
|
374
|
+
] }), Jt = () => /* @__PURE__ */ r("svg", { "aria-hidden": "true", viewBox: "0 0 24 24", children: [
|
|
375
|
+
/* @__PURE__ */ a("circle", { cx: "12", cy: "12", r: "8" }),
|
|
376
|
+
/* @__PURE__ */ a("path", { d: "M12 8v4.5" }),
|
|
377
|
+
/* @__PURE__ */ a("path", { d: "M12 16h.01" })
|
|
378
|
+
] }), ke = ({ className: e = "" }) => /* @__PURE__ */ a("span", { className: `make-ai-assistant__avatar ${e}`.trim(), "aria-hidden": "true", children: /* @__PURE__ */ a(Xe, {}) }), Qt = ({ src: e }) => e ? /* @__PURE__ */ a("span", { className: "make-ai-assistant__user-avatar", "aria-hidden": "true", children: /* @__PURE__ */ a("img", { alt: "", src: e }) }) : null, Xt = ({
|
|
340
379
|
userAvatarUrl: e,
|
|
341
380
|
userName: t
|
|
342
381
|
}) => {
|
|
343
382
|
const s = t?.trim();
|
|
344
|
-
return !s && !e ? null : /* @__PURE__ */
|
|
383
|
+
return !s && !e ? null : /* @__PURE__ */ r("div", { className: "make-ai-assistant__message-identity", children: [
|
|
345
384
|
s ? /* @__PURE__ */ a("span", { className: "make-ai-assistant__message-sender", children: s }) : null,
|
|
346
|
-
/* @__PURE__ */ a(
|
|
385
|
+
/* @__PURE__ */ a(Qt, { src: e })
|
|
347
386
|
] });
|
|
348
|
-
},
|
|
349
|
-
const t =
|
|
350
|
-
|
|
387
|
+
}, we = (e) => {
|
|
388
|
+
const t = e.trim();
|
|
389
|
+
if (!(!t.startsWith("|") || !t.endsWith("|")))
|
|
390
|
+
return t.slice(1, -1).split("|").map((s) => s.trim());
|
|
391
|
+
}, ea = (e) => e.length > 0 && e.every((t) => /^:?-{3,}:?$/.test(t)), ta = (e, t) => {
|
|
392
|
+
const s = we(e[t] ?? ""), i = we(e[t + 1] ?? "");
|
|
393
|
+
if (!s || !i || s.length !== i.length || !ea(i))
|
|
394
|
+
return;
|
|
395
|
+
const n = [];
|
|
396
|
+
let o = t + 2;
|
|
397
|
+
for (; o < e.length; ) {
|
|
398
|
+
const l = we(e[o] ?? "");
|
|
399
|
+
if (!l || l.length !== s.length) break;
|
|
400
|
+
n.push(l), o += 1;
|
|
401
|
+
}
|
|
402
|
+
return { headers: s, lastIndex: o - 1, rows: n };
|
|
403
|
+
}, aa = (e) => {
|
|
404
|
+
const t = [], s = [], i = [], n = [], o = e.replace(/\r\n?/g, `
|
|
405
|
+
`).split(`
|
|
406
|
+
`), l = () => {
|
|
407
|
+
const p = s.join(`
|
|
351
408
|
`).trim();
|
|
352
|
-
s.length = 0,
|
|
353
|
-
},
|
|
354
|
-
|
|
355
|
-
},
|
|
356
|
-
const
|
|
409
|
+
s.length = 0, p && t.push({ type: "paragraph", text: p });
|
|
410
|
+
}, m = () => {
|
|
411
|
+
i.length && t.push({ type: "list", items: i.splice(0) });
|
|
412
|
+
}, k = () => {
|
|
413
|
+
const p = n.join(`
|
|
357
414
|
`).trim();
|
|
358
|
-
|
|
415
|
+
n.length = 0, p && t.push({ type: "pre", text: p });
|
|
359
416
|
};
|
|
360
|
-
for (
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
417
|
+
for (let p = 0; p < o.length; p += 1) {
|
|
418
|
+
const M = o[p] ?? "", T = M.trim();
|
|
419
|
+
if (!T) {
|
|
420
|
+
l(), m(), k();
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
const u = ta(o, p);
|
|
424
|
+
if (u) {
|
|
425
|
+
l(), m(), k(), t.push({ headers: u.headers, rows: u.rows, type: "table" }), p = u.lastIndex;
|
|
366
426
|
continue;
|
|
367
427
|
}
|
|
368
|
-
const
|
|
369
|
-
if (
|
|
370
|
-
|
|
371
|
-
const
|
|
372
|
-
|
|
428
|
+
const $ = /^(#{1,6})\s+(.+)$/.exec(T);
|
|
429
|
+
if ($) {
|
|
430
|
+
l(), m(), k();
|
|
431
|
+
const y = ($[2] ?? "").replace(/\s+#+\s*$/, "").trim();
|
|
432
|
+
y && t.push({
|
|
373
433
|
type: "heading",
|
|
374
|
-
level:
|
|
375
|
-
text:
|
|
434
|
+
level: $[1]?.length,
|
|
435
|
+
text: y
|
|
376
436
|
});
|
|
377
437
|
continue;
|
|
378
438
|
}
|
|
379
|
-
if (/^\s*\|.+\|\s*$/.test(
|
|
380
|
-
|
|
439
|
+
if (/^\s*\|.+\|\s*$/.test(M)) {
|
|
440
|
+
l(), m(), n.push(M.trim());
|
|
381
441
|
continue;
|
|
382
442
|
}
|
|
383
|
-
const
|
|
384
|
-
if (
|
|
385
|
-
|
|
443
|
+
const R = /^\s*[-*]\s+(.+)$/.exec(M);
|
|
444
|
+
if (R) {
|
|
445
|
+
l(), k(), i.push(R[1]?.trim() ?? "");
|
|
386
446
|
continue;
|
|
387
447
|
}
|
|
388
|
-
|
|
448
|
+
m(), k(), s.push(T);
|
|
389
449
|
}
|
|
390
|
-
return
|
|
391
|
-
},
|
|
450
|
+
return l(), m(), k(), t;
|
|
451
|
+
}, ie = (e) => {
|
|
392
452
|
const t = [], s = /(\*\*[^*]+\*\*|`[^`]+`)/g;
|
|
393
|
-
let
|
|
394
|
-
for (const
|
|
395
|
-
const o =
|
|
396
|
-
|
|
453
|
+
let i = 0;
|
|
454
|
+
for (const n of e.matchAll(s)) {
|
|
455
|
+
const o = n[0], l = n.index ?? 0;
|
|
456
|
+
l > i && t.push(e.slice(i, l)), o.startsWith("**") ? t.push(/* @__PURE__ */ a("strong", { children: o.slice(2, -2) }, `${l}-strong`)) : t.push(/* @__PURE__ */ a("code", { children: o.slice(1, -1) }, `${l}-code`)), i = l + o.length;
|
|
397
457
|
}
|
|
398
|
-
return
|
|
399
|
-
},
|
|
400
|
-
const t =
|
|
401
|
-
return t.length ? /* @__PURE__ */ a("div", { className: "make-ai-assistant__bubble make-ai-assistant__assistant-text", children: t.map((s,
|
|
458
|
+
return i < e.length && t.push(e.slice(i)), t;
|
|
459
|
+
}, sa = ({ content: e }) => {
|
|
460
|
+
const t = aa(e);
|
|
461
|
+
return t.length ? /* @__PURE__ */ a("div", { className: "make-ai-assistant__bubble make-ai-assistant__assistant-text", children: t.map((s, i) => {
|
|
402
462
|
if (s.type === "heading") {
|
|
403
|
-
const
|
|
463
|
+
const n = s.level <= 2 ? "h3" : "h4";
|
|
404
464
|
return /* @__PURE__ */ a(
|
|
405
|
-
|
|
465
|
+
n,
|
|
406
466
|
{
|
|
407
467
|
className: `make-ai-assistant__markdown-heading make-ai-assistant__markdown-heading--${s.level}`,
|
|
408
|
-
children:
|
|
468
|
+
children: ie(s.text)
|
|
409
469
|
},
|
|
410
|
-
`${
|
|
470
|
+
`${i}-heading`
|
|
411
471
|
);
|
|
412
472
|
}
|
|
413
|
-
return s.type === "paragraph" ? /* @__PURE__ */ a("p", { children:
|
|
473
|
+
return s.type === "paragraph" ? /* @__PURE__ */ a("p", { children: ie(s.text) }, `${i}-paragraph`) : s.type === "pre" ? /* @__PURE__ */ a("pre", { children: /* @__PURE__ */ a("code", { children: s.text }) }, `${i}-pre`) : s.type === "table" ? /* @__PURE__ */ a(
|
|
474
|
+
"div",
|
|
475
|
+
{
|
|
476
|
+
"aria-label": "表格内容,可横向滚动",
|
|
477
|
+
className: "make-ai-assistant__markdown-table-scroll",
|
|
478
|
+
role: "region",
|
|
479
|
+
tabIndex: 0,
|
|
480
|
+
children: /* @__PURE__ */ r("table", { className: "make-ai-assistant__markdown-table", children: [
|
|
481
|
+
/* @__PURE__ */ a("thead", { children: /* @__PURE__ */ a("tr", { children: s.headers.map((n, o) => /* @__PURE__ */ a("th", { scope: "col", children: ie(n) }, `${o}-${n}`)) }) }),
|
|
482
|
+
/* @__PURE__ */ a("tbody", { children: s.rows.map((n, o) => /* @__PURE__ */ a("tr", { children: n.map((l, m) => /* @__PURE__ */ a("td", { children: ie(l) }, `${m}-${l}`)) }, `${o}-${n.join("|")}`)) })
|
|
483
|
+
] })
|
|
484
|
+
},
|
|
485
|
+
`${i}-table`
|
|
486
|
+
) : /* @__PURE__ */ a("ul", { children: s.items.map((n, o) => /* @__PURE__ */ a("li", { children: ie(n) }, `${o}-${n}`)) }, `${i}-list`);
|
|
414
487
|
}) }) : null;
|
|
415
|
-
},
|
|
416
|
-
/* @__PURE__ */ a(
|
|
488
|
+
}, tt = ({ assistantName: e }) => /* @__PURE__ */ r("div", { className: "make-ai-assistant__message-identity", children: [
|
|
489
|
+
/* @__PURE__ */ a(ke, { className: "make-ai-assistant__avatar--message" }),
|
|
417
490
|
/* @__PURE__ */ a("span", { className: "make-ai-assistant__message-sender", children: e })
|
|
418
|
-
] }),
|
|
491
|
+
] }), at = (e) => {
|
|
419
492
|
for (let t = e.messages.length - 1; t >= 0; t -= 1) {
|
|
420
493
|
const s = e.messages[t];
|
|
421
494
|
if (s.role === "assistant" && s.status === "streaming")
|
|
422
495
|
return s.id;
|
|
423
496
|
}
|
|
424
|
-
},
|
|
497
|
+
}, na = (e) => {
|
|
425
498
|
for (let t = e.messages.length - 1; t >= 0; t -= 1)
|
|
426
499
|
if (e.messages[t].role === "user") return t;
|
|
427
500
|
return -1;
|
|
428
|
-
},
|
|
429
|
-
const t =
|
|
501
|
+
}, st = (e) => {
|
|
502
|
+
const t = na(e);
|
|
430
503
|
if (!(t < 0))
|
|
431
504
|
for (let s = e.messages.length - 1; s > t; s -= 1) {
|
|
432
|
-
const
|
|
433
|
-
if (
|
|
505
|
+
const i = e.messages[s];
|
|
506
|
+
if (i.role === "assistant") return i.id;
|
|
434
507
|
}
|
|
435
|
-
},
|
|
508
|
+
}, ra = (e) => {
|
|
436
509
|
if (e.status === "idle")
|
|
437
510
|
for (let t = e.messages.length - 1; t >= 0; t -= 1) {
|
|
438
511
|
const s = e.messages[t];
|
|
439
512
|
if (s.role === "assistant" && s.status === "complete")
|
|
440
513
|
return s.id;
|
|
441
514
|
}
|
|
442
|
-
},
|
|
515
|
+
}, ia = (e) => {
|
|
443
516
|
for (let t = e.messages.length - 1; t >= 0; t -= 1) {
|
|
444
517
|
const s = e.messages[t];
|
|
445
518
|
if (s.role === "user") return s;
|
|
446
519
|
}
|
|
447
|
-
},
|
|
520
|
+
}, oa = (e, t) => {
|
|
448
521
|
const s = e.messages.findIndex(
|
|
449
|
-
(
|
|
522
|
+
(i) => i.id === t && i.role === "user"
|
|
450
523
|
);
|
|
451
524
|
return {
|
|
452
525
|
...e,
|
|
@@ -455,57 +528,108 @@ const Ke = (e) => {
|
|
|
455
528
|
status: "streaming",
|
|
456
529
|
messages: s < 0 ? e.messages : e.messages.slice(0, s + 1)
|
|
457
530
|
};
|
|
458
|
-
},
|
|
531
|
+
}, ca = (e) => e.scrollHeight - e.scrollTop - e.clientHeight <= 48, Ze = (e = "smooth") => globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : e, Ne = (e, t) => {
|
|
459
532
|
typeof e.scrollTo == "function" ? e.scrollTo({ top: e.scrollHeight, behavior: t }) : e.scrollTop = e.scrollHeight;
|
|
460
|
-
},
|
|
533
|
+
}, nt = ({
|
|
461
534
|
error: e,
|
|
462
535
|
onRetry: t
|
|
463
|
-
}) => /* @__PURE__ */
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
"
|
|
536
|
+
}) => /* @__PURE__ */ r(
|
|
537
|
+
"div",
|
|
538
|
+
{
|
|
539
|
+
className: "make-ai-assistant__message-status make-ai-assistant__message-status--error",
|
|
540
|
+
"data-error-presentation": "request-failed",
|
|
541
|
+
role: "alert",
|
|
542
|
+
children: [
|
|
543
|
+
/* @__PURE__ */ r("div", { className: "make-ai-assistant__message-status-header", children: [
|
|
544
|
+
/* @__PURE__ */ a("span", { className: "make-ai-assistant__message-status-icon", "aria-hidden": "true", children: /* @__PURE__ */ a(Jt, {}) }),
|
|
545
|
+
/* @__PURE__ */ a("strong", { children: "请求未完成" })
|
|
546
|
+
] }),
|
|
547
|
+
/* @__PURE__ */ a("span", { className: "make-ai-assistant__message-status-message", children: e.message }),
|
|
548
|
+
e.retryable && t ? /* @__PURE__ */ r(
|
|
549
|
+
"button",
|
|
550
|
+
{
|
|
551
|
+
className: "make-ai-assistant__retry",
|
|
552
|
+
type: "button",
|
|
553
|
+
onClick: t,
|
|
554
|
+
children: [
|
|
555
|
+
/* @__PURE__ */ a(et, {}),
|
|
556
|
+
"重新发送"
|
|
557
|
+
]
|
|
558
|
+
}
|
|
559
|
+
) : null
|
|
560
|
+
]
|
|
561
|
+
}
|
|
562
|
+
), la = ({
|
|
563
|
+
error: e,
|
|
564
|
+
onRetry: t
|
|
565
|
+
}) => {
|
|
566
|
+
const s = Ut(e);
|
|
567
|
+
return /* @__PURE__ */ r(
|
|
568
|
+
"section",
|
|
468
569
|
{
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
570
|
+
"aria-live": "assertive",
|
|
571
|
+
className: "make-ai-assistant__load-failure",
|
|
572
|
+
"data-load-failure-kind": s.kind,
|
|
573
|
+
role: "alert",
|
|
574
|
+
children: [
|
|
575
|
+
/* @__PURE__ */ a("span", { className: "make-ai-assistant__load-failure-icon", "aria-hidden": "true", children: /* @__PURE__ */ r("svg", { viewBox: "0 0 24 24", children: [
|
|
576
|
+
/* @__PURE__ */ a("path", { d: "M5 12a7 7 0 0 1 13.4-2.8A4.5 4.5 0 0 1 18 18H7.5A4.5 4.5 0 0 1 5 12Z" }),
|
|
577
|
+
/* @__PURE__ */ a("path", { d: "m9.2 14.8 5.6-5.6M9.2 9.2l5.6 5.6" })
|
|
578
|
+
] }) }),
|
|
579
|
+
/* @__PURE__ */ r("div", { className: "make-ai-assistant__load-failure-copy", children: [
|
|
580
|
+
/* @__PURE__ */ a("span", { className: "make-ai-assistant__load-failure-label", children: s.label }),
|
|
581
|
+
/* @__PURE__ */ a("h3", { children: s.title }),
|
|
582
|
+
/* @__PURE__ */ a("p", { children: s.description })
|
|
583
|
+
] }),
|
|
584
|
+
/* @__PURE__ */ r(
|
|
585
|
+
"button",
|
|
586
|
+
{
|
|
587
|
+
className: "make-ai-assistant__retry make-ai-assistant__retry--primary",
|
|
588
|
+
type: "button",
|
|
589
|
+
onClick: t,
|
|
590
|
+
children: [
|
|
591
|
+
/* @__PURE__ */ a(et, {}),
|
|
592
|
+
s.actionLabel
|
|
593
|
+
]
|
|
594
|
+
}
|
|
595
|
+
)
|
|
596
|
+
]
|
|
473
597
|
}
|
|
474
|
-
)
|
|
475
|
-
|
|
598
|
+
);
|
|
599
|
+
}, rt = ({
|
|
476
600
|
active: e,
|
|
477
601
|
steps: t
|
|
478
602
|
}) => {
|
|
479
|
-
if (!t?.length) return null;
|
|
603
|
+
if (!e || !t?.length) return null;
|
|
480
604
|
const s = t[t.length - 1] ?? "处理中";
|
|
481
|
-
return /* @__PURE__ */
|
|
482
|
-
/* @__PURE__ */
|
|
483
|
-
|
|
605
|
+
return /* @__PURE__ */ r("details", { className: "make-ai-assistant__process", open: !0, children: [
|
|
606
|
+
/* @__PURE__ */ r("summary", { children: [
|
|
607
|
+
/* @__PURE__ */ r("span", { className: "make-ai-assistant__progress", role: "status", children: [
|
|
484
608
|
/* @__PURE__ */ a("span", { "aria-hidden": "true" }),
|
|
485
609
|
/* @__PURE__ */ a("span", { children: s })
|
|
486
|
-
] })
|
|
487
|
-
/* @__PURE__ */
|
|
610
|
+
] }),
|
|
611
|
+
/* @__PURE__ */ r("span", { className: "make-ai-assistant__process-count", children: [
|
|
488
612
|
t.length,
|
|
489
613
|
" 步"
|
|
490
614
|
] })
|
|
491
615
|
] }),
|
|
492
|
-
/* @__PURE__ */ a("ol", { children: t.map((
|
|
616
|
+
/* @__PURE__ */ a("ol", { children: t.map((i, n) => /* @__PURE__ */ r(
|
|
493
617
|
"li",
|
|
494
618
|
{
|
|
495
|
-
"data-step-active":
|
|
619
|
+
"data-step-active": n === t.length - 1 ? !0 : void 0,
|
|
496
620
|
children: [
|
|
497
621
|
/* @__PURE__ */ a("span", { "aria-hidden": "true" }),
|
|
498
|
-
/* @__PURE__ */ a("span", { children:
|
|
622
|
+
/* @__PURE__ */ a("span", { children: i })
|
|
499
623
|
]
|
|
500
624
|
},
|
|
501
|
-
`${
|
|
625
|
+
`${n}-${i}`
|
|
502
626
|
)) })
|
|
503
627
|
] });
|
|
504
|
-
},
|
|
628
|
+
}, da = ({
|
|
505
629
|
copyFeedback: e,
|
|
506
630
|
onCopy: t,
|
|
507
631
|
onRegenerate: s
|
|
508
|
-
}) => !t && !s ? null : /* @__PURE__ */
|
|
632
|
+
}) => !t && !s ? null : /* @__PURE__ */ r("div", { className: "make-ai-assistant__reply-actions", "aria-label": "回复操作", children: [
|
|
509
633
|
t ? /* @__PURE__ */ a(
|
|
510
634
|
"button",
|
|
511
635
|
{
|
|
@@ -514,7 +638,7 @@ const Ke = (e) => {
|
|
|
514
638
|
"data-tooltip": "复制",
|
|
515
639
|
type: "button",
|
|
516
640
|
onClick: t,
|
|
517
|
-
children: /* @__PURE__ */ a(
|
|
641
|
+
children: /* @__PURE__ */ a(Ot, {})
|
|
518
642
|
}
|
|
519
643
|
) : null,
|
|
520
644
|
s ? /* @__PURE__ */ a(
|
|
@@ -525,7 +649,7 @@ const Ke = (e) => {
|
|
|
525
649
|
"data-tooltip": "重新生成",
|
|
526
650
|
type: "button",
|
|
527
651
|
onClick: s,
|
|
528
|
-
children: /* @__PURE__ */ a(
|
|
652
|
+
children: /* @__PURE__ */ a(jt, {})
|
|
529
653
|
}
|
|
530
654
|
) : null,
|
|
531
655
|
e ? /* @__PURE__ */ a(
|
|
@@ -537,476 +661,469 @@ const Ke = (e) => {
|
|
|
537
661
|
children: e.message
|
|
538
662
|
}
|
|
539
663
|
) : null
|
|
540
|
-
] }),
|
|
664
|
+
] }), Ge = ({
|
|
541
665
|
assistantName: e,
|
|
542
666
|
error: t,
|
|
543
667
|
onRetry: s,
|
|
544
|
-
progress:
|
|
668
|
+
progress: i
|
|
545
669
|
}) => {
|
|
546
|
-
const
|
|
547
|
-
return t?.message ??
|
|
670
|
+
const n = t ? "error" : "progress";
|
|
671
|
+
return t?.message ?? i?.message ? /* @__PURE__ */ a(
|
|
548
672
|
"article",
|
|
549
673
|
{
|
|
550
|
-
"aria-label": `${e}的${
|
|
551
|
-
className: `make-ai-assistant__message make-ai-assistant__message--assistant make-ai-assistant__message--${
|
|
674
|
+
"aria-label": `${e}的${n === "error" ? "错误消息" : "状态消息"}`,
|
|
675
|
+
className: `make-ai-assistant__message make-ai-assistant__message--assistant make-ai-assistant__message--${n}`,
|
|
552
676
|
"data-message-role": "assistant",
|
|
553
|
-
"data-message-state":
|
|
554
|
-
children: /* @__PURE__ */
|
|
555
|
-
/* @__PURE__ */ a(
|
|
556
|
-
/* @__PURE__ */ a("div", { className: "make-ai-assistant__message-stack", children: t ? /* @__PURE__ */ a(
|
|
677
|
+
"data-message-state": n,
|
|
678
|
+
children: /* @__PURE__ */ r("div", { className: "make-ai-assistant__message-turn", children: [
|
|
679
|
+
/* @__PURE__ */ a(tt, { assistantName: e }),
|
|
680
|
+
/* @__PURE__ */ a("div", { className: "make-ai-assistant__message-stack", children: t ? /* @__PURE__ */ a(nt, { error: t, onRetry: s }) : /* @__PURE__ */ a(rt, { active: !0, steps: i?.steps }) })
|
|
557
681
|
] })
|
|
558
682
|
}
|
|
559
683
|
) : null;
|
|
560
|
-
},
|
|
561
|
-
const
|
|
562
|
-
let
|
|
563
|
-
return e.messages.map((
|
|
564
|
-
const I =
|
|
565
|
-
I || (
|
|
566
|
-
const _ =
|
|
684
|
+
}, ma = (e, t, s, i, n, o, l, m, k, p, M, T, u) => {
|
|
685
|
+
const $ = st(e), R = at(e), y = ra(e);
|
|
686
|
+
let q;
|
|
687
|
+
return e.messages.map((h) => {
|
|
688
|
+
const I = h.role === "assistant", V = q;
|
|
689
|
+
I || (q = h);
|
|
690
|
+
const _ = h.id === R, C = h.id === $ ? e.error : void 0, S = h.error ?? C, H = !I && !!(m?.trim() || k), U = I ? o : m?.trim() || "用户", ye = I && h.status === "complete" && !S && (h.content.trim() || h.id === y);
|
|
567
691
|
return /* @__PURE__ */ a(
|
|
568
692
|
"article",
|
|
569
693
|
{
|
|
570
694
|
"aria-label": `${U}的消息`,
|
|
571
|
-
className: `make-ai-assistant__message make-ai-assistant__message--${
|
|
572
|
-
"data-message-role":
|
|
573
|
-
"data-message-state":
|
|
574
|
-
"data-message-status":
|
|
575
|
-
"data-message-has-identity": I ||
|
|
576
|
-
children: /* @__PURE__ */
|
|
577
|
-
I ? /* @__PURE__ */ a(
|
|
578
|
-
/* @__PURE__ */
|
|
579
|
-
|
|
695
|
+
className: `make-ai-assistant__message make-ai-assistant__message--${h.role}`,
|
|
696
|
+
"data-message-role": h.role,
|
|
697
|
+
"data-message-state": S ? "error" : void 0,
|
|
698
|
+
"data-message-status": h.status,
|
|
699
|
+
"data-message-has-identity": I || H ? !0 : void 0,
|
|
700
|
+
children: /* @__PURE__ */ r("div", { className: "make-ai-assistant__message-turn", children: [
|
|
701
|
+
I ? /* @__PURE__ */ a(tt, { assistantName: o }) : H ? /* @__PURE__ */ a(Xt, { userAvatarUrl: k, userName: m }) : null,
|
|
702
|
+
/* @__PURE__ */ r("div", { className: "make-ai-assistant__message-stack", children: [
|
|
703
|
+
h.content ? I ? /* @__PURE__ */ a(sa, { content: h.content }) : /* @__PURE__ */ a("div", { className: "make-ai-assistant__bubble", children: h.content }) : h.status === "streaming" ? /* @__PURE__ */ r("div", { className: "make-ai-assistant__typing", "aria-label": `${o}正在思考`, children: [
|
|
580
704
|
/* @__PURE__ */ a("span", {}),
|
|
581
705
|
/* @__PURE__ */ a("span", {}),
|
|
582
706
|
/* @__PURE__ */ a("span", {})
|
|
583
707
|
] }) : null,
|
|
584
708
|
I ? /* @__PURE__ */ a(
|
|
585
|
-
|
|
709
|
+
rt,
|
|
586
710
|
{
|
|
587
711
|
active: _ && e.status === "streaming",
|
|
588
|
-
steps:
|
|
712
|
+
steps: h.progressSteps
|
|
589
713
|
}
|
|
590
714
|
) : null,
|
|
591
|
-
|
|
592
|
-
|
|
715
|
+
S ? /* @__PURE__ */ a(
|
|
716
|
+
nt,
|
|
593
717
|
{
|
|
594
|
-
error:
|
|
595
|
-
onRetry:
|
|
718
|
+
error: S,
|
|
719
|
+
onRetry: C ? l : void 0
|
|
596
720
|
}
|
|
597
721
|
) : null,
|
|
598
|
-
|
|
599
|
-
|
|
722
|
+
h.artifacts.map((F) => /* @__PURE__ */ a(
|
|
723
|
+
Mt,
|
|
600
724
|
{
|
|
601
|
-
artifact:
|
|
725
|
+
artifact: F,
|
|
602
726
|
context: t,
|
|
603
|
-
onAction:
|
|
604
|
-
onActionError:
|
|
727
|
+
onAction: i,
|
|
728
|
+
onActionError: n,
|
|
605
729
|
registry: s
|
|
606
730
|
},
|
|
607
|
-
|
|
731
|
+
F.id
|
|
608
732
|
)),
|
|
609
|
-
|
|
610
|
-
|
|
733
|
+
ye ? /* @__PURE__ */ a(
|
|
734
|
+
da,
|
|
611
735
|
{
|
|
612
|
-
copyFeedback:
|
|
613
|
-
message:
|
|
614
|
-
status:
|
|
736
|
+
copyFeedback: p?.messageId === h.id ? {
|
|
737
|
+
message: p.message,
|
|
738
|
+
status: p.status
|
|
615
739
|
} : void 0,
|
|
616
|
-
onCopy:
|
|
617
|
-
onRegenerate:
|
|
740
|
+
onCopy: h.content.trim() ? () => T(h.id, h.content) : void 0,
|
|
741
|
+
onRegenerate: M && h.id === y && V ? () => u({
|
|
618
742
|
userMessage: V,
|
|
619
|
-
assistantMessage:
|
|
743
|
+
assistantMessage: h
|
|
620
744
|
}) : void 0
|
|
621
745
|
}
|
|
622
746
|
) : null
|
|
623
747
|
] })
|
|
624
748
|
] })
|
|
625
749
|
},
|
|
626
|
-
|
|
750
|
+
h.id
|
|
627
751
|
);
|
|
628
752
|
});
|
|
629
753
|
};
|
|
630
|
-
function
|
|
754
|
+
function it({
|
|
631
755
|
assistantName: e = "AI 助手",
|
|
632
756
|
brandName: t,
|
|
633
757
|
context: s,
|
|
634
|
-
onAction:
|
|
635
|
-
onActionError:
|
|
758
|
+
onAction: i,
|
|
759
|
+
onActionError: n,
|
|
636
760
|
onClose: o,
|
|
637
|
-
onNewConversation:
|
|
638
|
-
privacyNotice:
|
|
639
|
-
registry:
|
|
640
|
-
subtitle:
|
|
641
|
-
suggestions:
|
|
642
|
-
title:
|
|
643
|
-
transport:
|
|
644
|
-
userAvatarUrl:
|
|
645
|
-
userName:
|
|
646
|
-
visible:
|
|
761
|
+
onNewConversation: l,
|
|
762
|
+
privacyNotice: m,
|
|
763
|
+
registry: k,
|
|
764
|
+
subtitle: p,
|
|
765
|
+
suggestions: M,
|
|
766
|
+
title: T,
|
|
767
|
+
transport: u,
|
|
768
|
+
userAvatarUrl: $,
|
|
769
|
+
userName: R,
|
|
770
|
+
visible: y
|
|
647
771
|
}) {
|
|
648
|
-
const
|
|
649
|
-
|
|
650
|
-
const [
|
|
651
|
-
() =>
|
|
652
|
-
[
|
|
653
|
-
),
|
|
654
|
-
() =>
|
|
655
|
-
[
|
|
772
|
+
const q = Qe(t, T), h = m?.trim(), [I, V] = x(""), [_, C] = x(fe), S = N(_);
|
|
773
|
+
S.current = _;
|
|
774
|
+
const [H, U] = x(void 0), [ye, F] = x(void 0), [ot, ct] = x(0), [O, oe] = x(() => u.loadConversation ? "loading" : "ready"), [lt, be] = x(void 0), [dt, P] = x(!1), j = N(void 0), Z = N(void 0), G = N(0), Me = N(null), te = N(null), Te = N(null), $e = N(null), B = N(!0), Ce = N(s.app.id), Ee = N(y), Se = Oe(
|
|
775
|
+
() => k ?? Pt(),
|
|
776
|
+
[k]
|
|
777
|
+
), xe = Oe(
|
|
778
|
+
() => Vt(M),
|
|
779
|
+
[M]
|
|
656
780
|
), ce = (c) => {
|
|
657
|
-
const
|
|
658
|
-
return !
|
|
781
|
+
const f = j.current, g = Z.current?.iterator;
|
|
782
|
+
return !f && !g ? !1 : (G.current += 1, j.current = void 0, Z.current = void 0, console.info("[make-ai-assistant] local run cancellation requested", { reason: c }), f?.abort(), je(g), !0);
|
|
659
783
|
};
|
|
660
784
|
Q(() => () => {
|
|
661
785
|
ce("unmount");
|
|
662
786
|
}, []), Q(() => {
|
|
663
|
-
const c =
|
|
664
|
-
if (
|
|
665
|
-
oe("ready");
|
|
787
|
+
const c = u.loadConversation, f = Ce.current !== s.app.id;
|
|
788
|
+
if (Ce.current = s.app.id, ce("reinitialize"), f && (V(""), B.current = !0), U(void 0), F(void 0), P(!1), C(fe()), !c) {
|
|
789
|
+
be(void 0), oe("ready");
|
|
666
790
|
return;
|
|
667
791
|
}
|
|
668
792
|
const g = new AbortController();
|
|
669
|
-
return oe("loading"), console.info("[make-ai-assistant] conversation load start", {
|
|
793
|
+
return be(void 0), oe("loading"), console.info("[make-ai-assistant] conversation load start", {
|
|
670
794
|
appId: s.app.id
|
|
671
|
-
}), c.call(
|
|
672
|
-
g.signal.aborted || (
|
|
795
|
+
}), c.call(u, s, { signal: g.signal }).then((b) => {
|
|
796
|
+
g.signal.aborted || (C(fe(b)), oe("ready"), console.info("[make-ai-assistant] conversation load success", {
|
|
673
797
|
appId: s.app.id,
|
|
674
|
-
messageCount:
|
|
798
|
+
messageCount: b.messages.length
|
|
675
799
|
}));
|
|
676
|
-
}).catch((
|
|
800
|
+
}).catch((b) => {
|
|
677
801
|
g.signal.aborted || (console.error("[make-ai-assistant] conversation load failed", {
|
|
678
802
|
appId: s.app.id,
|
|
679
|
-
errorType:
|
|
680
|
-
}), oe("error"));
|
|
803
|
+
errorType: b instanceof Error ? b.name : typeof b
|
|
804
|
+
}), be(b), oe("error"));
|
|
681
805
|
}), () => g.abort();
|
|
682
|
-
}, [s.app.id,
|
|
806
|
+
}, [s.app.id, ot, u]), Q(() => {
|
|
683
807
|
const c = te.current;
|
|
684
|
-
if (!c || !
|
|
685
|
-
|
|
686
|
-
const
|
|
687
|
-
if (!
|
|
808
|
+
if (!c || !B.current) return;
|
|
809
|
+
P(!1);
|
|
810
|
+
const f = requestAnimationFrame(() => {
|
|
811
|
+
if (!B.current) return;
|
|
688
812
|
const g = _.status === "streaming" || globalThis.matchMedia?.("(prefers-reduced-motion: reduce)").matches ? "auto" : "smooth";
|
|
689
|
-
|
|
813
|
+
Ne(c, g);
|
|
690
814
|
});
|
|
691
|
-
return () => cancelAnimationFrame(
|
|
815
|
+
return () => cancelAnimationFrame(f);
|
|
692
816
|
}, [_.messages, _.progress, _.status]), Q(() => {
|
|
693
|
-
const c =
|
|
694
|
-
if (
|
|
695
|
-
const
|
|
817
|
+
const c = y && !Ee.current;
|
|
818
|
+
if (Ee.current = y, !c) return;
|
|
819
|
+
const f = requestAnimationFrame(() => {
|
|
696
820
|
const g = te.current;
|
|
697
|
-
if (g &&
|
|
698
|
-
|
|
699
|
-
const ae =
|
|
700
|
-
|
|
701
|
-
} else g &&
|
|
702
|
-
const
|
|
703
|
-
(
|
|
821
|
+
if (g && B.current) {
|
|
822
|
+
P(!1);
|
|
823
|
+
const ae = S.current.status === "streaming" ? "auto" : Ze();
|
|
824
|
+
Ne(g, ae);
|
|
825
|
+
} else g && P(S.current.messages.length > 0);
|
|
826
|
+
const b = Te.current;
|
|
827
|
+
(b && !b.disabled ? b : $e.current ?? Me.current?.querySelector("button:not(:disabled)"))?.focus();
|
|
704
828
|
});
|
|
705
|
-
return () => cancelAnimationFrame(
|
|
706
|
-
}, [
|
|
707
|
-
const
|
|
829
|
+
return () => cancelAnimationFrame(f);
|
|
830
|
+
}, [y]);
|
|
831
|
+
const mt = () => {
|
|
708
832
|
const c = te.current;
|
|
709
833
|
if (!c) return;
|
|
710
|
-
const
|
|
711
|
-
|
|
712
|
-
},
|
|
834
|
+
const f = ca(c);
|
|
835
|
+
B.current = f, P(!f && S.current.messages.length > 0);
|
|
836
|
+
}, ut = () => {
|
|
713
837
|
const c = te.current;
|
|
714
838
|
if (!c) return;
|
|
715
|
-
|
|
716
|
-
const
|
|
717
|
-
|
|
718
|
-
},
|
|
719
|
-
const g = c.trim(),
|
|
720
|
-
if (!g || O !== "ready" ||
|
|
839
|
+
B.current = !0, P(!1);
|
|
840
|
+
const f = Ze();
|
|
841
|
+
Ne(c, f);
|
|
842
|
+
}, Re = async (c, f) => {
|
|
843
|
+
const g = c.trim(), b = S.current, L = f?.regenerateFrom, ae = u.regenerate;
|
|
844
|
+
if (!g || O !== "ready" || b.status === "streaming" || j.current || L && !ae) return;
|
|
721
845
|
if (_e(
|
|
722
846
|
g,
|
|
723
|
-
|
|
724
|
-
) >
|
|
847
|
+
w.messageCharacters
|
|
848
|
+
) > w.messageCharacters) {
|
|
725
849
|
U(
|
|
726
|
-
`输入内容过长,请控制在 ${
|
|
850
|
+
`输入内容过长,请控制在 ${w.messageCharacters} 个字符以内`
|
|
727
851
|
);
|
|
728
852
|
return;
|
|
729
853
|
}
|
|
730
854
|
const me = {
|
|
731
|
-
id:
|
|
855
|
+
id: L?.userMessage.id ?? Bt("user"),
|
|
732
856
|
content: g
|
|
733
|
-
}, ue =
|
|
734
|
-
G.current =
|
|
857
|
+
}, ue = L ? oa(b, L.userMessage.id) : wt(b, me), he = new AbortController(), W = G.current + 1;
|
|
858
|
+
G.current = W, j.current = he, U(void 0), F(void 0), P(!B.current && b.messages.length > 0), L || V(""), C(ue);
|
|
735
859
|
try {
|
|
736
|
-
let
|
|
737
|
-
const ne = /* @__PURE__ */ new Map(),
|
|
860
|
+
let D = !1, A, Pe = 0, Be = 0, De = 0, Ae = 0, se = 0;
|
|
861
|
+
const ne = /* @__PURE__ */ new Map(), qe = /* @__PURE__ */ new Set(), Ve = /* @__PURE__ */ new Set(
|
|
738
862
|
[
|
|
739
|
-
...ue.messages.map((
|
|
863
|
+
...ue.messages.map((pe) => pe.id),
|
|
740
864
|
me.id
|
|
741
865
|
]
|
|
742
|
-
), re = /* @__PURE__ */ new Set(),
|
|
743
|
-
let
|
|
744
|
-
if (
|
|
866
|
+
), re = /* @__PURE__ */ new Set(), He = It(Se), Ue = { signal: he.signal };
|
|
867
|
+
let Ie;
|
|
868
|
+
if (L) {
|
|
745
869
|
if (!ae)
|
|
746
870
|
throw new v("当前 AI 助手不支持重新生成");
|
|
747
|
-
|
|
871
|
+
Ie = ae({
|
|
748
872
|
threadId: ue.threadId,
|
|
749
873
|
message: me,
|
|
750
874
|
assistantMessage: {
|
|
751
|
-
id:
|
|
752
|
-
content:
|
|
875
|
+
id: L.assistantMessage.id,
|
|
876
|
+
content: L.assistantMessage.content
|
|
753
877
|
},
|
|
754
878
|
context: s,
|
|
755
|
-
capabilities:
|
|
756
|
-
},
|
|
879
|
+
capabilities: He
|
|
880
|
+
}, Ue);
|
|
757
881
|
} else
|
|
758
|
-
|
|
882
|
+
Ie = u.run(
|
|
759
883
|
{
|
|
760
884
|
threadId: ue.threadId,
|
|
761
885
|
message: me,
|
|
762
886
|
context: s,
|
|
763
|
-
capabilities:
|
|
887
|
+
capabilities: He
|
|
764
888
|
},
|
|
765
|
-
|
|
889
|
+
Ue
|
|
766
890
|
);
|
|
767
|
-
const
|
|
768
|
-
for (Z.current = { iterator:
|
|
769
|
-
const
|
|
770
|
-
if (G.current !==
|
|
771
|
-
let
|
|
891
|
+
const Ke = Ie[Symbol.asyncIterator]();
|
|
892
|
+
for (Z.current = { iterator: Ke, requestVersion: W }; ; ) {
|
|
893
|
+
const pe = await Ke.next();
|
|
894
|
+
if (G.current !== W || pe.done) break;
|
|
895
|
+
let d;
|
|
772
896
|
try {
|
|
773
|
-
|
|
774
|
-
} catch (
|
|
897
|
+
d = Nt(pe.value);
|
|
898
|
+
} catch (E) {
|
|
775
899
|
throw new v(
|
|
776
|
-
|
|
900
|
+
E instanceof Error ? E.message : "Invalid assistant event"
|
|
777
901
|
);
|
|
778
902
|
}
|
|
779
|
-
if (
|
|
780
|
-
if (A !== void 0 && A !==
|
|
903
|
+
if (d.type === "message.start") {
|
|
904
|
+
if (A !== void 0 && A !== d.runId)
|
|
781
905
|
throw new v("AI 助手响应 run id 不一致");
|
|
782
|
-
if (A ??=
|
|
906
|
+
if (A ??= d.runId, Be += 1, Be > w.assistantMessagesPerRun)
|
|
783
907
|
throw new v("AI 助手单次响应消息数量超过限制");
|
|
784
|
-
if (
|
|
908
|
+
if (Ve.has(d.messageId))
|
|
785
909
|
throw new v("AI 助手响应包含重复的 message id");
|
|
786
|
-
|
|
910
|
+
Ve.add(d.messageId), re.add(d.messageId), ne.set(d.messageId, 0);
|
|
787
911
|
}
|
|
788
|
-
if (
|
|
789
|
-
if (!re.has(
|
|
912
|
+
if (d.type === "message.delta") {
|
|
913
|
+
if (!re.has(d.messageId))
|
|
790
914
|
throw new v("AI 助手响应事件顺序无效");
|
|
791
|
-
const
|
|
792
|
-
|
|
793
|
-
|
|
915
|
+
const E = ne.get(d.messageId) ?? 0, Y = _e(
|
|
916
|
+
d.delta,
|
|
917
|
+
w.messageCharacters - se
|
|
794
918
|
);
|
|
795
|
-
if (se +
|
|
919
|
+
if (se + Y > w.messageCharacters)
|
|
796
920
|
throw new v("AI 助手响应文本超过大小限制");
|
|
797
|
-
se +=
|
|
798
|
-
|
|
799
|
-
|
|
921
|
+
se += Y, ne.set(
|
|
922
|
+
d.messageId,
|
|
923
|
+
E + Y
|
|
800
924
|
);
|
|
801
925
|
}
|
|
802
|
-
if (
|
|
803
|
-
if (!re.has(
|
|
926
|
+
if (d.type === "message.replace") {
|
|
927
|
+
if (!re.has(d.messageId))
|
|
804
928
|
throw new v("AI 助手响应事件顺序无效");
|
|
805
|
-
const
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
),
|
|
809
|
-
if (
|
|
929
|
+
const E = ne.get(d.messageId) ?? 0, Y = _e(
|
|
930
|
+
d.content,
|
|
931
|
+
w.messageCharacters
|
|
932
|
+
), ze = se - E + Y;
|
|
933
|
+
if (ze > w.messageCharacters)
|
|
810
934
|
throw new v("AI 助手响应文本超过大小限制");
|
|
811
|
-
se =
|
|
935
|
+
se = ze, ne.set(d.messageId, Y);
|
|
812
936
|
}
|
|
813
|
-
if (
|
|
814
|
-
if (A !== void 0 && A !==
|
|
937
|
+
if (d.type === "run.progress") {
|
|
938
|
+
if (A !== void 0 && A !== d.runId)
|
|
815
939
|
throw new v("AI 助手响应 run id 不一致");
|
|
816
|
-
if (A ??=
|
|
940
|
+
if (A ??= d.runId, De += 1, De > w.progressStepsPerRun)
|
|
817
941
|
throw new v("AI 助手处理过程数量超过限制");
|
|
818
|
-
const
|
|
819
|
-
|
|
820
|
-
|
|
942
|
+
const E = _e(
|
|
943
|
+
d.message,
|
|
944
|
+
w.progressCharactersPerRun - Ae
|
|
821
945
|
);
|
|
822
|
-
if (
|
|
946
|
+
if (Ae + E > w.progressCharactersPerRun)
|
|
823
947
|
throw new v("AI 助手处理过程文本超过大小限制");
|
|
824
|
-
|
|
948
|
+
Ae += E;
|
|
825
949
|
}
|
|
826
|
-
if (
|
|
827
|
-
if (!re.has(
|
|
950
|
+
if (d.type === "artifact") {
|
|
951
|
+
if (!re.has(d.messageId))
|
|
828
952
|
throw new v("AI 助手响应事件顺序无效");
|
|
829
|
-
if (
|
|
953
|
+
if (Pe += 1, Pe > w.artifactsPerRun)
|
|
830
954
|
throw new v("AI 助手单次响应 Artifact 数量超过限制");
|
|
831
|
-
if (
|
|
955
|
+
if (qe.has(d.artifact.id))
|
|
832
956
|
throw new v("AI 助手响应包含重复的 Artifact id");
|
|
833
|
-
|
|
957
|
+
qe.add(d.artifact.id);
|
|
834
958
|
}
|
|
835
|
-
if (
|
|
959
|
+
if (d.type === "message.complete" && !re.delete(d.messageId))
|
|
836
960
|
throw new v("AI 助手响应事件顺序无效");
|
|
837
|
-
if (
|
|
961
|
+
if (d.type === "run.complete" && A !== void 0 && A !== d.runId)
|
|
838
962
|
throw new v("AI 助手响应 run id 不一致");
|
|
839
|
-
if (
|
|
963
|
+
if (d.type === "run.cancelled" && d.runId !== void 0 && A !== void 0 && A !== d.runId)
|
|
840
964
|
throw new v("AI 助手响应 run id 不一致");
|
|
841
|
-
if (
|
|
842
|
-
|
|
965
|
+
if (C((E) => ge(E, d)), d.type === "error" || d.type === "run.cancelled" || d.type === "run.complete") {
|
|
966
|
+
D = !0;
|
|
843
967
|
break;
|
|
844
968
|
}
|
|
845
969
|
}
|
|
846
|
-
if (!
|
|
970
|
+
if (!D)
|
|
847
971
|
throw new v("AI 助手流式响应在终止事件前结束");
|
|
848
|
-
} catch (
|
|
849
|
-
if (G.current !==
|
|
850
|
-
if (
|
|
851
|
-
|
|
852
|
-
(A) =>
|
|
972
|
+
} catch (D) {
|
|
973
|
+
if (G.current !== W) return;
|
|
974
|
+
if (he.signal.aborted) {
|
|
975
|
+
C(
|
|
976
|
+
(A) => ge(A, { type: "run.cancelled" })
|
|
853
977
|
);
|
|
854
978
|
return;
|
|
855
979
|
}
|
|
856
980
|
console.error("[make-ai-assistant] assistant run failed", {
|
|
857
981
|
appId: s.app.id,
|
|
858
|
-
errorType:
|
|
859
|
-
}),
|
|
860
|
-
(A) =>
|
|
982
|
+
errorType: D instanceof Error ? D.name : typeof D
|
|
983
|
+
}), C(
|
|
984
|
+
(A) => ge(A, {
|
|
861
985
|
type: "error",
|
|
862
986
|
code: "TRANSPORT_ERROR",
|
|
863
|
-
message:
|
|
987
|
+
message: D instanceof v ? D.message : "连接失败,请重试",
|
|
864
988
|
retryable: !0
|
|
865
989
|
})
|
|
866
990
|
);
|
|
867
991
|
} finally {
|
|
868
|
-
G.current ===
|
|
992
|
+
G.current === W && j.current === he && (j.current = void 0), Z.current?.requestVersion === W && (je(Z.current.iterator), Z.current = void 0);
|
|
869
993
|
}
|
|
870
|
-
}, le = (c) =>
|
|
994
|
+
}, le = (c) => Re(c), ht = (c) => Re(c.userMessage.content, { regenerateFrom: c }), pt = async (c, f) => {
|
|
871
995
|
try {
|
|
872
|
-
await
|
|
996
|
+
await Kt(f), F({ messageId: c, message: "已复制", status: "success" });
|
|
873
997
|
} catch (g) {
|
|
874
998
|
console.error("[make-ai-assistant] copy answer failed", {
|
|
875
999
|
errorType: g instanceof Error ? g.name : typeof g
|
|
876
|
-
}),
|
|
1000
|
+
}), F({ messageId: c, message: "复制失败", status: "error" });
|
|
877
1001
|
}
|
|
878
|
-
},
|
|
1002
|
+
}, ft = (c) => {
|
|
879
1003
|
c.preventDefault(), le(I);
|
|
880
|
-
},
|
|
1004
|
+
}, gt = (c) => {
|
|
881
1005
|
c.key === "Enter" && !c.shiftKey && !c.nativeEvent.isComposing && (c.preventDefault(), le(I));
|
|
882
|
-
},
|
|
883
|
-
ce("stop") &&
|
|
884
|
-
(c) =>
|
|
1006
|
+
}, _t = () => {
|
|
1007
|
+
ce("stop") && C(
|
|
1008
|
+
(c) => ge(c, { type: "run.cancelled" })
|
|
885
1009
|
);
|
|
886
|
-
},
|
|
887
|
-
ce("new-conversation"), V(""), U(void 0),
|
|
888
|
-
},
|
|
1010
|
+
}, vt = () => {
|
|
1011
|
+
ce("new-conversation"), V(""), U(void 0), F(void 0), P(!1), B.current = !0, C(fe()), l?.();
|
|
1012
|
+
}, Le = u.features?.remoteCancellation === !1 ? "停止接收" : "停止生成", kt = at(_), yt = st(_), de = ia(_), bt = typeof u.regenerate == "function" && u.features?.regeneration !== !1, Fe = () => {
|
|
889
1013
|
de && le(de.content);
|
|
890
1014
|
};
|
|
891
|
-
return /* @__PURE__ */
|
|
1015
|
+
return /* @__PURE__ */ r(
|
|
892
1016
|
"section",
|
|
893
1017
|
{
|
|
894
1018
|
className: "make-ai-assistant make-ai-assistant__panel",
|
|
895
|
-
ref:
|
|
1019
|
+
ref: Me,
|
|
896
1020
|
children: [
|
|
897
|
-
/* @__PURE__ */
|
|
898
|
-
/* @__PURE__ */ a(
|
|
899
|
-
/* @__PURE__ */
|
|
900
|
-
/* @__PURE__ */ a("h2", { children:
|
|
901
|
-
/* @__PURE__ */ a("p", { children:
|
|
1021
|
+
/* @__PURE__ */ r("header", { className: "make-ai-assistant__header", children: [
|
|
1022
|
+
/* @__PURE__ */ a(ke, {}),
|
|
1023
|
+
/* @__PURE__ */ r("div", { children: [
|
|
1024
|
+
/* @__PURE__ */ a("h2", { children: q }),
|
|
1025
|
+
/* @__PURE__ */ a("p", { children: p ?? `当前应用:${s.app.name ?? "未命名应用"}` })
|
|
902
1026
|
] }),
|
|
903
|
-
/* @__PURE__ */
|
|
904
|
-
|
|
1027
|
+
/* @__PURE__ */ r("div", { className: "make-ai-assistant__header-actions", children: [
|
|
1028
|
+
u.features?.newConversation !== !1 ? /* @__PURE__ */ a(
|
|
905
1029
|
"button",
|
|
906
1030
|
{
|
|
907
1031
|
"aria-label": "新建对话",
|
|
908
1032
|
className: "make-ai-assistant__icon-button",
|
|
909
1033
|
type: "button",
|
|
910
|
-
onClick:
|
|
911
|
-
children: /* @__PURE__ */ a(
|
|
1034
|
+
onClick: vt,
|
|
1035
|
+
children: /* @__PURE__ */ a(Wt, {})
|
|
912
1036
|
}
|
|
913
1037
|
) : null,
|
|
914
1038
|
o ? /* @__PURE__ */ a(
|
|
915
1039
|
"button",
|
|
916
1040
|
{
|
|
917
|
-
"aria-label": `关闭 ${
|
|
1041
|
+
"aria-label": `关闭 ${q}`,
|
|
918
1042
|
className: "make-ai-assistant__icon-button",
|
|
919
1043
|
type: "button",
|
|
920
1044
|
onClick: o,
|
|
921
|
-
children: /* @__PURE__ */ a(
|
|
1045
|
+
children: /* @__PURE__ */ a(zt, {})
|
|
922
1046
|
}
|
|
923
1047
|
) : null
|
|
924
1048
|
] })
|
|
925
1049
|
] }),
|
|
926
|
-
|
|
927
|
-
/* @__PURE__ */ a("span", { className: "make-ai-assistant__privacy-icon", "aria-hidden": "true", children: /* @__PURE__ */ a(
|
|
928
|
-
/* @__PURE__ */ a("span", { children:
|
|
929
|
-
] }) : null,
|
|
930
|
-
/* @__PURE__ */
|
|
1050
|
+
h ? /* @__PURE__ */ a("div", { className: "make-ai-assistant__notice-region", children: /* @__PURE__ */ r("div", { className: "make-ai-assistant__privacy-note", role: "note", children: [
|
|
1051
|
+
/* @__PURE__ */ a("span", { className: "make-ai-assistant__privacy-icon", "aria-hidden": "true", children: /* @__PURE__ */ a(Zt, {}) }),
|
|
1052
|
+
/* @__PURE__ */ a("span", { children: h })
|
|
1053
|
+
] }) }) : null,
|
|
1054
|
+
/* @__PURE__ */ r(
|
|
931
1055
|
"div",
|
|
932
1056
|
{
|
|
933
|
-
className: "make-ai-assistant__body"
|
|
1057
|
+
className: `make-ai-assistant__body${h ? " make-ai-assistant__body--with-notice" : ""}`,
|
|
934
1058
|
"aria-live": "polite",
|
|
935
1059
|
"aria-relevant": "additions text",
|
|
936
1060
|
ref: te,
|
|
937
1061
|
role: "log",
|
|
938
|
-
onScroll:
|
|
1062
|
+
onScroll: mt,
|
|
939
1063
|
children: [
|
|
940
|
-
O === "loading" ? /* @__PURE__ */
|
|
941
|
-
/* @__PURE__ */ a(
|
|
1064
|
+
O === "loading" ? /* @__PURE__ */ r("div", { className: "make-ai-assistant__empty", role: "status", children: [
|
|
1065
|
+
/* @__PURE__ */ a(ke, {}),
|
|
942
1066
|
/* @__PURE__ */ a("h3", { children: "正在恢复对话" }),
|
|
943
1067
|
/* @__PURE__ */ a("p", { children: "正在读取当前 App 的历史消息…" })
|
|
944
|
-
] }) : O === "error" ? /* @__PURE__ */
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
type: "button",
|
|
953
|
-
onClick: () => nt((c) => c + 1),
|
|
954
|
-
children: "重新加载"
|
|
955
|
-
}
|
|
956
|
-
)
|
|
957
|
-
] }) : _.messages.length === 0 ? /* @__PURE__ */ i("div", { className: "make-ai-assistant__empty", children: [
|
|
958
|
-
/* @__PURE__ */ a(ie, {}),
|
|
1068
|
+
] }) : O === "error" ? /* @__PURE__ */ a("div", { className: "make-ai-assistant__empty", children: /* @__PURE__ */ a(
|
|
1069
|
+
la,
|
|
1070
|
+
{
|
|
1071
|
+
error: lt,
|
|
1072
|
+
onRetry: () => ct((c) => c + 1)
|
|
1073
|
+
}
|
|
1074
|
+
) }) : _.messages.length === 0 ? /* @__PURE__ */ r("div", { className: "make-ai-assistant__empty", children: [
|
|
1075
|
+
/* @__PURE__ */ a(ke, {}),
|
|
959
1076
|
/* @__PURE__ */ a("h3", { children: "有什么可以帮你?" }),
|
|
960
1077
|
/* @__PURE__ */ a("p", { children: "我会结合当前 App、页面位置和宿主允许的上下文回答,并把过程与结果分开展示。" })
|
|
961
|
-
] }) :
|
|
1078
|
+
] }) : ma(
|
|
962
1079
|
_,
|
|
963
1080
|
s,
|
|
964
|
-
|
|
1081
|
+
Se,
|
|
1082
|
+
i,
|
|
965
1083
|
n,
|
|
966
|
-
r,
|
|
967
1084
|
e,
|
|
968
|
-
de ?
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
(c,
|
|
974
|
-
|
|
1085
|
+
de ? Fe : void 0,
|
|
1086
|
+
R,
|
|
1087
|
+
$,
|
|
1088
|
+
ye,
|
|
1089
|
+
bt,
|
|
1090
|
+
(c, f) => {
|
|
1091
|
+
pt(c, f);
|
|
975
1092
|
},
|
|
976
1093
|
(c) => {
|
|
977
|
-
|
|
1094
|
+
ht(c);
|
|
978
1095
|
}
|
|
979
1096
|
),
|
|
980
|
-
_.progress && !
|
|
981
|
-
|
|
1097
|
+
_.progress && !kt ? /* @__PURE__ */ a(
|
|
1098
|
+
Ge,
|
|
982
1099
|
{
|
|
983
1100
|
assistantName: e,
|
|
984
1101
|
progress: _.progress
|
|
985
1102
|
}
|
|
986
1103
|
) : null,
|
|
987
|
-
_.error && !
|
|
988
|
-
|
|
1104
|
+
_.error && !yt ? /* @__PURE__ */ a(
|
|
1105
|
+
Ge,
|
|
989
1106
|
{
|
|
990
1107
|
assistantName: e,
|
|
991
1108
|
error: _.error,
|
|
992
|
-
onRetry: de ?
|
|
1109
|
+
onRetry: de ? Fe : void 0
|
|
993
1110
|
}
|
|
994
1111
|
) : null
|
|
995
1112
|
]
|
|
996
1113
|
}
|
|
997
1114
|
),
|
|
998
|
-
|
|
1115
|
+
dt ? /* @__PURE__ */ a(
|
|
999
1116
|
"button",
|
|
1000
1117
|
{
|
|
1001
1118
|
"aria-label": "回到最新消息",
|
|
1002
1119
|
className: "make-ai-assistant__back-to-latest",
|
|
1003
1120
|
type: "button",
|
|
1004
|
-
onClick:
|
|
1005
|
-
children: /* @__PURE__ */ a(
|
|
1121
|
+
onClick: ut,
|
|
1122
|
+
children: /* @__PURE__ */ a(Gt, {})
|
|
1006
1123
|
}
|
|
1007
1124
|
) : null,
|
|
1008
|
-
/* @__PURE__ */
|
|
1009
|
-
O === "ready" &&
|
|
1125
|
+
/* @__PURE__ */ r("footer", { className: "make-ai-assistant__composer-region", children: [
|
|
1126
|
+
O === "ready" && xe.length > 0 && _.messages.length === 0 ? /* @__PURE__ */ a("div", { className: "make-ai-assistant__suggestions", "aria-label": "推荐问题", children: xe.map((c, f) => /* @__PURE__ */ a(
|
|
1010
1127
|
"button",
|
|
1011
1128
|
{
|
|
1012
1129
|
type: "button",
|
|
@@ -1015,36 +1132,36 @@ function at({
|
|
|
1015
1132
|
},
|
|
1016
1133
|
children: c
|
|
1017
1134
|
},
|
|
1018
|
-
`${
|
|
1135
|
+
`${f}-${c}`
|
|
1019
1136
|
)) }) : null,
|
|
1020
|
-
/* @__PURE__ */
|
|
1137
|
+
/* @__PURE__ */ r("form", { className: "make-ai-assistant__composer", onSubmit: ft, children: [
|
|
1021
1138
|
/* @__PURE__ */ a(
|
|
1022
1139
|
"textarea",
|
|
1023
1140
|
{
|
|
1024
1141
|
"aria-label": `向 ${e} 提问`,
|
|
1025
|
-
"aria-describedby":
|
|
1026
|
-
"aria-invalid":
|
|
1142
|
+
"aria-describedby": H ? "make-ai-composer-error" : void 0,
|
|
1143
|
+
"aria-invalid": H ? !0 : void 0,
|
|
1027
1144
|
autoFocus: !0,
|
|
1028
1145
|
disabled: O !== "ready" || _.status === "streaming",
|
|
1029
1146
|
placeholder: `询问当前 ${s.app.name ?? "App"} 中的数据…`,
|
|
1030
|
-
ref:
|
|
1147
|
+
ref: Te,
|
|
1031
1148
|
rows: 2,
|
|
1032
1149
|
value: I,
|
|
1033
1150
|
onChange: (c) => {
|
|
1034
1151
|
V(c.currentTarget.value), U(void 0);
|
|
1035
1152
|
},
|
|
1036
|
-
onKeyDown:
|
|
1153
|
+
onKeyDown: gt
|
|
1037
1154
|
}
|
|
1038
1155
|
),
|
|
1039
1156
|
_.status === "streaming" ? /* @__PURE__ */ a(
|
|
1040
1157
|
"button",
|
|
1041
1158
|
{
|
|
1042
|
-
"aria-label":
|
|
1159
|
+
"aria-label": Le,
|
|
1043
1160
|
className: "make-ai-assistant__send make-ai-assistant__send--stop",
|
|
1044
|
-
"data-tooltip":
|
|
1045
|
-
ref:
|
|
1161
|
+
"data-tooltip": Le,
|
|
1162
|
+
ref: $e,
|
|
1046
1163
|
type: "button",
|
|
1047
|
-
onClick:
|
|
1164
|
+
onClick: _t,
|
|
1048
1165
|
children: /* @__PURE__ */ a("span", { "aria-hidden": "true" })
|
|
1049
1166
|
}
|
|
1050
1167
|
) : /* @__PURE__ */ a(
|
|
@@ -1054,71 +1171,71 @@ function at({
|
|
|
1054
1171
|
className: "make-ai-assistant__send",
|
|
1055
1172
|
disabled: O !== "ready" || !I.trim(),
|
|
1056
1173
|
type: "submit",
|
|
1057
|
-
children: /* @__PURE__ */ a(
|
|
1174
|
+
children: /* @__PURE__ */ a(Yt, {})
|
|
1058
1175
|
}
|
|
1059
1176
|
)
|
|
1060
1177
|
] }),
|
|
1061
|
-
|
|
1178
|
+
H ? /* @__PURE__ */ a("p", { id: "make-ai-composer-error", role: "alert", children: H }) : null,
|
|
1062
1179
|
/* @__PURE__ */ a("p", { children: "AI 生成的结果可能存在偏差,重要数据请核对明细。" })
|
|
1063
1180
|
] })
|
|
1064
1181
|
]
|
|
1065
1182
|
}
|
|
1066
1183
|
);
|
|
1067
1184
|
}
|
|
1068
|
-
function
|
|
1069
|
-
return /* @__PURE__ */ a(
|
|
1185
|
+
function ga(e) {
|
|
1186
|
+
return /* @__PURE__ */ a(it, { ...e, visible: !0 });
|
|
1070
1187
|
}
|
|
1071
|
-
function
|
|
1188
|
+
function _a({
|
|
1072
1189
|
defaultOpen: e = !1,
|
|
1073
1190
|
hideLauncher: t = !1,
|
|
1074
1191
|
launcher: s,
|
|
1075
|
-
onOpenChange:
|
|
1076
|
-
open:
|
|
1192
|
+
onOpenChange: i,
|
|
1193
|
+
open: n,
|
|
1077
1194
|
...o
|
|
1078
1195
|
}) {
|
|
1079
|
-
const
|
|
1080
|
-
() => e ||
|
|
1081
|
-
),
|
|
1082
|
-
|
|
1083
|
-
},
|
|
1196
|
+
const l = Qe(o.brandName, o.title), [m, k] = x(e), [p, M] = x(
|
|
1197
|
+
() => e || n === !0
|
|
1198
|
+
), T = N(null), u = n ?? m, $ = (y) => {
|
|
1199
|
+
n === void 0 && k(y), i?.(y), y || requestAnimationFrame(() => T.current?.focus());
|
|
1200
|
+
}, R = () => $(!u);
|
|
1084
1201
|
return Q(() => {
|
|
1085
|
-
|
|
1086
|
-
}, [
|
|
1087
|
-
if (!
|
|
1088
|
-
const
|
|
1089
|
-
|
|
1202
|
+
u && M(!0);
|
|
1203
|
+
}, [u]), Q(() => {
|
|
1204
|
+
if (!u) return;
|
|
1205
|
+
const y = (q) => {
|
|
1206
|
+
q.key === "Escape" && ($(!1), requestAnimationFrame(() => T.current?.focus()));
|
|
1090
1207
|
};
|
|
1091
|
-
return document.addEventListener("keydown",
|
|
1092
|
-
}, [
|
|
1093
|
-
!t && (!
|
|
1208
|
+
return document.addEventListener("keydown", y), () => document.removeEventListener("keydown", y);
|
|
1209
|
+
}, [i, u]), /* @__PURE__ */ r("div", { className: "make-ai-assistant", "data-open": u || void 0, children: [
|
|
1210
|
+
!t && (!u || s) ? s ? s({ open: u, toggle: R }) : /* @__PURE__ */ r(
|
|
1094
1211
|
"button",
|
|
1095
1212
|
{
|
|
1096
|
-
"aria-label":
|
|
1097
|
-
"aria-expanded":
|
|
1213
|
+
"aria-label": u ? `关闭 ${l}` : `打开 ${l}`,
|
|
1214
|
+
"aria-expanded": u,
|
|
1098
1215
|
className: "make-ai-assistant__launcher",
|
|
1099
|
-
ref:
|
|
1216
|
+
ref: T,
|
|
1100
1217
|
type: "button",
|
|
1101
|
-
onClick:
|
|
1218
|
+
onClick: R,
|
|
1102
1219
|
children: [
|
|
1103
1220
|
/* @__PURE__ */ a("span", { className: "make-ai-assistant__launcher-orbit", "aria-hidden": "true" }),
|
|
1104
|
-
/* @__PURE__ */ a(
|
|
1221
|
+
/* @__PURE__ */ a(Xe, {})
|
|
1105
1222
|
]
|
|
1106
1223
|
}
|
|
1107
1224
|
) : null,
|
|
1108
|
-
|
|
1225
|
+
p ? /* @__PURE__ */ a(
|
|
1109
1226
|
"aside",
|
|
1110
1227
|
{
|
|
1111
|
-
"aria-label":
|
|
1228
|
+
"aria-label": l,
|
|
1112
1229
|
"aria-modal": "false",
|
|
1113
1230
|
className: "make-ai-assistant__drawer",
|
|
1114
|
-
hidden: !
|
|
1231
|
+
hidden: !u,
|
|
1115
1232
|
role: "dialog",
|
|
1116
1233
|
children: /* @__PURE__ */ a(
|
|
1117
|
-
|
|
1234
|
+
it,
|
|
1118
1235
|
{
|
|
1119
1236
|
...o,
|
|
1120
|
-
onClose: () =>
|
|
1121
|
-
visible:
|
|
1237
|
+
onClose: () => $(!1),
|
|
1238
|
+
visible: u
|
|
1122
1239
|
}
|
|
1123
1240
|
)
|
|
1124
1241
|
}
|
|
@@ -1126,24 +1243,24 @@ function ia({
|
|
|
1126
1243
|
] });
|
|
1127
1244
|
}
|
|
1128
1245
|
export {
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1246
|
+
Mt as ArtifactRenderer,
|
|
1247
|
+
ga as AssistantPanel,
|
|
1248
|
+
Aa as MAKE_AI_ARTIFACT_KINDS,
|
|
1249
|
+
Ia as MAKE_AI_ARTIFACT_LIMITS,
|
|
1250
|
+
wa as MAKE_AI_ARTIFACT_SCHEMA_VERSION,
|
|
1251
|
+
w as MAKE_AI_CONVERSATION_LIMITS,
|
|
1252
|
+
_a as MakeAiAssistant,
|
|
1253
|
+
wt as appendUserMessage,
|
|
1254
|
+
It as createArtifactCapabilities,
|
|
1255
|
+
We as createArtifactTemplateRegistry,
|
|
1256
|
+
fe as createAssistantConversationState,
|
|
1257
|
+
Pt as createPlatformArtifactRegistry,
|
|
1258
|
+
ya as extendArtifactTemplateRegistry,
|
|
1259
|
+
z as formatArtifactValue,
|
|
1260
|
+
Na as parseArtifact,
|
|
1261
|
+
Nt as parseAssistantEvent,
|
|
1262
|
+
Ft as platformArtifactTemplates,
|
|
1263
|
+
ge as reduceAssistantEvent,
|
|
1264
|
+
At as resolveArtifactTemplate,
|
|
1265
|
+
Ma as validateArtifact
|
|
1149
1266
|
};
|