gz-research-assistant 0.1.0 → 0.1.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/README.md +102 -21
- package/dist/App-B12hd4tM.js +2524 -0
- package/dist/App-B12hd4tM.js.map +1 -0
- package/dist/App.d.ts +12 -0
- package/dist/api/automation.d.ts +12 -0
- package/dist/{knowledge.d.ts → api/knowledge.d.ts} +1 -1
- package/dist/components/AssistantAvatar/index.d.ts +3 -0
- package/dist/core.d.ts +4 -4
- package/dist/core.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/pages/assistant/components/AgentPanel/index.d.ts +5 -0
- package/dist/{automation/AssertionEditor.d.ts → pages/assistant/components/AssertionEditor/index.d.ts} +1 -1
- package/dist/{PerformancePanel.d.ts → pages/assistant/components/PerformancePanel/index.d.ts} +1 -1
- package/dist/{automation/StepSupplement.d.ts → pages/assistant/components/StepSupplement/index.d.ts} +1 -1
- package/dist/{TimelinePanel.d.ts → pages/assistant/components/TimelinePanel/index.d.ts} +1 -1
- package/dist/{ResearchAssistant.d.ts → pages/assistant/index.d.ts} +0 -1
- package/dist/{recorder-Da1VSLid.js → recorder-ClSMnnGL.js} +67 -59
- package/dist/recorder-ClSMnnGL.js.map +1 -0
- package/dist/sdk.d.ts +6 -3
- package/dist/sdk.js +27 -9
- package/dist/sdk.js.map +1 -1
- package/dist/style.css +1 -10
- package/dist/{automation → utils/automation}/timeline-case.d.ts +1 -1
- package/dist/{runtime.d.ts → utils/diagnostics/runtime.d.ts} +1 -0
- package/package.json +2 -2
- package/dist/AssistantAvatar.d.ts +0 -1
- package/dist/ResearchAssistant-DAsgcwcG.js +0 -1757
- package/dist/ResearchAssistant-DAsgcwcG.js.map +0 -1
- package/dist/recorder-Da1VSLid.js.map +0 -1
- /package/dist/{FloatingPanel.d.ts → layouts/FloatingPanel/index.d.ts} +0 -0
- /package/dist/{useOverlayScrollbars.d.ts → layouts/FloatingPanel/useOverlayScrollbars.d.ts} +0 -0
- /package/dist/{automation/AutomationPanel.d.ts → pages/assistant/components/AutomationPanel/index.d.ts} +0 -0
- /package/dist/{automation → utils/automation}/recorder.d.ts +0 -0
- /package/dist/{automation → utils/automation}/schema.d.ts +0 -0
- /package/dist/{performance.d.ts → utils/diagnostics/performance.d.ts} +0 -0
- /package/dist/{privacy.d.ts → utils/diagnostics/privacy.d.ts} +0 -0
- /package/dist/{snapshot.d.ts → utils/diagnostics/snapshot.d.ts} +0 -0
|
@@ -0,0 +1,2524 @@
|
|
|
1
|
+
import { a as e, d as t, f as n, i as r, l as i, m as a, n as o, o as s, p as c, r as l, s as u, t as d, u as f } from "./recorder-ClSMnnGL.js";
|
|
2
|
+
import { useEffect as p, useId as m, useMemo as h, useRef as g, useState as _, useSyncExternalStore as v } from "react";
|
|
3
|
+
import { Alert as y, Badge as b, Button as x, Card as S, Checkbox as C, Collapse as w, ConfigProvider as ee, Empty as T, Input as E, InputNumber as D, Select as O, Tabs as k, Tag as A, Tooltip as j, Upload as M, getDesignTokenCssVariables as te } from "@chenhui996/gg-ui";
|
|
4
|
+
import { ApiOutlined as ne, BulbOutlined as re, CameraOutlined as ie, CheckCircleOutlined as N, CheckOutlined as ae, ClockCircleOutlined as P, CloseOutlined as oe, CodeOutlined as se, DashboardOutlined as ce, DeleteOutlined as le, DesktopOutlined as ue, DownloadOutlined as de, EditOutlined as fe, ExperimentOutlined as pe, FieldTimeOutlined as me, FileAddOutlined as he, FileTextOutlined as F, FlagOutlined as I, FolderOpenOutlined as ge, FullscreenExitOutlined as _e, FullscreenOutlined as ve, HistoryOutlined as ye, InfoCircleOutlined as L, LineChartOutlined as be, LinkOutlined as xe, MessageOutlined as Se, MinusOutlined as R, PauseOutlined as Ce, PlayCircleOutlined as we, PlusOutlined as Te, ReadOutlined as Ee, SafetyCertificateOutlined as De, SaveOutlined as Oe, ScissorOutlined as z, SearchOutlined as ke, StopOutlined as Ae, UploadOutlined as je, VideoCameraOutlined as Me, WarningOutlined as Ne } from "@ant-design/icons";
|
|
5
|
+
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
6
|
+
import { OverlayScrollbars as Pe } from "overlayscrollbars";
|
|
7
|
+
//#region \0rolldown/runtime.js
|
|
8
|
+
var U = Object.defineProperty, Fe = Object.getOwnPropertyDescriptor, W = Object.getOwnPropertyNames, Ie = Object.prototype.hasOwnProperty, Le = (e, t) => {
|
|
9
|
+
let n = {};
|
|
10
|
+
for (var r in e) U(n, r, {
|
|
11
|
+
get: e[r],
|
|
12
|
+
enumerable: !0
|
|
13
|
+
});
|
|
14
|
+
return t || U(n, Symbol.toStringTag, { value: "Module" }), n;
|
|
15
|
+
}, Re = (e, t, n, r) => {
|
|
16
|
+
if (t && typeof t == "object" || typeof t == "function") for (var i = W(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !Ie.call(e, s) && s !== n && U(e, s, {
|
|
17
|
+
get: ((e) => t[e]).bind(null, s),
|
|
18
|
+
enumerable: !(r = Fe(t, s)) || r.enumerable
|
|
19
|
+
});
|
|
20
|
+
return e;
|
|
21
|
+
}, ze = (e, t, n) => (Re(e, t, "default"), n && Re(n, t, "default")), Be = { scope: "_scope_tudpr_1" }, G = {
|
|
22
|
+
dock: "_dock_1oo1i_1",
|
|
23
|
+
launcher: "_launcher_1oo1i_12",
|
|
24
|
+
launcherAvatar: "_launcherAvatar_1oo1i_34",
|
|
25
|
+
srOnly: "_srOnly_1oo1i_41",
|
|
26
|
+
body: "_body_1oo1i_49",
|
|
27
|
+
toolbar: "_toolbar_1oo1i_56",
|
|
28
|
+
paused: "_paused_1oo1i_78",
|
|
29
|
+
sources: "_sources_1oo1i_85",
|
|
30
|
+
mainTabs: "_mainTabs_1oo1i_102",
|
|
31
|
+
diagnosticTabs: "_diagnosticTabs_1oo1i_137",
|
|
32
|
+
section: "_section_1oo1i_170",
|
|
33
|
+
json: "_json_1oo1i_174",
|
|
34
|
+
intro: "_intro_1oo1i_211",
|
|
35
|
+
eyebrow: "_eyebrow_1oo1i_226",
|
|
36
|
+
label: "_label_1oo1i_234",
|
|
37
|
+
actions: "_actions_1oo1i_239",
|
|
38
|
+
hint: "_hint_1oo1i_243",
|
|
39
|
+
stats: "_stats_1oo1i_249",
|
|
40
|
+
hasErrors: "_hasErrors_1oo1i_281",
|
|
41
|
+
buttonRow: "_buttonRow_1oo1i_297",
|
|
42
|
+
eventMeta: "_eventMeta_1oo1i_298",
|
|
43
|
+
stepHeading: "_stepHeading_1oo1i_299",
|
|
44
|
+
cardHeading: "_cardHeading_1oo1i_300",
|
|
45
|
+
requestMeta: "_requestMeta_1oo1i_301",
|
|
46
|
+
statLabel: "_statLabel_1oo1i_302",
|
|
47
|
+
subheading: "_subheading_1oo1i_303",
|
|
48
|
+
sectionHeading: "_sectionHeading_1oo1i_328",
|
|
49
|
+
headingIcon: "_headingIcon_1oo1i_351",
|
|
50
|
+
field: "_field_1oo1i_364",
|
|
51
|
+
formStack: "_formStack_1oo1i_365",
|
|
52
|
+
card: "_card_1oo1i_300",
|
|
53
|
+
request: "_request_1oo1i_301",
|
|
54
|
+
requestUrl: "_requestUrl_1oo1i_431",
|
|
55
|
+
toolbarActions: "_toolbarActions_1oo1i_448"
|
|
56
|
+
}, K = {
|
|
57
|
+
formStack: "_formStack_175v2_1 _formStack_17elq_367",
|
|
58
|
+
subheading: "_subheading_175v2_4 _subheading_17elq_305",
|
|
59
|
+
json: "_json_175v2_7 _json_17elq_174",
|
|
60
|
+
stepHeading: "_stepHeading_175v2_10 _stepHeading_17elq_301",
|
|
61
|
+
field: "_field_175v2_13 _field_17elq_366",
|
|
62
|
+
hint: "_hint_175v2_16 _hint_17elq_243",
|
|
63
|
+
buttonRow: "_buttonRow_175v2_19 _buttonRow_17elq_299",
|
|
64
|
+
cardHeading: "_cardHeading_175v2_22 _cardHeading_17elq_302",
|
|
65
|
+
card: "_card_175v2_22 _card_17elq_302",
|
|
66
|
+
headingIcon: "_headingIcon_175v2_28 _headingIcon_17elq_353",
|
|
67
|
+
sectionHeading: "_sectionHeading_175v2_31 _sectionHeading_17elq_330",
|
|
68
|
+
section: "_section_175v2_31 _section_17elq_170",
|
|
69
|
+
caseSteps: "_caseSteps_175v2_37",
|
|
70
|
+
upload: "_upload_175v2_40",
|
|
71
|
+
delayRow: "_delayRow_175v2_79",
|
|
72
|
+
automationLayout: "_automationLayout_175v2_82",
|
|
73
|
+
cardActions: "_cardActions_175v2_89",
|
|
74
|
+
checkpointRow: "_checkpointRow_175v2_93",
|
|
75
|
+
stepNumber: "_stepNumber_175v2_119",
|
|
76
|
+
stepActions: "_stepActions_175v2_124",
|
|
77
|
+
savedCase: "_savedCase_175v2_127",
|
|
78
|
+
help: "_help_175v2_136",
|
|
79
|
+
emptySteps: "_emptySteps_175v2_148",
|
|
80
|
+
assertionArea: "_assertionArea_175v2_174",
|
|
81
|
+
assertionResults: "_assertionResults_175v2_175",
|
|
82
|
+
assertionResult: "_assertionResult_175v2_175",
|
|
83
|
+
assertionSummary: "_assertionSummary_175v2_202"
|
|
84
|
+
}, q = /* @__PURE__ */ Le({});
|
|
85
|
+
import * as Ve from "gz-laya-pilot/schema";
|
|
86
|
+
ze(q, Ve);
|
|
87
|
+
var J = {
|
|
88
|
+
buttonRow: "_buttonRow_gry3r_1 _buttonRow_17elq_299",
|
|
89
|
+
field: "_field_gry3r_4 _field_17elq_366",
|
|
90
|
+
hint: "_hint_gry3r_7 _hint_17elq_243",
|
|
91
|
+
subheading: "_subheading_gry3r_10 _subheading_17elq_305",
|
|
92
|
+
formStack: "_formStack_gry3r_13 _formStack_17elq_367",
|
|
93
|
+
assertionEditor: "_assertionEditor_gry3r_16",
|
|
94
|
+
assertionFields: "_assertionFields_gry3r_29"
|
|
95
|
+
};
|
|
96
|
+
//#endregion
|
|
97
|
+
//#region src/pages/assistant/components/AssertionEditor/index.tsx
|
|
98
|
+
function He({ initial: e, steps: t, position: n, disabled: r, onSave: i, onCancel: a }) {
|
|
99
|
+
let o = m(), [s, c] = _(e ?? {
|
|
100
|
+
name: "",
|
|
101
|
+
source: "page-text",
|
|
102
|
+
operator: "contains",
|
|
103
|
+
expected: "",
|
|
104
|
+
timeout: 1e4
|
|
105
|
+
}), [l, u] = _(n), [d, f] = _(""), p = (e) => c((t) => ({
|
|
106
|
+
...t,
|
|
107
|
+
...e
|
|
108
|
+
}));
|
|
109
|
+
return /* @__PURE__ */ H("div", {
|
|
110
|
+
className: [J.assertionEditor, J.formStack].join(" "),
|
|
111
|
+
"data-assistant-part": "assertion-editor form-stack",
|
|
112
|
+
"aria-label": e ? "编辑断言配置" : "新增断言配置",
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ H("h3", {
|
|
115
|
+
className: J.subheading,
|
|
116
|
+
"data-assistant-part": "subheading",
|
|
117
|
+
children: [/* @__PURE__ */ V(N, {}), e ? "编辑断言" : "添加断言"]
|
|
118
|
+
}),
|
|
119
|
+
/* @__PURE__ */ V("p", {
|
|
120
|
+
className: J.hint,
|
|
121
|
+
"data-assistant-part": "hint",
|
|
122
|
+
children: "选择断言对象、比较条件和期望值。回放时在指定步骤后自动等待并校验。"
|
|
123
|
+
}),
|
|
124
|
+
/* @__PURE__ */ H("div", {
|
|
125
|
+
className: J.field,
|
|
126
|
+
"data-assistant-part": "field",
|
|
127
|
+
children: [/* @__PURE__ */ V("label", {
|
|
128
|
+
htmlFor: `${o}-name`,
|
|
129
|
+
children: "断言名称"
|
|
130
|
+
}), /* @__PURE__ */ V(E, {
|
|
131
|
+
id: `${o}-name`,
|
|
132
|
+
placeholder: "例如:保存后显示成功提示",
|
|
133
|
+
value: s.name,
|
|
134
|
+
maxLength: 100,
|
|
135
|
+
disabled: r,
|
|
136
|
+
onChange: (e) => p({ name: e.target.value })
|
|
137
|
+
})]
|
|
138
|
+
}),
|
|
139
|
+
!e && /* @__PURE__ */ H("div", {
|
|
140
|
+
className: J.field,
|
|
141
|
+
"data-assistant-part": "field",
|
|
142
|
+
children: [/* @__PURE__ */ V("label", {
|
|
143
|
+
htmlFor: `${o}-position`,
|
|
144
|
+
children: "执行位置"
|
|
145
|
+
}), /* @__PURE__ */ V(O, {
|
|
146
|
+
id: `${o}-position`,
|
|
147
|
+
value: l,
|
|
148
|
+
disabled: r,
|
|
149
|
+
onChange: u,
|
|
150
|
+
options: [{
|
|
151
|
+
value: 0,
|
|
152
|
+
label: "所有步骤之前"
|
|
153
|
+
}, ...t.map((e, t) => ({
|
|
154
|
+
value: t + 1,
|
|
155
|
+
label: `第 ${t + 1} 步之后 · ${e.assertion?.name ?? e.target?.label ?? e.value ?? e.kind}`
|
|
156
|
+
}))]
|
|
157
|
+
})]
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ H("div", {
|
|
160
|
+
className: J.assertionFields,
|
|
161
|
+
"data-assistant-part": "assertion-fields",
|
|
162
|
+
children: [/* @__PURE__ */ H("div", {
|
|
163
|
+
className: J.field,
|
|
164
|
+
"data-assistant-part": "field",
|
|
165
|
+
children: [/* @__PURE__ */ V("label", {
|
|
166
|
+
htmlFor: `${o}-source`,
|
|
167
|
+
children: "断言对象"
|
|
168
|
+
}), /* @__PURE__ */ V(O, {
|
|
169
|
+
id: `${o}-source`,
|
|
170
|
+
value: s.source,
|
|
171
|
+
disabled: r,
|
|
172
|
+
options: Object.entries(q.assertionSources).map(([e, t]) => ({
|
|
173
|
+
value: e,
|
|
174
|
+
label: t
|
|
175
|
+
})),
|
|
176
|
+
onChange: (e) => p({
|
|
177
|
+
source: e,
|
|
178
|
+
operator: (0, q.operatorsFor)(e)[0],
|
|
179
|
+
expected: e === "element-count" ? "1" : "",
|
|
180
|
+
selector: s.selector ?? ""
|
|
181
|
+
})
|
|
182
|
+
})]
|
|
183
|
+
}), /* @__PURE__ */ H("div", {
|
|
184
|
+
className: J.field,
|
|
185
|
+
"data-assistant-part": "field",
|
|
186
|
+
children: [/* @__PURE__ */ V("label", {
|
|
187
|
+
htmlFor: `${o}-operator`,
|
|
188
|
+
children: "比较条件"
|
|
189
|
+
}), /* @__PURE__ */ V(O, {
|
|
190
|
+
id: `${o}-operator`,
|
|
191
|
+
value: s.operator,
|
|
192
|
+
disabled: r,
|
|
193
|
+
onChange: (e) => p({ operator: e }),
|
|
194
|
+
options: (0, q.operatorsFor)(s.source).map((e) => ({
|
|
195
|
+
value: e,
|
|
196
|
+
label: q.assertionOperators[e]
|
|
197
|
+
}))
|
|
198
|
+
})]
|
|
199
|
+
})]
|
|
200
|
+
}),
|
|
201
|
+
s.source !== "page-text" && /* @__PURE__ */ H("div", {
|
|
202
|
+
className: J.field,
|
|
203
|
+
"data-assistant-part": "field",
|
|
204
|
+
children: [
|
|
205
|
+
/* @__PURE__ */ V("label", {
|
|
206
|
+
htmlFor: `${o}-selector`,
|
|
207
|
+
children: "元素定位(CSS)"
|
|
208
|
+
}),
|
|
209
|
+
/* @__PURE__ */ V(E, {
|
|
210
|
+
id: `${o}-selector`,
|
|
211
|
+
value: s.selector,
|
|
212
|
+
maxLength: 2e3,
|
|
213
|
+
placeholder: "例如:[data-testid=\"save-result\"]",
|
|
214
|
+
disabled: r,
|
|
215
|
+
onChange: (e) => p({ selector: e.target.value })
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ V("p", {
|
|
218
|
+
className: J.hint,
|
|
219
|
+
"data-assistant-part": "hint",
|
|
220
|
+
children: "可从步骤的“定位信息”复制。文字、值和可见性要求唯一元素;数量支持匹配多个元素。"
|
|
221
|
+
})
|
|
222
|
+
]
|
|
223
|
+
}),
|
|
224
|
+
s.source !== "element-state" && /* @__PURE__ */ H("div", {
|
|
225
|
+
className: J.field,
|
|
226
|
+
"data-assistant-part": "field",
|
|
227
|
+
children: [/* @__PURE__ */ V("label", {
|
|
228
|
+
htmlFor: `${o}-expected`,
|
|
229
|
+
children: "期望值"
|
|
230
|
+
}), /* @__PURE__ */ V(E, {
|
|
231
|
+
id: `${o}-expected`,
|
|
232
|
+
value: s.expected,
|
|
233
|
+
maxLength: 2e3,
|
|
234
|
+
placeholder: s.source === "element-count" ? "例如:1" : "输入期望内容",
|
|
235
|
+
disabled: r,
|
|
236
|
+
onChange: (e) => p({ expected: e.target.value })
|
|
237
|
+
})]
|
|
238
|
+
}),
|
|
239
|
+
/* @__PURE__ */ H("div", {
|
|
240
|
+
className: J.field,
|
|
241
|
+
"data-assistant-part": "field",
|
|
242
|
+
children: [/* @__PURE__ */ V("label", {
|
|
243
|
+
htmlFor: `${o}-timeout`,
|
|
244
|
+
children: "最长等待时间(毫秒)"
|
|
245
|
+
}), /* @__PURE__ */ V(D, {
|
|
246
|
+
id: `${o}-timeout`,
|
|
247
|
+
min: 500,
|
|
248
|
+
max: 3e4,
|
|
249
|
+
step: 500,
|
|
250
|
+
value: s.timeout,
|
|
251
|
+
disabled: r,
|
|
252
|
+
onChange: (e) => p({ timeout: e ?? 1e4 })
|
|
253
|
+
})]
|
|
254
|
+
}),
|
|
255
|
+
d && /* @__PURE__ */ V(y, {
|
|
256
|
+
showIcon: !0,
|
|
257
|
+
type: "error",
|
|
258
|
+
title: d
|
|
259
|
+
}),
|
|
260
|
+
/* @__PURE__ */ H("div", {
|
|
261
|
+
className: J.buttonRow,
|
|
262
|
+
"data-assistant-part": "button-row",
|
|
263
|
+
children: [/* @__PURE__ */ V(x, {
|
|
264
|
+
icon: /* @__PURE__ */ V(Oe, {}),
|
|
265
|
+
type: "primary",
|
|
266
|
+
disabled: r,
|
|
267
|
+
onClick: () => {
|
|
268
|
+
try {
|
|
269
|
+
let e = (0, q.parseAssertion)(s);
|
|
270
|
+
if (e.selector) try {
|
|
271
|
+
document.querySelector(e.selector);
|
|
272
|
+
} catch {
|
|
273
|
+
throw Error("CSS 定位语法无效,请检查后再保存");
|
|
274
|
+
}
|
|
275
|
+
i(e, Math.min(l, t.length));
|
|
276
|
+
} catch (e) {
|
|
277
|
+
f(e instanceof Error ? e.message : "断言配置无效");
|
|
278
|
+
}
|
|
279
|
+
},
|
|
280
|
+
children: "保存断言"
|
|
281
|
+
}), /* @__PURE__ */ V(x, {
|
|
282
|
+
onClick: a,
|
|
283
|
+
children: "取消"
|
|
284
|
+
})]
|
|
285
|
+
})
|
|
286
|
+
]
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
var Ue = {
|
|
290
|
+
field: "_field_1qtxy_1 _field_17elq_366",
|
|
291
|
+
formStack: "_formStack_1qtxy_4 _formStack_17elq_367",
|
|
292
|
+
hint: "_hint_1qtxy_7 _hint_17elq_243",
|
|
293
|
+
supplement: "_supplement_1qtxy_10"
|
|
294
|
+
};
|
|
295
|
+
//#endregion
|
|
296
|
+
//#region src/pages/assistant/components/StepSupplement/index.tsx
|
|
297
|
+
function We({ step: e, disabled: t, onApply: n }) {
|
|
298
|
+
let r = m(), [i, a] = _("click"), [o, s] = _(""), [c, l] = _(""), [u, d] = _(""), [f, p] = _(!0), [h, g] = _("");
|
|
299
|
+
return /* @__PURE__ */ V(w, {
|
|
300
|
+
className: Ue.supplement,
|
|
301
|
+
"data-assistant-part": "supplement",
|
|
302
|
+
ghost: !0,
|
|
303
|
+
size: "small",
|
|
304
|
+
styles: {
|
|
305
|
+
header: {
|
|
306
|
+
padding: 0,
|
|
307
|
+
fontSize: 12,
|
|
308
|
+
lineHeight: "inherit"
|
|
309
|
+
},
|
|
310
|
+
body: { padding: "8px 0 0" }
|
|
311
|
+
},
|
|
312
|
+
items: [{
|
|
313
|
+
key: "details",
|
|
314
|
+
label: /* @__PURE__ */ V(B, { children: "补充为可执行步骤" }),
|
|
315
|
+
children: /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("p", {
|
|
316
|
+
className: Ue.hint,
|
|
317
|
+
"data-assistant-part": "hint",
|
|
318
|
+
children: "人工补充不会修改原始事件。填写业务控件的 CSS 定位与文字;不清楚定位时,可退出选段后重新主动录制。"
|
|
319
|
+
}), /* @__PURE__ */ H("div", {
|
|
320
|
+
className: Ue.formStack,
|
|
321
|
+
"data-assistant-part": "form-stack",
|
|
322
|
+
children: [
|
|
323
|
+
/* @__PURE__ */ H("div", {
|
|
324
|
+
className: Ue.field,
|
|
325
|
+
"data-assistant-part": "field",
|
|
326
|
+
children: [/* @__PURE__ */ V("label", {
|
|
327
|
+
htmlFor: r,
|
|
328
|
+
children: "操作类型"
|
|
329
|
+
}), /* @__PURE__ */ V(O, {
|
|
330
|
+
id: r,
|
|
331
|
+
"aria-label": "补充操作类型",
|
|
332
|
+
value: i,
|
|
333
|
+
disabled: t,
|
|
334
|
+
onChange: a,
|
|
335
|
+
style: { width: "100%" },
|
|
336
|
+
options: [
|
|
337
|
+
{
|
|
338
|
+
value: "click",
|
|
339
|
+
label: "点击"
|
|
340
|
+
},
|
|
341
|
+
{
|
|
342
|
+
value: "fill",
|
|
343
|
+
label: "输入"
|
|
344
|
+
},
|
|
345
|
+
{
|
|
346
|
+
value: "select",
|
|
347
|
+
label: "原生下拉选择"
|
|
348
|
+
},
|
|
349
|
+
{
|
|
350
|
+
value: "check",
|
|
351
|
+
label: "勾选"
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
value: "press",
|
|
355
|
+
label: "按键"
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
value: "assert-text",
|
|
359
|
+
label: "文字检查点"
|
|
360
|
+
}
|
|
361
|
+
]
|
|
362
|
+
})]
|
|
363
|
+
}),
|
|
364
|
+
i !== "assert-text" && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(E, {
|
|
365
|
+
prefix: /* @__PURE__ */ V(se, {}),
|
|
366
|
+
"aria-label": "补充 CSS 定位",
|
|
367
|
+
placeholder: "例如 button[aria-label=\"展开\"]",
|
|
368
|
+
maxLength: 2e3,
|
|
369
|
+
value: o,
|
|
370
|
+
disabled: t,
|
|
371
|
+
onChange: (e) => s(e.target.value)
|
|
372
|
+
}), /* @__PURE__ */ V(E, {
|
|
373
|
+
prefix: /* @__PURE__ */ V(fe, {}),
|
|
374
|
+
"aria-label": "补充控件文字",
|
|
375
|
+
placeholder: "控件文字、aria-label 或输入框 placeholder",
|
|
376
|
+
maxLength: 200,
|
|
377
|
+
value: c,
|
|
378
|
+
disabled: t,
|
|
379
|
+
onChange: (e) => l(e.target.value)
|
|
380
|
+
})] }),
|
|
381
|
+
[
|
|
382
|
+
"fill",
|
|
383
|
+
"select",
|
|
384
|
+
"press",
|
|
385
|
+
"assert-text"
|
|
386
|
+
].includes(i) && /* @__PURE__ */ V(E, {
|
|
387
|
+
"aria-label": "补充步骤内容",
|
|
388
|
+
placeholder: i === "press" ? "Enter / Escape / Tab" : "输入值或预期文字",
|
|
389
|
+
maxLength: 2e3,
|
|
390
|
+
value: u,
|
|
391
|
+
disabled: t,
|
|
392
|
+
onChange: (e) => d(e.target.value)
|
|
393
|
+
}),
|
|
394
|
+
i === "check" && /* @__PURE__ */ V(C, {
|
|
395
|
+
checked: f,
|
|
396
|
+
disabled: t,
|
|
397
|
+
onChange: (e) => p(e.target.checked),
|
|
398
|
+
children: "选中"
|
|
399
|
+
}),
|
|
400
|
+
/* @__PURE__ */ V(x, {
|
|
401
|
+
icon: /* @__PURE__ */ V(ae, {}),
|
|
402
|
+
disabled: t,
|
|
403
|
+
onClick: () => {
|
|
404
|
+
try {
|
|
405
|
+
if (i !== "assert-text") {
|
|
406
|
+
if (!o.trim() || !c.trim()) throw Error("请补充定位及控件文字");
|
|
407
|
+
document.querySelector(o);
|
|
408
|
+
}
|
|
409
|
+
if (i === "assert-text" && !u.trim()) throw Error("检查点文字不能为空");
|
|
410
|
+
if (i === "press" && ![
|
|
411
|
+
"Enter",
|
|
412
|
+
"Escape",
|
|
413
|
+
"Tab"
|
|
414
|
+
].includes(u)) throw Error("请选择支持的按键");
|
|
415
|
+
n({
|
|
416
|
+
kind: i,
|
|
417
|
+
supplemented: !0,
|
|
418
|
+
...e.sourceEventId ? { sourceEventId: e.sourceEventId } : {},
|
|
419
|
+
...i === "assert-text" ? {} : { target: {
|
|
420
|
+
selector: o.trim(),
|
|
421
|
+
label: c.trim()
|
|
422
|
+
} },
|
|
423
|
+
...[
|
|
424
|
+
"fill",
|
|
425
|
+
"select",
|
|
426
|
+
"press",
|
|
427
|
+
"assert-text"
|
|
428
|
+
].includes(i) ? { value: u } : {},
|
|
429
|
+
...i === "check" ? { checked: f } : {}
|
|
430
|
+
}), g("");
|
|
431
|
+
} catch (e) {
|
|
432
|
+
g(e instanceof Error ? e.message : "内容无效");
|
|
433
|
+
}
|
|
434
|
+
},
|
|
435
|
+
children: "应用补充"
|
|
436
|
+
}),
|
|
437
|
+
h && /* @__PURE__ */ V("span", {
|
|
438
|
+
role: "alert",
|
|
439
|
+
children: h
|
|
440
|
+
})
|
|
441
|
+
]
|
|
442
|
+
})] })
|
|
443
|
+
}]
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
//#endregion
|
|
447
|
+
//#region src/api/automation.ts
|
|
448
|
+
async function Ge(e, t, n) {
|
|
449
|
+
let r = await fetch(`${e.replace(/\/$/, "")}/agent/${t}`, n === void 0 ? {} : {
|
|
450
|
+
method: "POST",
|
|
451
|
+
headers: {
|
|
452
|
+
"Content-Type": "application/json",
|
|
453
|
+
"X-Laya-Pilot": "agent-v1"
|
|
454
|
+
},
|
|
455
|
+
body: JSON.stringify(n)
|
|
456
|
+
});
|
|
457
|
+
if (!r.headers.get("content-type")?.includes("application/json")) throw Error("自主探索服务未连接");
|
|
458
|
+
let i = await r.json();
|
|
459
|
+
if (!r.ok) throw Error(i.message || "自主探索服务不可用");
|
|
460
|
+
if (!Array.isArray(i.cases) || ![
|
|
461
|
+
"idle",
|
|
462
|
+
"running",
|
|
463
|
+
"passed",
|
|
464
|
+
"partial",
|
|
465
|
+
"failed",
|
|
466
|
+
"stopped"
|
|
467
|
+
].includes(i.state)) throw Error("自主探索服务版本不匹配");
|
|
468
|
+
return i;
|
|
469
|
+
}
|
|
470
|
+
var Ke = (e, t, n) => `${e.replace(/\/$/, "")}/agent/artifact?${new URLSearchParams({
|
|
471
|
+
id: t,
|
|
472
|
+
file: n
|
|
473
|
+
})}`;
|
|
474
|
+
async function qe(e, t, n) {
|
|
475
|
+
let r = await fetch(`${e.replace(/\/$/, "")}/${t}`, n === void 0 ? {} : {
|
|
476
|
+
method: "POST",
|
|
477
|
+
headers: {
|
|
478
|
+
"Content-Type": "application/json",
|
|
479
|
+
"X-Laya-Pilot": "recorded-case-v1"
|
|
480
|
+
},
|
|
481
|
+
body: JSON.stringify(n)
|
|
482
|
+
});
|
|
483
|
+
if (!r.headers.get("content-type")?.includes("application/json")) throw Error("回放服务未连接,请检查宿主配置的服务地址");
|
|
484
|
+
let i = await r.json();
|
|
485
|
+
if (!r.ok) throw Error(i.message || "本地回放服务不可用");
|
|
486
|
+
return i;
|
|
487
|
+
}
|
|
488
|
+
var Y = {
|
|
489
|
+
card: "_card_1ixz9_1 _card_17elq_302",
|
|
490
|
+
cardHeading: "_cardHeading_1ixz9_6 _cardHeading_17elq_302",
|
|
491
|
+
buttonRow: "_buttonRow_1ixz9_9 _buttonRow_17elq_299",
|
|
492
|
+
field: "_field_1ixz9_12 _field_17elq_366",
|
|
493
|
+
hint: "_hint_1ixz9_15 _hint_17elq_243",
|
|
494
|
+
stack: "_stack_1ixz9_18",
|
|
495
|
+
caseHeading: "_caseHeading_1ixz9_25"
|
|
496
|
+
}, Je = {
|
|
497
|
+
idle: "待探索",
|
|
498
|
+
running: "执行中",
|
|
499
|
+
passed: "全部通过",
|
|
500
|
+
partial: "部分完成",
|
|
501
|
+
failed: "执行失败",
|
|
502
|
+
stopped: "已停止"
|
|
503
|
+
}, Ye = {
|
|
504
|
+
passed: "通过",
|
|
505
|
+
failed: "失败",
|
|
506
|
+
skipped: "未执行"
|
|
507
|
+
}, Xe = {
|
|
508
|
+
state: "idle",
|
|
509
|
+
mode: "explore",
|
|
510
|
+
message: "选择后台页面即可探索,无需录制或编写步骤。",
|
|
511
|
+
cases: [],
|
|
512
|
+
decisions: 0
|
|
513
|
+
};
|
|
514
|
+
function Ze({ bridgeUrl: e, disabled: t, onRunningChange: n }) {
|
|
515
|
+
let [r, i] = _(Xe), [a, o] = _(), [s, c] = _(""), [l, u] = _(!1), [d, f] = _(!1), [m, h] = _(""), [g, v] = _(!1), [b, ee] = _();
|
|
516
|
+
p(() => {
|
|
517
|
+
let t = !1, r, a = async () => {
|
|
518
|
+
try {
|
|
519
|
+
let r = await Ge(e, "status");
|
|
520
|
+
t || (v(!0), i(r), o(r.capabilities), n(r.state === "running"), c((e) => e || r.capabilities?.targets[0] || ""));
|
|
521
|
+
} catch {
|
|
522
|
+
t || v(!1);
|
|
523
|
+
} finally {
|
|
524
|
+
t || (r = setTimeout(a, 1500));
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
return a(), () => {
|
|
528
|
+
t = !0, clearTimeout(r);
|
|
529
|
+
};
|
|
530
|
+
}, [e, n]);
|
|
531
|
+
let T = d || r.state === "running", E = async (t) => {
|
|
532
|
+
f(!0), h("");
|
|
533
|
+
try {
|
|
534
|
+
let r = await Ge(e, t, {
|
|
535
|
+
url: s,
|
|
536
|
+
allowWrite: l,
|
|
537
|
+
...t === "replay" ? { workbook: b?.data } : {}
|
|
538
|
+
});
|
|
539
|
+
i(r), n(r.state === "running");
|
|
540
|
+
} catch (e) {
|
|
541
|
+
h(e instanceof Error ? e.message : "无法启动测试");
|
|
542
|
+
} finally {
|
|
543
|
+
f(!1);
|
|
544
|
+
}
|
|
545
|
+
}, D = (t, n) => r.id && /* @__PURE__ */ V(x, {
|
|
546
|
+
icon: /* @__PURE__ */ V(de, {}),
|
|
547
|
+
href: Ke(e, r.id, t),
|
|
548
|
+
children: n
|
|
549
|
+
});
|
|
550
|
+
return /* @__PURE__ */ H(S, {
|
|
551
|
+
className: Y.card,
|
|
552
|
+
"aria-label": "自主探索",
|
|
553
|
+
"data-assistant-part": "agent-card",
|
|
554
|
+
styles: { body: {
|
|
555
|
+
padding: 0,
|
|
556
|
+
display: "flex",
|
|
557
|
+
flexDirection: "column",
|
|
558
|
+
gap: 16
|
|
559
|
+
} },
|
|
560
|
+
children: [
|
|
561
|
+
/* @__PURE__ */ H("div", {
|
|
562
|
+
className: Y.cardHeading,
|
|
563
|
+
children: [/* @__PURE__ */ H("h3", { children: [/* @__PURE__ */ V(pe, {}), "自主探索"] }), /* @__PURE__ */ V(A, {
|
|
564
|
+
color: T ? "processing" : r.state === "passed" ? "success" : "default",
|
|
565
|
+
children: Je[r.state]
|
|
566
|
+
})]
|
|
567
|
+
}),
|
|
568
|
+
/* @__PURE__ */ V("p", {
|
|
569
|
+
className: Y.hint,
|
|
570
|
+
children: "Laya 识别页面控件,Playwright 实际探索并验证,生成带断言的 Excel 用例,再用新浏览器会话回放。"
|
|
571
|
+
}),
|
|
572
|
+
g ? !a?.configured && /* @__PURE__ */ V(y, {
|
|
573
|
+
type: "info",
|
|
574
|
+
title: a?.message ?? "模型尚未配置"
|
|
575
|
+
}) : /* @__PURE__ */ V(y, {
|
|
576
|
+
type: "info",
|
|
577
|
+
title: "自主探索服务未连接,请启动宿主的 Laya 服务。"
|
|
578
|
+
}),
|
|
579
|
+
/* @__PURE__ */ H("div", {
|
|
580
|
+
className: Y.field,
|
|
581
|
+
children: [/* @__PURE__ */ V("span", { children: "测试页面" }), /* @__PURE__ */ V(O, {
|
|
582
|
+
"aria-label": "自主探索测试页面",
|
|
583
|
+
placeholder: "选择宿主已配置的后台地址",
|
|
584
|
+
showSearch: !0,
|
|
585
|
+
value: s || void 0,
|
|
586
|
+
disabled: T || t,
|
|
587
|
+
onChange: c,
|
|
588
|
+
options: a?.targets.map((e) => ({
|
|
589
|
+
label: e,
|
|
590
|
+
value: e
|
|
591
|
+
})) ?? []
|
|
592
|
+
})]
|
|
593
|
+
}),
|
|
594
|
+
/* @__PURE__ */ V(C, {
|
|
595
|
+
disabled: T || t,
|
|
596
|
+
checked: l,
|
|
597
|
+
onChange: (e) => u(e.target.checked),
|
|
598
|
+
children: "允许创建、修改和删除本轮测试数据"
|
|
599
|
+
}),
|
|
600
|
+
/* @__PURE__ */ H("div", {
|
|
601
|
+
className: Y.buttonRow,
|
|
602
|
+
children: [/* @__PURE__ */ V(x, {
|
|
603
|
+
type: "primary",
|
|
604
|
+
icon: /* @__PURE__ */ V(pe, {}),
|
|
605
|
+
disabled: T || t || !s || !g || !a?.configured,
|
|
606
|
+
onClick: () => void E("explore"),
|
|
607
|
+
children: "开始自主探索"
|
|
608
|
+
}), /* @__PURE__ */ V(x, {
|
|
609
|
+
icon: /* @__PURE__ */ V(Ae, {}),
|
|
610
|
+
disabled: !T || d,
|
|
611
|
+
onClick: () => void E("stop"),
|
|
612
|
+
children: "停止"
|
|
613
|
+
})]
|
|
614
|
+
}),
|
|
615
|
+
/* @__PURE__ */ H("span", {
|
|
616
|
+
className: Y.hint,
|
|
617
|
+
children: [
|
|
618
|
+
r.message,
|
|
619
|
+
" ",
|
|
620
|
+
r.decisions > 0 && `· ${r.decisions} 次模型决策`
|
|
621
|
+
]
|
|
622
|
+
}),
|
|
623
|
+
m && /* @__PURE__ */ V(y, {
|
|
624
|
+
closable: !0,
|
|
625
|
+
type: "error",
|
|
626
|
+
title: m,
|
|
627
|
+
onClose: () => h("")
|
|
628
|
+
}),
|
|
629
|
+
/* @__PURE__ */ H("div", {
|
|
630
|
+
className: Y.buttonRow,
|
|
631
|
+
children: [
|
|
632
|
+
r.workbook && D(r.workbook, "下载 Excel 用例"),
|
|
633
|
+
r.id && !T && r.cases.length > 0 && D("results.xlsx", "下载执行报告"),
|
|
634
|
+
r.trace && D(r.trace, "下载 Trace")
|
|
635
|
+
]
|
|
636
|
+
}),
|
|
637
|
+
/* @__PURE__ */ V(w, {
|
|
638
|
+
size: "small",
|
|
639
|
+
items: [{
|
|
640
|
+
key: "replay",
|
|
641
|
+
label: "从 Excel 在新会话中回放",
|
|
642
|
+
children: /* @__PURE__ */ H("div", {
|
|
643
|
+
className: Y.stack,
|
|
644
|
+
children: [
|
|
645
|
+
/* @__PURE__ */ V("span", {
|
|
646
|
+
className: Y.hint,
|
|
647
|
+
children: "导入自主探索生成的 Excel。回放使用已保存的步骤和断言,文件中的入口需与所选后台一致。"
|
|
648
|
+
}),
|
|
649
|
+
/* @__PURE__ */ H("div", {
|
|
650
|
+
className: Y.buttonRow,
|
|
651
|
+
children: [/* @__PURE__ */ V(M, {
|
|
652
|
+
accept: ".xlsx",
|
|
653
|
+
maxCount: 1,
|
|
654
|
+
showUploadList: !1,
|
|
655
|
+
disabled: T || t,
|
|
656
|
+
beforeUpload: async (e) => {
|
|
657
|
+
try {
|
|
658
|
+
if (e.size > 2 * 1024 * 1024) throw Error("Excel 文件不能超过 2 MB");
|
|
659
|
+
let t = await new Promise((t, n) => {
|
|
660
|
+
let r = new FileReader();
|
|
661
|
+
r.onload = () => t(String(r.result).split(",")[1]), r.onerror = n, r.readAsDataURL(e);
|
|
662
|
+
});
|
|
663
|
+
ee({
|
|
664
|
+
name: e.name,
|
|
665
|
+
data: t
|
|
666
|
+
}), h("");
|
|
667
|
+
} catch (e) {
|
|
668
|
+
h(e instanceof Error ? e.message : "文件读取失败");
|
|
669
|
+
}
|
|
670
|
+
return !1;
|
|
671
|
+
},
|
|
672
|
+
children: /* @__PURE__ */ V(x, {
|
|
673
|
+
icon: /* @__PURE__ */ V(je, {}),
|
|
674
|
+
disabled: T || t,
|
|
675
|
+
children: "导入 Excel"
|
|
676
|
+
})
|
|
677
|
+
}), /* @__PURE__ */ V(x, {
|
|
678
|
+
icon: /* @__PURE__ */ V(we, {}),
|
|
679
|
+
disabled: T || t || !g || !a?.configured || !s || !b,
|
|
680
|
+
onClick: () => void E("replay"),
|
|
681
|
+
children: "新会话回放"
|
|
682
|
+
})]
|
|
683
|
+
}),
|
|
684
|
+
b && /* @__PURE__ */ V("span", { children: b.name })
|
|
685
|
+
]
|
|
686
|
+
})
|
|
687
|
+
}]
|
|
688
|
+
}),
|
|
689
|
+
r.cases.length > 0 && /* @__PURE__ */ V(w, {
|
|
690
|
+
size: "small",
|
|
691
|
+
items: r.cases.map((e) => ({
|
|
692
|
+
key: e.id,
|
|
693
|
+
label: /* @__PURE__ */ H("div", {
|
|
694
|
+
className: Y.caseHeading,
|
|
695
|
+
children: [/* @__PURE__ */ V(A, {
|
|
696
|
+
color: e.state === "passed" ? "success" : e.state === "failed" ? "error" : "default",
|
|
697
|
+
children: Ye[e.state]
|
|
698
|
+
}), /* @__PURE__ */ V("span", { children: e.title })]
|
|
699
|
+
}),
|
|
700
|
+
children: /* @__PURE__ */ H("div", {
|
|
701
|
+
className: Y.stack,
|
|
702
|
+
children: [
|
|
703
|
+
/* @__PURE__ */ V("span", { children: e.reason }),
|
|
704
|
+
e.assertions.map((e, t) => /* @__PURE__ */ V(y, {
|
|
705
|
+
type: e.passed ? "success" : "error",
|
|
706
|
+
title: e.expected,
|
|
707
|
+
description: `实际:${e.actual}`
|
|
708
|
+
}, t)),
|
|
709
|
+
e.errors.map((e, t) => /* @__PURE__ */ V(y, {
|
|
710
|
+
type: "error",
|
|
711
|
+
title: e
|
|
712
|
+
}, t)),
|
|
713
|
+
e.cleanup && /* @__PURE__ */ V("span", {
|
|
714
|
+
className: Y.hint,
|
|
715
|
+
children: e.cleanup
|
|
716
|
+
}),
|
|
717
|
+
e.screenshot && D(e.screenshot, "查看截图证据")
|
|
718
|
+
]
|
|
719
|
+
})
|
|
720
|
+
}))
|
|
721
|
+
})
|
|
722
|
+
]
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
//#endregion
|
|
726
|
+
//#region src/pages/assistant/components/AutomationPanel/index.tsx
|
|
727
|
+
var Qe = {
|
|
728
|
+
click: "点击",
|
|
729
|
+
fill: "输入",
|
|
730
|
+
select: "选择",
|
|
731
|
+
check: "勾选",
|
|
732
|
+
press: "按键",
|
|
733
|
+
"assert-text": "检查文字",
|
|
734
|
+
assert: "断言",
|
|
735
|
+
unsupported: "需要处理"
|
|
736
|
+
}, $e = {
|
|
737
|
+
state: "idle",
|
|
738
|
+
step: 0,
|
|
739
|
+
total: 0,
|
|
740
|
+
message: "尚未运行"
|
|
741
|
+
};
|
|
742
|
+
function et({ close: e, bridgeUrl: t }) {
|
|
743
|
+
let n = v(d.subscribe, d.getState), [r, i] = _(""), [a, o] = _(null), s = g(null), c = (e, t) => {
|
|
744
|
+
o({
|
|
745
|
+
position: e,
|
|
746
|
+
edit: t
|
|
747
|
+
}), requestAnimationFrame(() => s.current?.scrollIntoView({
|
|
748
|
+
behavior: "smooth",
|
|
749
|
+
block: "nearest"
|
|
750
|
+
}));
|
|
751
|
+
}, [l, u] = _($e), [f, m] = _(!1), [h, b] = _(!1), [C, ee] = _(!1), [T, O] = _(2e3);
|
|
752
|
+
p(() => {
|
|
753
|
+
let e = !1, n, r = async () => {
|
|
754
|
+
try {
|
|
755
|
+
let n = await qe(t, "status");
|
|
756
|
+
e || (u(n), m(n.available !== !1));
|
|
757
|
+
} catch {
|
|
758
|
+
e || m(!1);
|
|
759
|
+
} finally {
|
|
760
|
+
e || (n = setTimeout(r, 1500));
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
return r(), () => {
|
|
764
|
+
e = !0, clearTimeout(n);
|
|
765
|
+
};
|
|
766
|
+
}, [t]);
|
|
767
|
+
let k = h || l.state === "running" || C, j = async (e) => {
|
|
768
|
+
try {
|
|
769
|
+
i(""), await e();
|
|
770
|
+
} catch (e) {
|
|
771
|
+
i(e instanceof Error ? e.message : "操作失败");
|
|
772
|
+
}
|
|
773
|
+
}, te = (e, t) => d.edit({
|
|
774
|
+
...n.draft,
|
|
775
|
+
steps: n.draft.steps.map((n, r) => r === e ? {
|
|
776
|
+
...n,
|
|
777
|
+
...t,
|
|
778
|
+
supplemented: !0
|
|
779
|
+
} : n)
|
|
780
|
+
});
|
|
781
|
+
return /* @__PURE__ */ H("div", {
|
|
782
|
+
className: K.section,
|
|
783
|
+
"data-assistant-part": "section automation",
|
|
784
|
+
children: [
|
|
785
|
+
/* @__PURE__ */ H("div", {
|
|
786
|
+
className: K.sectionHeading,
|
|
787
|
+
"data-assistant-part": "section-heading",
|
|
788
|
+
children: [/* @__PURE__ */ V("span", {
|
|
789
|
+
className: K.headingIcon,
|
|
790
|
+
"data-assistant-part": "heading-icon",
|
|
791
|
+
children: /* @__PURE__ */ V(Me, {})
|
|
792
|
+
}), /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("h3", { children: "探索页面,生成并验证用例" }), /* @__PURE__ */ V("p", { children: "自主探索生成 Excel,也可录制操作补充用例。" })] })]
|
|
793
|
+
}),
|
|
794
|
+
!f && /* @__PURE__ */ V(y, {
|
|
795
|
+
type: "warning",
|
|
796
|
+
title: "回放服务未连接。仍可录制、编辑断言和导出用例。"
|
|
797
|
+
}),
|
|
798
|
+
r && /* @__PURE__ */ V(y, {
|
|
799
|
+
closable: !0,
|
|
800
|
+
onClose: () => i(""),
|
|
801
|
+
type: "info",
|
|
802
|
+
title: r
|
|
803
|
+
}),
|
|
804
|
+
/* @__PURE__ */ H("div", {
|
|
805
|
+
className: K.automationLayout,
|
|
806
|
+
"data-assistant-part": "automation-layout",
|
|
807
|
+
children: [
|
|
808
|
+
/* @__PURE__ */ V(Ze, {
|
|
809
|
+
bridgeUrl: t,
|
|
810
|
+
disabled: h || l.state === "running" || n.recording,
|
|
811
|
+
onRunningChange: ee
|
|
812
|
+
}),
|
|
813
|
+
/* @__PURE__ */ H(S, {
|
|
814
|
+
className: K.card,
|
|
815
|
+
"data-assistant-part": "card record-card",
|
|
816
|
+
"aria-label": "录制操作",
|
|
817
|
+
styles: { body: {
|
|
818
|
+
padding: 0,
|
|
819
|
+
display: "flex",
|
|
820
|
+
flexDirection: "column",
|
|
821
|
+
gap: 16
|
|
822
|
+
} },
|
|
823
|
+
children: [
|
|
824
|
+
/* @__PURE__ */ H("div", {
|
|
825
|
+
className: K.cardHeading,
|
|
826
|
+
"data-assistant-part": "card-heading",
|
|
827
|
+
children: [/* @__PURE__ */ H("h3", { children: [/* @__PURE__ */ V(Me, {}), "录制操作"] }), /* @__PURE__ */ H(A, {
|
|
828
|
+
color: n.recording ? "red" : "default",
|
|
829
|
+
children: [
|
|
830
|
+
n.recording ? "录制中" : "待录制",
|
|
831
|
+
" · ",
|
|
832
|
+
n.draft.steps.length,
|
|
833
|
+
"/100 步"
|
|
834
|
+
]
|
|
835
|
+
})]
|
|
836
|
+
}),
|
|
837
|
+
/* @__PURE__ */ H("div", {
|
|
838
|
+
className: K.buttonRow,
|
|
839
|
+
"data-assistant-part": "button-row",
|
|
840
|
+
children: [/* @__PURE__ */ V(x, {
|
|
841
|
+
icon: /* @__PURE__ */ V(Me, {}),
|
|
842
|
+
type: "primary",
|
|
843
|
+
disabled: k || n.recording,
|
|
844
|
+
onClick: () => void j(() => {
|
|
845
|
+
o(null), d.start(), e();
|
|
846
|
+
}),
|
|
847
|
+
children: "开始新录制"
|
|
848
|
+
}), /* @__PURE__ */ V(x, {
|
|
849
|
+
icon: /* @__PURE__ */ V(Ae, {}),
|
|
850
|
+
disabled: !n.recording,
|
|
851
|
+
onClick: () => d.stop(),
|
|
852
|
+
children: "结束录制"
|
|
853
|
+
})]
|
|
854
|
+
}),
|
|
855
|
+
/* @__PURE__ */ V(w, {
|
|
856
|
+
className: K.help,
|
|
857
|
+
"data-assistant-part": "help",
|
|
858
|
+
ghost: !0,
|
|
859
|
+
size: "small",
|
|
860
|
+
styles: {
|
|
861
|
+
header: {
|
|
862
|
+
padding: 0,
|
|
863
|
+
fontSize: 12,
|
|
864
|
+
lineHeight: "inherit"
|
|
865
|
+
},
|
|
866
|
+
body: { padding: "8px 0 0" }
|
|
867
|
+
},
|
|
868
|
+
items: [{
|
|
869
|
+
key: "details",
|
|
870
|
+
label: /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(L, {}), "录制范围与使用说明"] }),
|
|
871
|
+
children: /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("p", {
|
|
872
|
+
className: K.hint,
|
|
873
|
+
"data-assistant-part": "hint",
|
|
874
|
+
children: "先将业务页面恢复到初始状态,再开始录制;回放目标由宿主配置。需保留用例时请导出 JSON。"
|
|
875
|
+
}), /* @__PURE__ */ V("p", {
|
|
876
|
+
className: K.hint,
|
|
877
|
+
"data-assistant-part": "hint",
|
|
878
|
+
children: "录制会保存普通字段输入值。密码等敏感输入不记录;上传、跨域 iframe、拖拽和刷新暂不支持。保存前请检查步骤。回放会真实操作模拟数据,不会自动恢复录制前的数据。"
|
|
879
|
+
})] })
|
|
880
|
+
}]
|
|
881
|
+
})
|
|
882
|
+
]
|
|
883
|
+
}),
|
|
884
|
+
/* @__PURE__ */ H(S, {
|
|
885
|
+
className: K.card,
|
|
886
|
+
"data-assistant-part": "card editor-card",
|
|
887
|
+
"aria-label": "编辑用例",
|
|
888
|
+
styles: { body: {
|
|
889
|
+
padding: 0,
|
|
890
|
+
display: "flex",
|
|
891
|
+
flexDirection: "column",
|
|
892
|
+
gap: 16
|
|
893
|
+
} },
|
|
894
|
+
children: [
|
|
895
|
+
/* @__PURE__ */ H("div", {
|
|
896
|
+
className: K.cardHeading,
|
|
897
|
+
"data-assistant-part": "card-heading",
|
|
898
|
+
children: [/* @__PURE__ */ H("h3", { children: [/* @__PURE__ */ V(fe, {}), "编辑用例"] }), /* @__PURE__ */ H("span", { children: [n.draft.steps.length, " 个步骤"] })]
|
|
899
|
+
}),
|
|
900
|
+
/* @__PURE__ */ H("div", {
|
|
901
|
+
className: K.field,
|
|
902
|
+
"data-assistant-part": "field",
|
|
903
|
+
children: [/* @__PURE__ */ V("label", {
|
|
904
|
+
htmlFor: "assistant-case-name",
|
|
905
|
+
children: "用例名称"
|
|
906
|
+
}), /* @__PURE__ */ V(E, {
|
|
907
|
+
id: "assistant-case-name",
|
|
908
|
+
prefix: /* @__PURE__ */ V(F, {}),
|
|
909
|
+
"aria-label": "测试用例名称",
|
|
910
|
+
value: n.draft.name,
|
|
911
|
+
maxLength: 100,
|
|
912
|
+
disabled: n.recording || k,
|
|
913
|
+
onChange: (e) => d.edit({
|
|
914
|
+
...n.draft,
|
|
915
|
+
name: e.target.value
|
|
916
|
+
})
|
|
917
|
+
})]
|
|
918
|
+
}),
|
|
919
|
+
!n.draft.steps.length && /* @__PURE__ */ H("div", {
|
|
920
|
+
className: K.emptySteps,
|
|
921
|
+
"data-assistant-part": "empty-steps",
|
|
922
|
+
children: [
|
|
923
|
+
/* @__PURE__ */ V(F, {}),
|
|
924
|
+
/* @__PURE__ */ V("span", { children: "还没有操作步骤" }),
|
|
925
|
+
/* @__PURE__ */ V("p", { children: "开始录制,或导入已有用例。" })
|
|
926
|
+
]
|
|
927
|
+
}),
|
|
928
|
+
/* @__PURE__ */ V("ol", {
|
|
929
|
+
className: K.caseSteps,
|
|
930
|
+
"data-assistant-part": "case-steps",
|
|
931
|
+
children: n.draft.steps.map((e, t) => /* @__PURE__ */ H("li", { children: [
|
|
932
|
+
/* @__PURE__ */ H("div", {
|
|
933
|
+
className: K.stepHeading,
|
|
934
|
+
"data-assistant-part": "step-heading",
|
|
935
|
+
children: [
|
|
936
|
+
/* @__PURE__ */ V("span", {
|
|
937
|
+
className: K.stepNumber,
|
|
938
|
+
"data-assistant-part": "step-number",
|
|
939
|
+
children: String(t + 1).padStart(2, "0")
|
|
940
|
+
}),
|
|
941
|
+
/* @__PURE__ */ V(A, {
|
|
942
|
+
color: e.kind === "unsupported" ? "red" : "blue",
|
|
943
|
+
children: Qe[e.kind]
|
|
944
|
+
}),
|
|
945
|
+
/* @__PURE__ */ V("strong", { children: e.assertion?.name ?? e.target?.label ?? e.value }),
|
|
946
|
+
e.sourceEventId && /* @__PURE__ */ H(A, { children: ["源事件 #", e.sourceEventId] }),
|
|
947
|
+
e.supplemented && /* @__PURE__ */ V(A, {
|
|
948
|
+
color: "orange",
|
|
949
|
+
children: "人工补充"
|
|
950
|
+
})
|
|
951
|
+
]
|
|
952
|
+
}),
|
|
953
|
+
e.assertion && /* @__PURE__ */ H("div", {
|
|
954
|
+
className: K.assertionSummary,
|
|
955
|
+
"data-assistant-part": "assertion-summary",
|
|
956
|
+
children: [
|
|
957
|
+
/* @__PURE__ */ V(A, {
|
|
958
|
+
color: "green",
|
|
959
|
+
children: q.assertionSources[e.assertion.source]
|
|
960
|
+
}),
|
|
961
|
+
/* @__PURE__ */ H("span", { children: [
|
|
962
|
+
q.assertionOperators[e.assertion.operator],
|
|
963
|
+
" ",
|
|
964
|
+
e.assertion.expected === "" ? "空字符串" : e.assertion.expected
|
|
965
|
+
] }),
|
|
966
|
+
/* @__PURE__ */ H("span", {
|
|
967
|
+
className: K.hint,
|
|
968
|
+
"data-assistant-part": "hint",
|
|
969
|
+
children: [
|
|
970
|
+
"最多等待 ",
|
|
971
|
+
e.assertion.timeout / 1e3,
|
|
972
|
+
" 秒"
|
|
973
|
+
]
|
|
974
|
+
}),
|
|
975
|
+
e.assertion.selector && /* @__PURE__ */ V("code", { children: e.assertion.selector })
|
|
976
|
+
]
|
|
977
|
+
}),
|
|
978
|
+
e.kind === "unsupported" && /* @__PURE__ */ V(We, {
|
|
979
|
+
step: e,
|
|
980
|
+
disabled: n.recording || k,
|
|
981
|
+
onApply: (e) => d.edit({
|
|
982
|
+
...n.draft,
|
|
983
|
+
steps: n.draft.steps.map((n, r) => r === t ? e : n)
|
|
984
|
+
})
|
|
985
|
+
}, JSON.stringify(e)),
|
|
986
|
+
e.value !== void 0 && e.kind !== "unsupported" && /* @__PURE__ */ V(E, {
|
|
987
|
+
"aria-label": `第 ${t + 1} 步内容`,
|
|
988
|
+
value: e.value,
|
|
989
|
+
maxLength: 2e3,
|
|
990
|
+
disabled: n.recording || k,
|
|
991
|
+
onChange: (e) => te(t, { value: e.target.value })
|
|
992
|
+
}),
|
|
993
|
+
e.kind === "check" && /* @__PURE__ */ V("span", { children: e.checked ? "选中" : "取消选中" }),
|
|
994
|
+
e.target && /* @__PURE__ */ V(w, {
|
|
995
|
+
ghost: !0,
|
|
996
|
+
size: "small",
|
|
997
|
+
styles: {
|
|
998
|
+
header: {
|
|
999
|
+
padding: 0,
|
|
1000
|
+
fontSize: 12,
|
|
1001
|
+
lineHeight: "inherit"
|
|
1002
|
+
},
|
|
1003
|
+
body: { padding: "8px 0 0" }
|
|
1004
|
+
},
|
|
1005
|
+
items: [{
|
|
1006
|
+
key: "details",
|
|
1007
|
+
label: /* @__PURE__ */ V(B, { children: "定位信息" }),
|
|
1008
|
+
children: /* @__PURE__ */ V(B, { children: /* @__PURE__ */ V("code", { children: e.target.selector }) })
|
|
1009
|
+
}]
|
|
1010
|
+
}),
|
|
1011
|
+
/* @__PURE__ */ H("div", {
|
|
1012
|
+
className: [K.buttonRow, K.stepActions].join(" "),
|
|
1013
|
+
"data-assistant-part": "button-row step-actions",
|
|
1014
|
+
children: [
|
|
1015
|
+
/* @__PURE__ */ V(x, {
|
|
1016
|
+
size: "small",
|
|
1017
|
+
icon: /* @__PURE__ */ V(N, {}),
|
|
1018
|
+
disabled: n.recording || k || !e.assertion && n.draft.steps.length >= 100,
|
|
1019
|
+
onClick: () => c(t + 1, e.assertion ? t : void 0),
|
|
1020
|
+
children: e.assertion ? "编辑断言" : "在此步后添加断言"
|
|
1021
|
+
}),
|
|
1022
|
+
/* @__PURE__ */ H(x, {
|
|
1023
|
+
icon: /* @__PURE__ */ V(Te, {}),
|
|
1024
|
+
size: "small",
|
|
1025
|
+
disabled: n.recording || k || n.draft.steps.length >= 100,
|
|
1026
|
+
onClick: () => {
|
|
1027
|
+
o(null), d.edit({
|
|
1028
|
+
...n.draft,
|
|
1029
|
+
steps: [
|
|
1030
|
+
...n.draft.steps.slice(0, t),
|
|
1031
|
+
{
|
|
1032
|
+
kind: "unsupported",
|
|
1033
|
+
value: "人工前置步骤待补充"
|
|
1034
|
+
},
|
|
1035
|
+
...n.draft.steps.slice(t)
|
|
1036
|
+
]
|
|
1037
|
+
});
|
|
1038
|
+
},
|
|
1039
|
+
children: [
|
|
1040
|
+
"在第 ",
|
|
1041
|
+
t + 1,
|
|
1042
|
+
" 步前插入"
|
|
1043
|
+
]
|
|
1044
|
+
}),
|
|
1045
|
+
/* @__PURE__ */ H(x, {
|
|
1046
|
+
icon: /* @__PURE__ */ V(le, {}),
|
|
1047
|
+
danger: !0,
|
|
1048
|
+
size: "small",
|
|
1049
|
+
disabled: n.recording || k,
|
|
1050
|
+
onClick: () => {
|
|
1051
|
+
o(null), d.edit({
|
|
1052
|
+
...n.draft,
|
|
1053
|
+
steps: n.draft.steps.filter((e, n) => n !== t)
|
|
1054
|
+
});
|
|
1055
|
+
},
|
|
1056
|
+
children: [
|
|
1057
|
+
"移除第 ",
|
|
1058
|
+
t + 1,
|
|
1059
|
+
" 步"
|
|
1060
|
+
]
|
|
1061
|
+
})
|
|
1062
|
+
]
|
|
1063
|
+
})
|
|
1064
|
+
] }, t))
|
|
1065
|
+
}),
|
|
1066
|
+
n.draft.timeline && /* @__PURE__ */ V(w, {
|
|
1067
|
+
ghost: !0,
|
|
1068
|
+
size: "small",
|
|
1069
|
+
styles: {
|
|
1070
|
+
header: {
|
|
1071
|
+
padding: 0,
|
|
1072
|
+
fontSize: 12,
|
|
1073
|
+
lineHeight: "inherit"
|
|
1074
|
+
},
|
|
1075
|
+
body: { padding: "8px 0 0" }
|
|
1076
|
+
},
|
|
1077
|
+
items: [{
|
|
1078
|
+
key: "details",
|
|
1079
|
+
label: /* @__PURE__ */ H(B, { children: [
|
|
1080
|
+
"选段原始证据(",
|
|
1081
|
+
n.draft.timeline.events.length,
|
|
1082
|
+
" 条,只读)"
|
|
1083
|
+
] }),
|
|
1084
|
+
children: /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("p", { children: "接口、异常和性能事件不执行;人工补充与移除步骤不会改写这里的来源记录。" }), /* @__PURE__ */ V("pre", {
|
|
1085
|
+
className: K.json,
|
|
1086
|
+
"data-assistant-part": "json",
|
|
1087
|
+
children: JSON.stringify(n.draft.timeline, null, 2)
|
|
1088
|
+
})] })
|
|
1089
|
+
}]
|
|
1090
|
+
}),
|
|
1091
|
+
/* @__PURE__ */ H("div", {
|
|
1092
|
+
ref: s,
|
|
1093
|
+
className: K.assertionArea,
|
|
1094
|
+
"data-assistant-part": "assertion-area",
|
|
1095
|
+
children: [
|
|
1096
|
+
/* @__PURE__ */ H("div", {
|
|
1097
|
+
className: K.cardHeading,
|
|
1098
|
+
"data-assistant-part": "card-heading",
|
|
1099
|
+
children: [/* @__PURE__ */ H("h3", { children: [/* @__PURE__ */ V(N, {}), " 结果断言"] }), /* @__PURE__ */ H(A, { children: [
|
|
1100
|
+
n.draft.steps.filter((e) => e.kind === "assert" || e.kind === "assert-text").length,
|
|
1101
|
+
" ",
|
|
1102
|
+
"条"
|
|
1103
|
+
] })]
|
|
1104
|
+
}),
|
|
1105
|
+
/* @__PURE__ */ V("p", {
|
|
1106
|
+
className: K.hint,
|
|
1107
|
+
"data-assistant-part": "hint",
|
|
1108
|
+
children: "断言按步骤顺序执行,可检查页面文字、元素文字、输入值、可见性和数量。"
|
|
1109
|
+
}),
|
|
1110
|
+
a ? /* @__PURE__ */ V(He, {
|
|
1111
|
+
initial: a.edit === void 0 ? void 0 : n.draft.steps[a.edit]?.assertion,
|
|
1112
|
+
steps: n.draft.steps,
|
|
1113
|
+
position: a.position,
|
|
1114
|
+
disabled: k || n.recording,
|
|
1115
|
+
onCancel: () => o(null),
|
|
1116
|
+
onSave: (e, t) => {
|
|
1117
|
+
let r = [...n.draft.steps];
|
|
1118
|
+
a.edit === void 0 ? r.splice(t, 0, {
|
|
1119
|
+
kind: "assert",
|
|
1120
|
+
assertion: e,
|
|
1121
|
+
supplemented: !0
|
|
1122
|
+
}) : r[a.edit] = {
|
|
1123
|
+
...r[a.edit],
|
|
1124
|
+
kind: "assert",
|
|
1125
|
+
assertion: e,
|
|
1126
|
+
supplemented: !0
|
|
1127
|
+
}, d.edit((0, q.parseCase)({
|
|
1128
|
+
...n.draft,
|
|
1129
|
+
steps: r
|
|
1130
|
+
})), o(null);
|
|
1131
|
+
}
|
|
1132
|
+
}, `${a.position}-${a.edit ?? "new"}`) : /* @__PURE__ */ V(x, {
|
|
1133
|
+
icon: /* @__PURE__ */ V(Te, {}),
|
|
1134
|
+
disabled: k || n.recording || n.draft.steps.length >= 100,
|
|
1135
|
+
onClick: () => c(n.draft.steps.length),
|
|
1136
|
+
children: "添加断言"
|
|
1137
|
+
})
|
|
1138
|
+
]
|
|
1139
|
+
}),
|
|
1140
|
+
/* @__PURE__ */ H("div", {
|
|
1141
|
+
className: [K.buttonRow, K.cardActions].join(" "),
|
|
1142
|
+
"data-assistant-part": "button-row card-actions",
|
|
1143
|
+
children: [
|
|
1144
|
+
/* @__PURE__ */ V(x, {
|
|
1145
|
+
icon: /* @__PURE__ */ V(Oe, {}),
|
|
1146
|
+
disabled: n.recording || k || !n.draft.steps.length,
|
|
1147
|
+
onClick: () => void j(() => {
|
|
1148
|
+
let e = (0, q.parseCase)(n.draft);
|
|
1149
|
+
if (e.steps.some((e) => e.kind === "unsupported")) throw Error("请处理“需要处理”的步骤,再保存用例");
|
|
1150
|
+
d.save(e), i("已保存到当前页面内存,可以开始回放或导出");
|
|
1151
|
+
}),
|
|
1152
|
+
children: "保存用例"
|
|
1153
|
+
}),
|
|
1154
|
+
/* @__PURE__ */ V(x, {
|
|
1155
|
+
icon: /* @__PURE__ */ V(de, {}),
|
|
1156
|
+
disabled: !n.saved,
|
|
1157
|
+
onClick: () => {
|
|
1158
|
+
let e = URL.createObjectURL(new Blob([JSON.stringify(n.saved, null, 2)], { type: "application/json" })), t = document.createElement("a");
|
|
1159
|
+
t.href = e, t.download = "页面录制用例.json", document.body.append(t), t.click(), t.remove(), setTimeout(() => URL.revokeObjectURL(e), 3e4);
|
|
1160
|
+
},
|
|
1161
|
+
children: "导出用例 JSON"
|
|
1162
|
+
}),
|
|
1163
|
+
/* @__PURE__ */ V(M, {
|
|
1164
|
+
className: K.upload,
|
|
1165
|
+
"data-assistant-part": "upload",
|
|
1166
|
+
accept: ".json,application/json",
|
|
1167
|
+
showUploadList: !1,
|
|
1168
|
+
disabled: n.recording || k,
|
|
1169
|
+
beforeUpload: async (e) => (await j(async () => {
|
|
1170
|
+
if (e.size > 512 * 1024) throw Error("用例不能超过 512 KB");
|
|
1171
|
+
d.save((0, q.parseCase)(JSON.parse(await e.text()))), o(null), i("已导入,请检查步骤后开始回放");
|
|
1172
|
+
}), M.LIST_IGNORE),
|
|
1173
|
+
children: /* @__PURE__ */ V(x, {
|
|
1174
|
+
icon: /* @__PURE__ */ V(je, {}),
|
|
1175
|
+
disabled: n.recording || k,
|
|
1176
|
+
children: "导入用例"
|
|
1177
|
+
})
|
|
1178
|
+
})
|
|
1179
|
+
]
|
|
1180
|
+
}),
|
|
1181
|
+
n.saved && /* @__PURE__ */ H("p", {
|
|
1182
|
+
className: K.savedCase,
|
|
1183
|
+
"data-assistant-part": "saved-case",
|
|
1184
|
+
children: [
|
|
1185
|
+
/* @__PURE__ */ V(N, {}),
|
|
1186
|
+
"已保存:",
|
|
1187
|
+
n.saved.name,
|
|
1188
|
+
"(",
|
|
1189
|
+
n.saved.steps.length,
|
|
1190
|
+
" 步)",
|
|
1191
|
+
JSON.stringify(n.saved) !== JSON.stringify(n.draft) && /* @__PURE__ */ V(A, {
|
|
1192
|
+
color: "orange",
|
|
1193
|
+
children: "草稿有未保存修改"
|
|
1194
|
+
})
|
|
1195
|
+
]
|
|
1196
|
+
})
|
|
1197
|
+
]
|
|
1198
|
+
}),
|
|
1199
|
+
/* @__PURE__ */ H(S, {
|
|
1200
|
+
className: K.card,
|
|
1201
|
+
"data-assistant-part": "card replay-card",
|
|
1202
|
+
"aria-label": "执行回放",
|
|
1203
|
+
styles: { body: {
|
|
1204
|
+
padding: 0,
|
|
1205
|
+
display: "flex",
|
|
1206
|
+
flexDirection: "column",
|
|
1207
|
+
gap: 16
|
|
1208
|
+
} },
|
|
1209
|
+
children: [
|
|
1210
|
+
/* @__PURE__ */ V("div", {
|
|
1211
|
+
className: K.cardHeading,
|
|
1212
|
+
"data-assistant-part": "card-heading",
|
|
1213
|
+
children: /* @__PURE__ */ H("h3", { children: [/* @__PURE__ */ V(we, {}), "执行回放"] })
|
|
1214
|
+
}),
|
|
1215
|
+
/* @__PURE__ */ V("p", {
|
|
1216
|
+
className: K.hint,
|
|
1217
|
+
"data-assistant-part": "hint",
|
|
1218
|
+
children: "保存后在独立浏览器中执行,按断言验证结果。"
|
|
1219
|
+
}),
|
|
1220
|
+
/* @__PURE__ */ H("div", {
|
|
1221
|
+
className: K.field,
|
|
1222
|
+
"data-assistant-part": "field",
|
|
1223
|
+
children: [/* @__PURE__ */ H("label", {
|
|
1224
|
+
htmlFor: "assistant-step-delay",
|
|
1225
|
+
children: [/* @__PURE__ */ V(P, {}), "每步间隔"]
|
|
1226
|
+
}), /* @__PURE__ */ H("div", {
|
|
1227
|
+
className: K.delayRow,
|
|
1228
|
+
"data-assistant-part": "delay-row",
|
|
1229
|
+
children: [/* @__PURE__ */ V(D, {
|
|
1230
|
+
id: "assistant-step-delay",
|
|
1231
|
+
"aria-label": "回放步骤间隔",
|
|
1232
|
+
min: 0,
|
|
1233
|
+
max: 1e4,
|
|
1234
|
+
step: 500,
|
|
1235
|
+
value: T,
|
|
1236
|
+
disabled: k,
|
|
1237
|
+
onChange: (e) => O(e ?? 0)
|
|
1238
|
+
}), /* @__PURE__ */ V("span", { children: "毫秒" })]
|
|
1239
|
+
})]
|
|
1240
|
+
}),
|
|
1241
|
+
/* @__PURE__ */ H("div", {
|
|
1242
|
+
className: K.buttonRow,
|
|
1243
|
+
"data-assistant-part": "button-row",
|
|
1244
|
+
children: [/* @__PURE__ */ V(x, {
|
|
1245
|
+
icon: /* @__PURE__ */ V(we, {}),
|
|
1246
|
+
type: "primary",
|
|
1247
|
+
disabled: !f || !n.saved || n.saved.steps.some((e) => e.kind === "unsupported") || n.recording || k || JSON.stringify(n.saved) !== JSON.stringify(n.draft),
|
|
1248
|
+
onClick: () => void j(async () => {
|
|
1249
|
+
b(!0);
|
|
1250
|
+
try {
|
|
1251
|
+
u(await qe(t, "run", {
|
|
1252
|
+
testCase: n.saved,
|
|
1253
|
+
delay: T,
|
|
1254
|
+
headed: !0
|
|
1255
|
+
}));
|
|
1256
|
+
} finally {
|
|
1257
|
+
b(!1);
|
|
1258
|
+
}
|
|
1259
|
+
}),
|
|
1260
|
+
children: "开始回放(本地 Chrome)"
|
|
1261
|
+
}), /* @__PURE__ */ V(x, {
|
|
1262
|
+
icon: /* @__PURE__ */ V(Ae, {}),
|
|
1263
|
+
disabled: l.state !== "running",
|
|
1264
|
+
onClick: () => void j(async () => {
|
|
1265
|
+
await qe(t, "stop", {});
|
|
1266
|
+
}),
|
|
1267
|
+
children: "停止回放"
|
|
1268
|
+
})]
|
|
1269
|
+
}),
|
|
1270
|
+
/* @__PURE__ */ V(y, {
|
|
1271
|
+
showIcon: !0,
|
|
1272
|
+
type: l.state === "failed" ? "error" : l.state === "passed" ? "success" : "info",
|
|
1273
|
+
title: `${l.step}/${l.total} · ${l.message}`
|
|
1274
|
+
}),
|
|
1275
|
+
!!l.assertions?.length && /* @__PURE__ */ H("div", {
|
|
1276
|
+
className: K.assertionResults,
|
|
1277
|
+
"data-assistant-part": "assertion-results",
|
|
1278
|
+
"aria-label": "断言结果",
|
|
1279
|
+
children: [/* @__PURE__ */ H("h3", {
|
|
1280
|
+
className: K.subheading,
|
|
1281
|
+
"data-assistant-part": "subheading",
|
|
1282
|
+
children: [/* @__PURE__ */ V(N, {}), " 断言结果"]
|
|
1283
|
+
}), l.assertions.map((e) => /* @__PURE__ */ H("div", {
|
|
1284
|
+
className: K.assertionResult,
|
|
1285
|
+
"data-assistant-part": "assertion-result",
|
|
1286
|
+
children: [
|
|
1287
|
+
/* @__PURE__ */ H("div", {
|
|
1288
|
+
className: K.cardHeading,
|
|
1289
|
+
"data-assistant-part": "card-heading",
|
|
1290
|
+
children: [/* @__PURE__ */ H("strong", { children: [
|
|
1291
|
+
"第 ",
|
|
1292
|
+
e.step,
|
|
1293
|
+
" 步 · ",
|
|
1294
|
+
e.name
|
|
1295
|
+
] }), /* @__PURE__ */ V(A, {
|
|
1296
|
+
color: e.passed ? "green" : "red",
|
|
1297
|
+
children: e.passed ? "通过" : "失败"
|
|
1298
|
+
})]
|
|
1299
|
+
}),
|
|
1300
|
+
/* @__PURE__ */ H("dl", { children: [
|
|
1301
|
+
/* @__PURE__ */ V("dt", { children: "期望" }),
|
|
1302
|
+
/* @__PURE__ */ V("dd", { children: e.expected }),
|
|
1303
|
+
/* @__PURE__ */ V("dt", { children: "实际" }),
|
|
1304
|
+
/* @__PURE__ */ V("dd", { children: e.actual || "空字符串" })
|
|
1305
|
+
] }),
|
|
1306
|
+
/* @__PURE__ */ H("span", {
|
|
1307
|
+
className: K.hint,
|
|
1308
|
+
"data-assistant-part": "hint",
|
|
1309
|
+
children: [
|
|
1310
|
+
"耗时 ",
|
|
1311
|
+
e.duration,
|
|
1312
|
+
" ms"
|
|
1313
|
+
]
|
|
1314
|
+
})
|
|
1315
|
+
]
|
|
1316
|
+
}, e.step))]
|
|
1317
|
+
})
|
|
1318
|
+
]
|
|
1319
|
+
})
|
|
1320
|
+
]
|
|
1321
|
+
})
|
|
1322
|
+
]
|
|
1323
|
+
});
|
|
1324
|
+
}
|
|
1325
|
+
var X = {
|
|
1326
|
+
json: "_json_62man_1 _json_17elq_174",
|
|
1327
|
+
eventMeta: "_eventMeta_62man_4 _eventMeta_17elq_300",
|
|
1328
|
+
hint: "_hint_62man_7 _hint_17elq_243",
|
|
1329
|
+
buttonRow: "_buttonRow_62man_10 _buttonRow_17elq_299",
|
|
1330
|
+
headingIcon: "_headingIcon_62man_13 _headingIcon_17elq_353",
|
|
1331
|
+
sectionHeading: "_sectionHeading_62man_16 _sectionHeading_17elq_330",
|
|
1332
|
+
section: "_section_62man_16 _section_17elq_170",
|
|
1333
|
+
filters: "_filters_62man_22",
|
|
1334
|
+
timeline: "_timeline_62man_35",
|
|
1335
|
+
error: "_error_62man_58"
|
|
1336
|
+
};
|
|
1337
|
+
//#endregion
|
|
1338
|
+
//#region src/utils/automation/timeline-case.ts
|
|
1339
|
+
function tt(e) {
|
|
1340
|
+
let t = /* @__PURE__ */ new Set();
|
|
1341
|
+
return e.map((e) => {
|
|
1342
|
+
if (!Number.isSafeInteger(e.id) || e.id <= 0 || t.has(e.id)) throw Error("事件编号重复或无效,无法选段");
|
|
1343
|
+
return t.add(e.id), {
|
|
1344
|
+
id: e.id,
|
|
1345
|
+
time: e.time,
|
|
1346
|
+
kind: e.kind,
|
|
1347
|
+
title: c(e.title, 180),
|
|
1348
|
+
page: a(e.page),
|
|
1349
|
+
...e.actionId ? { actionId: e.actionId } : {}
|
|
1350
|
+
};
|
|
1351
|
+
}).sort((e, t) => e.time - t.time || e.id - t.id);
|
|
1352
|
+
}
|
|
1353
|
+
function nt(e, t, n) {
|
|
1354
|
+
let r = e.findIndex((e) => e.id === t), i = e.findIndex((e) => e.id === n);
|
|
1355
|
+
return r < 0 || i < r ? [] : e.slice(r, i + 1);
|
|
1356
|
+
}
|
|
1357
|
+
function rt(e, t, n) {
|
|
1358
|
+
let r = nt(e, t, n);
|
|
1359
|
+
if (!r.length) throw Error("请选择按时间先后排列的起点和终点");
|
|
1360
|
+
let i = r.filter((e) => [
|
|
1361
|
+
"route",
|
|
1362
|
+
"click",
|
|
1363
|
+
"change"
|
|
1364
|
+
].includes(e.kind));
|
|
1365
|
+
if (!i.length) throw Error("该片段只有排查证据,没有页面操作,不能生成用例");
|
|
1366
|
+
if (i.length >= 100) throw Error("操作过多,请缩小选段范围(需为前置步骤预留一个位置)");
|
|
1367
|
+
let a = new URL(i[0].page);
|
|
1368
|
+
if (!["http:", "https:"].includes(a.protocol) || i.some((e) => new URL(e.page).origin !== a.origin)) throw Error("请选择同一站点内的片段");
|
|
1369
|
+
return (0, q.parseCase)({
|
|
1370
|
+
schema: "zhidao-recorded-case",
|
|
1371
|
+
version: 1,
|
|
1372
|
+
name: `时间线片段 #${t}–#${n}`,
|
|
1373
|
+
path: a.pathname,
|
|
1374
|
+
timeline: {
|
|
1375
|
+
capturedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1376
|
+
events: structuredClone(r)
|
|
1377
|
+
},
|
|
1378
|
+
steps: [{
|
|
1379
|
+
kind: "unsupported",
|
|
1380
|
+
value: "前置条件待确认:回放从片段的入口页面开始。请补充登录、筛选、弹窗等必要步骤;无需前置操作时可移除此项。"
|
|
1381
|
+
}, ...i.map((e) => ({
|
|
1382
|
+
kind: "unsupported",
|
|
1383
|
+
sourceEventId: e.id,
|
|
1384
|
+
value: e.kind === "change" ? `待补充字段定位、操作类型和输入值:${e.title}(历史输入值未采集)` : e.kind === "route" ? `待确认页面前置状态:${e.title}(不会自动恢复原现场)` : `待补充点击目标:${e.title}(历史记录没有可回放定位,不能按文字猜测)`
|
|
1385
|
+
}))]
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
//#endregion
|
|
1389
|
+
//#region src/pages/assistant/components/TimelinePanel/index.tsx
|
|
1390
|
+
var it = {
|
|
1391
|
+
route: "页面",
|
|
1392
|
+
click: "点击",
|
|
1393
|
+
change: "字段",
|
|
1394
|
+
request: "接口",
|
|
1395
|
+
error: "异常",
|
|
1396
|
+
performance: "性能"
|
|
1397
|
+
};
|
|
1398
|
+
function at({ events: e, onDraft: t }) {
|
|
1399
|
+
let n = v(d.subscribe, d.getState), [r, i] = _(null), [a, o] = _(), [s, c] = _(), [l, u] = _("all"), [f, p] = _(""), [m, h] = _(""), g = r ? nt(r, a, s) : [], b = new Set(g.map((e) => e.id)), S = r ?? e;
|
|
1400
|
+
return /* @__PURE__ */ H("div", {
|
|
1401
|
+
className: X.section,
|
|
1402
|
+
"data-assistant-part": "section",
|
|
1403
|
+
children: [
|
|
1404
|
+
/* @__PURE__ */ H("div", {
|
|
1405
|
+
className: X.sectionHeading,
|
|
1406
|
+
"data-assistant-part": "section-heading",
|
|
1407
|
+
children: [/* @__PURE__ */ V("span", {
|
|
1408
|
+
className: X.headingIcon,
|
|
1409
|
+
"data-assistant-part": "heading-icon",
|
|
1410
|
+
children: /* @__PURE__ */ V(ye, {})
|
|
1411
|
+
}), /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("h3", { children: "操作时间线" }), /* @__PURE__ */ V("p", { children: "沿着操作轨迹,找到问题发生的时刻。" })] })]
|
|
1412
|
+
}),
|
|
1413
|
+
/* @__PURE__ */ H("div", {
|
|
1414
|
+
className: X.buttonRow,
|
|
1415
|
+
"data-assistant-part": "button-row",
|
|
1416
|
+
children: [/* @__PURE__ */ V(x, {
|
|
1417
|
+
icon: /* @__PURE__ */ V(z, {}),
|
|
1418
|
+
disabled: n.recording || !e.length || !!r,
|
|
1419
|
+
onClick: () => {
|
|
1420
|
+
try {
|
|
1421
|
+
i(tt(e)), o(void 0), c(void 0), h("");
|
|
1422
|
+
} catch (e) {
|
|
1423
|
+
h(e.message);
|
|
1424
|
+
}
|
|
1425
|
+
},
|
|
1426
|
+
children: "开始选段"
|
|
1427
|
+
}), r && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(x, {
|
|
1428
|
+
icon: /* @__PURE__ */ V(oe, {}),
|
|
1429
|
+
onClick: () => {
|
|
1430
|
+
i(null), o(void 0), c(void 0), h("");
|
|
1431
|
+
},
|
|
1432
|
+
children: "退出选段"
|
|
1433
|
+
}), /* @__PURE__ */ V(x, {
|
|
1434
|
+
icon: /* @__PURE__ */ V(he, {}),
|
|
1435
|
+
type: "primary",
|
|
1436
|
+
disabled: !g.length || n.recording,
|
|
1437
|
+
onClick: () => {
|
|
1438
|
+
try {
|
|
1439
|
+
d.loadDraft(rt(r, a, s)), t();
|
|
1440
|
+
} catch (e) {
|
|
1441
|
+
h(e.message);
|
|
1442
|
+
}
|
|
1443
|
+
},
|
|
1444
|
+
children: "生成用例草稿"
|
|
1445
|
+
})] })]
|
|
1446
|
+
}),
|
|
1447
|
+
r && /* @__PURE__ */ V(y, {
|
|
1448
|
+
type: "info",
|
|
1449
|
+
title: `已固定 ${r.length} 条事件;起点 ${a ? "#" + a : "未选"} → 终点 ${s ? "#" + s : "未选"},选中 ${g.length} 条。`,
|
|
1450
|
+
description: "列表仍按最新在上显示,生成步骤按实际时间正序。选段包含中间全部事件;接口、异常、性能只保留为证据。生成草稿会替换当前未保存草稿,保留已保存用例。"
|
|
1451
|
+
}),
|
|
1452
|
+
m && /* @__PURE__ */ V(y, {
|
|
1453
|
+
type: "warning",
|
|
1454
|
+
title: m
|
|
1455
|
+
}),
|
|
1456
|
+
!r && /* @__PURE__ */ H("div", {
|
|
1457
|
+
className: X.filters,
|
|
1458
|
+
"data-assistant-part": "filters",
|
|
1459
|
+
children: [/* @__PURE__ */ V(O, {
|
|
1460
|
+
"aria-label": "事件类型",
|
|
1461
|
+
value: l,
|
|
1462
|
+
onChange: u,
|
|
1463
|
+
options: [{
|
|
1464
|
+
value: "all",
|
|
1465
|
+
label: "全部事件"
|
|
1466
|
+
}, ...Object.entries(it).map(([e, t]) => ({
|
|
1467
|
+
value: e,
|
|
1468
|
+
label: t
|
|
1469
|
+
}))]
|
|
1470
|
+
}), /* @__PURE__ */ V(E, {
|
|
1471
|
+
prefix: /* @__PURE__ */ V(ke, {}),
|
|
1472
|
+
"aria-label": "搜索时间线",
|
|
1473
|
+
placeholder: "搜索操作或页面",
|
|
1474
|
+
value: f,
|
|
1475
|
+
onChange: (e) => p(e.target.value),
|
|
1476
|
+
allowClear: !0
|
|
1477
|
+
})]
|
|
1478
|
+
}),
|
|
1479
|
+
/* @__PURE__ */ V("p", {
|
|
1480
|
+
className: X.hint,
|
|
1481
|
+
"data-assistant-part": "hint",
|
|
1482
|
+
children: "最新记录在最上方;接口详情中的 actionId 对应触发操作编号。历史记录缺少输入值及定位信息,生成后需要补充。"
|
|
1483
|
+
}),
|
|
1484
|
+
!S.length && /* @__PURE__ */ V(T, { description: "等待页面操作" }),
|
|
1485
|
+
/* @__PURE__ */ V("ol", {
|
|
1486
|
+
className: X.timeline,
|
|
1487
|
+
"data-assistant-part": "timeline",
|
|
1488
|
+
children: S.filter((e) => !!r || (l === "all" || e.kind === l) && (e.title + e.page).includes(f)).slice().sort((e, t) => t.time - e.time || t.id - e.id).map((e) => /* @__PURE__ */ H("li", {
|
|
1489
|
+
className: e.kind === "error" ? X.error : "",
|
|
1490
|
+
children: [
|
|
1491
|
+
/* @__PURE__ */ H("div", {
|
|
1492
|
+
className: X.eventMeta,
|
|
1493
|
+
"data-assistant-part": "event-meta",
|
|
1494
|
+
children: [
|
|
1495
|
+
/* @__PURE__ */ V(A, {
|
|
1496
|
+
color: e.kind === "error" ? "red" : "blue",
|
|
1497
|
+
children: it[e.kind]
|
|
1498
|
+
}),
|
|
1499
|
+
/* @__PURE__ */ V("time", { children: new Date(e.time).toLocaleTimeString("zh-CN", { hour12: !1 }) }),
|
|
1500
|
+
/* @__PURE__ */ H("small", { children: ["#", e.id] }),
|
|
1501
|
+
b.has(e.id) && /* @__PURE__ */ V(A, {
|
|
1502
|
+
color: "gold",
|
|
1503
|
+
children: "已选"
|
|
1504
|
+
})
|
|
1505
|
+
]
|
|
1506
|
+
}),
|
|
1507
|
+
/* @__PURE__ */ V("strong", { children: e.title }),
|
|
1508
|
+
r && /* @__PURE__ */ H("div", {
|
|
1509
|
+
className: X.buttonRow,
|
|
1510
|
+
"data-assistant-part": "button-row",
|
|
1511
|
+
children: [/* @__PURE__ */ V(x, {
|
|
1512
|
+
icon: /* @__PURE__ */ V(I, {}),
|
|
1513
|
+
size: "small",
|
|
1514
|
+
"aria-label": `从事件 ${e.id} 开始`,
|
|
1515
|
+
onClick: () => {
|
|
1516
|
+
o(e.id), c(void 0);
|
|
1517
|
+
},
|
|
1518
|
+
children: "设为起点"
|
|
1519
|
+
}), /* @__PURE__ */ V(x, {
|
|
1520
|
+
icon: /* @__PURE__ */ V(N, {}),
|
|
1521
|
+
size: "small",
|
|
1522
|
+
"aria-label": `到事件 ${e.id} 结束`,
|
|
1523
|
+
disabled: a === void 0 || r.findIndex((t) => t.id === e.id) < r.findIndex((e) => e.id === a),
|
|
1524
|
+
onClick: () => c(e.id),
|
|
1525
|
+
children: "设为终点"
|
|
1526
|
+
})]
|
|
1527
|
+
}),
|
|
1528
|
+
/* @__PURE__ */ V(w, {
|
|
1529
|
+
ghost: !0,
|
|
1530
|
+
size: "small",
|
|
1531
|
+
styles: {
|
|
1532
|
+
header: {
|
|
1533
|
+
padding: 0,
|
|
1534
|
+
fontSize: 12,
|
|
1535
|
+
lineHeight: "inherit"
|
|
1536
|
+
},
|
|
1537
|
+
body: { padding: "8px 0 0" }
|
|
1538
|
+
},
|
|
1539
|
+
items: [{
|
|
1540
|
+
key: "details",
|
|
1541
|
+
label: /* @__PURE__ */ H(B, { children: ["详情", e.actionId ? ` · 关联操作 #${e.actionId}` : ""] }),
|
|
1542
|
+
children: /* @__PURE__ */ V(B, { children: /* @__PURE__ */ V("pre", {
|
|
1543
|
+
className: X.json,
|
|
1544
|
+
"data-assistant-part": "json",
|
|
1545
|
+
children: JSON.stringify({
|
|
1546
|
+
page: e.page,
|
|
1547
|
+
detail: "detail" in e ? e.detail : void 0
|
|
1548
|
+
}, null, 2)
|
|
1549
|
+
}) })
|
|
1550
|
+
}]
|
|
1551
|
+
})
|
|
1552
|
+
]
|
|
1553
|
+
}, e.id))
|
|
1554
|
+
})
|
|
1555
|
+
]
|
|
1556
|
+
});
|
|
1557
|
+
}
|
|
1558
|
+
var ot = { avatar: "_avatar_1modk_1" };
|
|
1559
|
+
//#endregion
|
|
1560
|
+
//#region src/components/AssistantAvatar/index.tsx
|
|
1561
|
+
function st({ className: e }) {
|
|
1562
|
+
return /* @__PURE__ */ V("span", {
|
|
1563
|
+
className: [ot.avatar, e].filter(Boolean).join(" "),
|
|
1564
|
+
"data-assistant-part": "avatar",
|
|
1565
|
+
"aria-hidden": "true",
|
|
1566
|
+
children: /* @__PURE__ */ H("svg", {
|
|
1567
|
+
viewBox: "0 0 40 40",
|
|
1568
|
+
fill: "none",
|
|
1569
|
+
focusable: "false",
|
|
1570
|
+
children: [
|
|
1571
|
+
/* @__PURE__ */ V("path", {
|
|
1572
|
+
d: "M19 5v6M16 5h6",
|
|
1573
|
+
stroke: "currentColor",
|
|
1574
|
+
strokeWidth: "2.5",
|
|
1575
|
+
strokeLinecap: "round"
|
|
1576
|
+
}),
|
|
1577
|
+
/* @__PURE__ */ V("rect", {
|
|
1578
|
+
x: "6",
|
|
1579
|
+
y: "11",
|
|
1580
|
+
width: "28",
|
|
1581
|
+
height: "25",
|
|
1582
|
+
rx: "11",
|
|
1583
|
+
fill: "currentColor"
|
|
1584
|
+
}),
|
|
1585
|
+
/* @__PURE__ */ V("rect", {
|
|
1586
|
+
x: "2",
|
|
1587
|
+
y: "20",
|
|
1588
|
+
width: "2.5",
|
|
1589
|
+
height: "9",
|
|
1590
|
+
rx: "1.25",
|
|
1591
|
+
fill: "currentColor"
|
|
1592
|
+
}),
|
|
1593
|
+
/* @__PURE__ */ V("rect", {
|
|
1594
|
+
x: "35.5",
|
|
1595
|
+
y: "20",
|
|
1596
|
+
width: "2.5",
|
|
1597
|
+
height: "9",
|
|
1598
|
+
rx: "1.25",
|
|
1599
|
+
fill: "currentColor"
|
|
1600
|
+
}),
|
|
1601
|
+
/* @__PURE__ */ V("rect", {
|
|
1602
|
+
x: "11",
|
|
1603
|
+
y: "17",
|
|
1604
|
+
width: "18",
|
|
1605
|
+
height: "13",
|
|
1606
|
+
rx: "6",
|
|
1607
|
+
fill: "#244b40"
|
|
1608
|
+
}),
|
|
1609
|
+
/* @__PURE__ */ V("rect", {
|
|
1610
|
+
x: "15",
|
|
1611
|
+
y: "21",
|
|
1612
|
+
width: "3",
|
|
1613
|
+
height: "5",
|
|
1614
|
+
rx: "1.5",
|
|
1615
|
+
fill: "currentColor"
|
|
1616
|
+
}),
|
|
1617
|
+
/* @__PURE__ */ V("rect", {
|
|
1618
|
+
x: "22",
|
|
1619
|
+
y: "21",
|
|
1620
|
+
width: "3",
|
|
1621
|
+
height: "5",
|
|
1622
|
+
rx: "1.5",
|
|
1623
|
+
fill: "currentColor"
|
|
1624
|
+
}),
|
|
1625
|
+
/* @__PURE__ */ V("path", {
|
|
1626
|
+
d: "m32 3 1.3 3.7L37 8l-3.7 1.3L32 13l-1.3-3.7L27 8l3.7-1.3Z",
|
|
1627
|
+
fill: "#ffe2ac"
|
|
1628
|
+
})
|
|
1629
|
+
]
|
|
1630
|
+
})
|
|
1631
|
+
});
|
|
1632
|
+
}
|
|
1633
|
+
var Z = {
|
|
1634
|
+
window: "_window_6qbbu_1",
|
|
1635
|
+
expanded: "_expanded_6qbbu_26",
|
|
1636
|
+
moving: "_moving_6qbbu_32",
|
|
1637
|
+
root: "_root_6qbbu_40",
|
|
1638
|
+
header: "_header_6qbbu_48",
|
|
1639
|
+
drag: "_drag_6qbbu_58",
|
|
1640
|
+
windowActions: "_windowActions_6qbbu_92",
|
|
1641
|
+
footer: "_footer_6qbbu_109",
|
|
1642
|
+
resize: "_resize_6qbbu_130"
|
|
1643
|
+
};
|
|
1644
|
+
//#endregion
|
|
1645
|
+
//#region src/layouts/FloatingPanel/useOverlayScrollbars.ts
|
|
1646
|
+
function ct(e, t) {
|
|
1647
|
+
p(() => {
|
|
1648
|
+
let n = e.current;
|
|
1649
|
+
if (!n || !t) return;
|
|
1650
|
+
let r = /* @__PURE__ */ new Map(), i = 0, a = () => {
|
|
1651
|
+
for (let [e, t] of r) n.contains(e) || (t.destroy(), r.delete(e));
|
|
1652
|
+
for (let e of n.querySelectorAll("[data-assistant-part~=\"body\"],[data-assistant-part~=\"json\"],.ant-tabs-content-holder,.ant-tabs-body-holder")) r.has(e) || r.set(e, Pe({
|
|
1653
|
+
target: e,
|
|
1654
|
+
elements: { viewport: e }
|
|
1655
|
+
}, {
|
|
1656
|
+
overflow: {
|
|
1657
|
+
x: "scroll",
|
|
1658
|
+
y: "scroll"
|
|
1659
|
+
},
|
|
1660
|
+
scrollbars: {
|
|
1661
|
+
theme: "os-theme-dark",
|
|
1662
|
+
autoHide: "scroll",
|
|
1663
|
+
autoHideDelay: 1200,
|
|
1664
|
+
dragScroll: !0
|
|
1665
|
+
}
|
|
1666
|
+
}));
|
|
1667
|
+
}, o = new MutationObserver(() => {
|
|
1668
|
+
cancelAnimationFrame(i), i = requestAnimationFrame(a);
|
|
1669
|
+
});
|
|
1670
|
+
return o.observe(n, {
|
|
1671
|
+
childList: !0,
|
|
1672
|
+
subtree: !0
|
|
1673
|
+
}), a(), () => {
|
|
1674
|
+
o.disconnect(), cancelAnimationFrame(i), r.forEach((e) => e.destroy());
|
|
1675
|
+
};
|
|
1676
|
+
}, [e, t]);
|
|
1677
|
+
}
|
|
1678
|
+
//#endregion
|
|
1679
|
+
//#region src/layouts/FloatingPanel/index.tsx
|
|
1680
|
+
var Q = 12, lt = (e) => {
|
|
1681
|
+
let t = Math.min(Math.max(360, e.width), window.innerWidth - Q * 2), n = Math.min(Math.max(380, e.height), window.innerHeight - Q * 2);
|
|
1682
|
+
return {
|
|
1683
|
+
width: t,
|
|
1684
|
+
height: n,
|
|
1685
|
+
x: Math.max(Q, Math.min(e.x, window.innerWidth - t - Q)),
|
|
1686
|
+
y: Math.max(Q, Math.min(e.y, window.innerHeight - n - Q))
|
|
1687
|
+
};
|
|
1688
|
+
}, ut = (e) => {
|
|
1689
|
+
let { open: t, onMinimize: n, children: r, developer: i } = e, [a, o] = _(() => lt({
|
|
1690
|
+
x: window.innerWidth - 564,
|
|
1691
|
+
y: window.innerHeight - 744,
|
|
1692
|
+
width: 540,
|
|
1693
|
+
height: 720
|
|
1694
|
+
})), [s, c] = _(!1), [l, u] = _(!1), d = g(null);
|
|
1695
|
+
ct(d, t);
|
|
1696
|
+
let f = g(null);
|
|
1697
|
+
p(() => {
|
|
1698
|
+
let e = () => o((e) => lt(e));
|
|
1699
|
+
return window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
1700
|
+
}, []), p(() => {
|
|
1701
|
+
t && d.current?.focus({ preventScroll: !0 });
|
|
1702
|
+
}, [t]);
|
|
1703
|
+
let m = (e, t = !1) => {
|
|
1704
|
+
s || e.button !== 0 || e.target.closest("button") || (e.preventDefault(), e.currentTarget.setPointerCapture(e.pointerId), f.current = {
|
|
1705
|
+
x: e.clientX,
|
|
1706
|
+
y: e.clientY,
|
|
1707
|
+
rect: a,
|
|
1708
|
+
resize: t
|
|
1709
|
+
}, u(!0));
|
|
1710
|
+
}, h = (e) => {
|
|
1711
|
+
let t = f.current;
|
|
1712
|
+
if (!t) return;
|
|
1713
|
+
let n = e.clientX - t.x, r = e.clientY - t.y;
|
|
1714
|
+
o(lt(t.resize ? {
|
|
1715
|
+
...t.rect,
|
|
1716
|
+
width: Math.min(t.rect.width + n, window.innerWidth - t.rect.x - Q),
|
|
1717
|
+
height: Math.min(t.rect.height + r, window.innerHeight - t.rect.y - Q)
|
|
1718
|
+
} : {
|
|
1719
|
+
...t.rect,
|
|
1720
|
+
x: t.rect.x + n,
|
|
1721
|
+
y: t.rect.y + r
|
|
1722
|
+
}));
|
|
1723
|
+
}, v = () => {
|
|
1724
|
+
f.current = null, u(!1);
|
|
1725
|
+
};
|
|
1726
|
+
return /* @__PURE__ */ H("section", {
|
|
1727
|
+
ref: d,
|
|
1728
|
+
id: "research-assistant-window",
|
|
1729
|
+
role: "dialog",
|
|
1730
|
+
"aria-modal": "false",
|
|
1731
|
+
"aria-labelledby": "research-assistant-title",
|
|
1732
|
+
tabIndex: -1,
|
|
1733
|
+
hidden: !t,
|
|
1734
|
+
"data-research-assistant": !0,
|
|
1735
|
+
className: [
|
|
1736
|
+
Z.root,
|
|
1737
|
+
Z.window,
|
|
1738
|
+
s && Z.expanded,
|
|
1739
|
+
l && Z.moving
|
|
1740
|
+
].filter(Boolean).join(" "),
|
|
1741
|
+
"data-assistant-part": "window",
|
|
1742
|
+
"data-expanded": s,
|
|
1743
|
+
style: s ? void 0 : {
|
|
1744
|
+
left: a.x,
|
|
1745
|
+
top: a.y,
|
|
1746
|
+
width: a.width,
|
|
1747
|
+
height: a.height
|
|
1748
|
+
},
|
|
1749
|
+
onKeyDown: (e) => {
|
|
1750
|
+
e.key === "Escape" && e.target === e.currentTarget && n();
|
|
1751
|
+
},
|
|
1752
|
+
children: [
|
|
1753
|
+
/* @__PURE__ */ H("header", {
|
|
1754
|
+
className: Z.header,
|
|
1755
|
+
"data-assistant-part": "header",
|
|
1756
|
+
children: [/* @__PURE__ */ H("div", {
|
|
1757
|
+
className: Z.drag,
|
|
1758
|
+
"data-assistant-part": "drag",
|
|
1759
|
+
tabIndex: 0,
|
|
1760
|
+
role: "group",
|
|
1761
|
+
"aria-label": "移动小蜜窗口,使用方向键调整位置",
|
|
1762
|
+
onPointerDown: m,
|
|
1763
|
+
onPointerMove: h,
|
|
1764
|
+
onPointerUp: v,
|
|
1765
|
+
onPointerCancel: v,
|
|
1766
|
+
onLostPointerCapture: v,
|
|
1767
|
+
onDoubleClick: () => c((e) => !e),
|
|
1768
|
+
onKeyDown: (e) => {
|
|
1769
|
+
if (s || ![
|
|
1770
|
+
"ArrowLeft",
|
|
1771
|
+
"ArrowRight",
|
|
1772
|
+
"ArrowUp",
|
|
1773
|
+
"ArrowDown"
|
|
1774
|
+
].includes(e.key)) return;
|
|
1775
|
+
e.preventDefault();
|
|
1776
|
+
let t = e.shiftKey ? 40 : 10;
|
|
1777
|
+
o((n) => lt({
|
|
1778
|
+
...n,
|
|
1779
|
+
x: n.x + (e.key === "ArrowLeft" ? -t : e.key === "ArrowRight" ? t : 0),
|
|
1780
|
+
y: n.y + (e.key === "ArrowUp" ? -t : e.key === "ArrowDown" ? t : 0)
|
|
1781
|
+
}));
|
|
1782
|
+
},
|
|
1783
|
+
children: [/* @__PURE__ */ V(st, {}), /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ H("h2", {
|
|
1784
|
+
id: "research-assistant-title",
|
|
1785
|
+
children: ["研发小蜜 ", /* @__PURE__ */ V("span", { children: i ? "开发助手" : "问题反馈" })]
|
|
1786
|
+
}), /* @__PURE__ */ V("p", { children: s ? "详细分析 · 专注每一处线索" : "陪你定位问题,留住每一处线索" })] })]
|
|
1787
|
+
}), /* @__PURE__ */ H("div", {
|
|
1788
|
+
className: Z.windowActions,
|
|
1789
|
+
"data-assistant-part": "window-actions",
|
|
1790
|
+
children: [/* @__PURE__ */ V(x, {
|
|
1791
|
+
type: "text",
|
|
1792
|
+
"aria-label": s ? "还原小窗" : "放大分析",
|
|
1793
|
+
title: s ? "还原小窗" : "放大分析",
|
|
1794
|
+
onClick: () => c((e) => !e),
|
|
1795
|
+
children: V(s ? _e : ve, {})
|
|
1796
|
+
}), /* @__PURE__ */ V(x, {
|
|
1797
|
+
type: "text",
|
|
1798
|
+
"aria-label": "最小化研发小蜜",
|
|
1799
|
+
title: "最小化",
|
|
1800
|
+
onClick: n,
|
|
1801
|
+
children: /* @__PURE__ */ V(R, {})
|
|
1802
|
+
})]
|
|
1803
|
+
})]
|
|
1804
|
+
}),
|
|
1805
|
+
r,
|
|
1806
|
+
/* @__PURE__ */ H("footer", {
|
|
1807
|
+
className: Z.footer,
|
|
1808
|
+
"data-assistant-part": "footer",
|
|
1809
|
+
children: [/* @__PURE__ */ H("span", { children: [/* @__PURE__ */ V("i", {}), "仅在本地内存中记录"] }), /* @__PURE__ */ V("span", { children: s ? "详细分析模式" : "拖动顶部移动 · 右下角调整大小" })]
|
|
1810
|
+
}),
|
|
1811
|
+
!s && /* @__PURE__ */ V("div", {
|
|
1812
|
+
className: Z.resize,
|
|
1813
|
+
"data-assistant-part": "resize",
|
|
1814
|
+
role: "group",
|
|
1815
|
+
tabIndex: 0,
|
|
1816
|
+
"aria-label": "调整小蜜窗口大小,使用方向键",
|
|
1817
|
+
onPointerDown: (e) => m(e, !0),
|
|
1818
|
+
onPointerMove: h,
|
|
1819
|
+
onPointerUp: v,
|
|
1820
|
+
onPointerCancel: v,
|
|
1821
|
+
onLostPointerCapture: v,
|
|
1822
|
+
onKeyDown: (e) => {
|
|
1823
|
+
[
|
|
1824
|
+
"ArrowLeft",
|
|
1825
|
+
"ArrowRight",
|
|
1826
|
+
"ArrowUp",
|
|
1827
|
+
"ArrowDown"
|
|
1828
|
+
].includes(e.key) && (e.preventDefault(), o((t) => lt({
|
|
1829
|
+
...t,
|
|
1830
|
+
width: Math.min(t.width + (e.key === "ArrowLeft" ? -20 : e.key === "ArrowRight" ? 20 : 0), window.innerWidth - t.x - Q),
|
|
1831
|
+
height: Math.min(t.height + (e.key === "ArrowUp" ? -20 : e.key === "ArrowDown" ? 20 : 0), window.innerHeight - t.y - Q)
|
|
1832
|
+
})));
|
|
1833
|
+
}
|
|
1834
|
+
})
|
|
1835
|
+
]
|
|
1836
|
+
});
|
|
1837
|
+
}, $ = {
|
|
1838
|
+
subheading: "_subheading_1y43c_1 _subheading_17elq_305",
|
|
1839
|
+
hint: "_hint_1y43c_4 _hint_17elq_243",
|
|
1840
|
+
cardHeading: "_cardHeading_1y43c_7 _cardHeading_17elq_302",
|
|
1841
|
+
card: "_card_1y43c_7 _card_17elq_302",
|
|
1842
|
+
headingIcon: "_headingIcon_1y43c_13 _headingIcon_17elq_353",
|
|
1843
|
+
sectionHeading: "_sectionHeading_1y43c_16 _sectionHeading_17elq_330",
|
|
1844
|
+
section: "_section_1y43c_16 _section_17elq_170",
|
|
1845
|
+
metrics: "_metrics_1y43c_22",
|
|
1846
|
+
issueList: "_issueList_1y43c_45",
|
|
1847
|
+
performanceIssue: "_performanceIssue_1y43c_50",
|
|
1848
|
+
memoryChart: "_memoryChart_1y43c_62"
|
|
1849
|
+
};
|
|
1850
|
+
//#endregion
|
|
1851
|
+
//#region src/pages/assistant/components/PerformancePanel/index.tsx
|
|
1852
|
+
function dt({ metrics: e, data: t, now: r, paused: i, offline: a }) {
|
|
1853
|
+
let o = f(e, t, r), s = t.heapSamples, c = s.at(-1), l = Math.min(...s.map((e) => e.used)), u = Math.max(...s.map((e) => e.used)), d = s[0]?.time ?? r, p = s.map((e) => `${4 + (e.time - d) / Math.max(1, (c?.time ?? r) - d) * 592},${76 - (e.used - l) / Math.max(1048576, u - l) * 60}`).join(" ");
|
|
1854
|
+
return /* @__PURE__ */ H("div", {
|
|
1855
|
+
className: $.section,
|
|
1856
|
+
"data-assistant-part": "section",
|
|
1857
|
+
children: [
|
|
1858
|
+
/* @__PURE__ */ H("div", {
|
|
1859
|
+
className: $.sectionHeading,
|
|
1860
|
+
"data-assistant-part": "section-heading",
|
|
1861
|
+
children: [
|
|
1862
|
+
/* @__PURE__ */ V("span", {
|
|
1863
|
+
className: $.headingIcon,
|
|
1864
|
+
"data-assistant-part": "heading-icon",
|
|
1865
|
+
children: /* @__PURE__ */ V(ce, {})
|
|
1866
|
+
}),
|
|
1867
|
+
/* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("h3", { children: "性能诊断" }), /* @__PURE__ */ V("p", { children: "加载体验、主线程卡顿与内存增长风险" })] }),
|
|
1868
|
+
/* @__PURE__ */ V(A, { children: a ? "快照分析" : i ? "采集已暂停" : "自动监测中" })
|
|
1869
|
+
]
|
|
1870
|
+
}),
|
|
1871
|
+
/* @__PURE__ */ V(y, {
|
|
1872
|
+
showIcon: !0,
|
|
1873
|
+
type: o.length ? "warning" : "info",
|
|
1874
|
+
title: o.length ? `${o.length} 项需要关注` : "当前采样未触发告警",
|
|
1875
|
+
description: a ? "仅分析这份快照中的数据;旧快照可能没有连续内存采样。" : "小蜜收起时也会监测;告警显示在入口,并记录到时间线。未触发规则不代表不存在性能问题。"
|
|
1876
|
+
}),
|
|
1877
|
+
/* @__PURE__ */ V("div", {
|
|
1878
|
+
className: $.issueList,
|
|
1879
|
+
"data-assistant-part": "issue-list",
|
|
1880
|
+
children: o.map((e) => /* @__PURE__ */ H(S, {
|
|
1881
|
+
className: [$.card, $.performanceIssue].join(" "),
|
|
1882
|
+
"data-assistant-part": "card performance-issue",
|
|
1883
|
+
styles: { body: {
|
|
1884
|
+
padding: 0,
|
|
1885
|
+
display: "flex",
|
|
1886
|
+
flexDirection: "column",
|
|
1887
|
+
gap: 16
|
|
1888
|
+
} },
|
|
1889
|
+
children: [
|
|
1890
|
+
/* @__PURE__ */ V("div", {
|
|
1891
|
+
className: $.cardHeading,
|
|
1892
|
+
"data-assistant-part": "card-heading",
|
|
1893
|
+
children: /* @__PURE__ */ H("h3", { children: [/* @__PURE__ */ V(A, {
|
|
1894
|
+
color: e.severity === "error" ? "red" : "orange",
|
|
1895
|
+
children: e.severity === "error" ? "较高风险" : "需关注"
|
|
1896
|
+
}), e.title] })
|
|
1897
|
+
}),
|
|
1898
|
+
/* @__PURE__ */ V("p", { children: e.evidence }),
|
|
1899
|
+
/* @__PURE__ */ V(w, {
|
|
1900
|
+
ghost: !0,
|
|
1901
|
+
size: "small",
|
|
1902
|
+
styles: {
|
|
1903
|
+
header: {
|
|
1904
|
+
padding: 0,
|
|
1905
|
+
fontSize: 12,
|
|
1906
|
+
lineHeight: "inherit"
|
|
1907
|
+
},
|
|
1908
|
+
body: { padding: "8px 0 0" }
|
|
1909
|
+
},
|
|
1910
|
+
items: [{
|
|
1911
|
+
key: "details",
|
|
1912
|
+
label: /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(re, {}), " 排查建议与触发依据"] }),
|
|
1913
|
+
children: /* @__PURE__ */ H(B, { children: [
|
|
1914
|
+
/* @__PURE__ */ V("ol", { children: e.suggestions.map((e) => /* @__PURE__ */ V("li", { children: e }, e)) }),
|
|
1915
|
+
/* @__PURE__ */ V("p", {
|
|
1916
|
+
className: $.hint,
|
|
1917
|
+
"data-assistant-part": "hint",
|
|
1918
|
+
children: e.rule
|
|
1919
|
+
}),
|
|
1920
|
+
/* @__PURE__ */ H("a", {
|
|
1921
|
+
href: e.url,
|
|
1922
|
+
target: "_blank",
|
|
1923
|
+
rel: "noreferrer",
|
|
1924
|
+
children: [/* @__PURE__ */ V(xe, {}), " 查看官方排查文档"]
|
|
1925
|
+
})
|
|
1926
|
+
] })
|
|
1927
|
+
}]
|
|
1928
|
+
})
|
|
1929
|
+
]
|
|
1930
|
+
}, e.id))
|
|
1931
|
+
}),
|
|
1932
|
+
/* @__PURE__ */ H(S, {
|
|
1933
|
+
className: $.card,
|
|
1934
|
+
"data-assistant-part": "card",
|
|
1935
|
+
styles: { body: {
|
|
1936
|
+
padding: 0,
|
|
1937
|
+
display: "flex",
|
|
1938
|
+
flexDirection: "column",
|
|
1939
|
+
gap: 16
|
|
1940
|
+
} },
|
|
1941
|
+
children: [
|
|
1942
|
+
/* @__PURE__ */ H("div", {
|
|
1943
|
+
className: $.cardHeading,
|
|
1944
|
+
"data-assistant-part": "card-heading",
|
|
1945
|
+
children: [/* @__PURE__ */ V("h3", { children: "JS 堆内存趋势" }), /* @__PURE__ */ V("span", { children: c ? n(c.used) : "暂无采样" })]
|
|
1946
|
+
}),
|
|
1947
|
+
s.length > 1 ? /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ H("svg", {
|
|
1948
|
+
className: $.memoryChart,
|
|
1949
|
+
"data-assistant-part": "memory-chart",
|
|
1950
|
+
viewBox: "0 0 600 90",
|
|
1951
|
+
role: "img",
|
|
1952
|
+
"aria-label": `内存趋势,最低 ${n(l)},最高 ${n(u)},当前 ${n(c.used)}`,
|
|
1953
|
+
children: [/* @__PURE__ */ V("path", {
|
|
1954
|
+
d: "M4 76 H596",
|
|
1955
|
+
stroke: "currentColor",
|
|
1956
|
+
opacity: ".2"
|
|
1957
|
+
}), /* @__PURE__ */ V("polyline", {
|
|
1958
|
+
points: p,
|
|
1959
|
+
fill: "none",
|
|
1960
|
+
stroke: "currentColor",
|
|
1961
|
+
strokeWidth: "2",
|
|
1962
|
+
vectorEffect: "non-scaling-stroke"
|
|
1963
|
+
})]
|
|
1964
|
+
}), /* @__PURE__ */ H("div", {
|
|
1965
|
+
className: $.cardHeading,
|
|
1966
|
+
"data-assistant-part": "card-heading",
|
|
1967
|
+
children: [/* @__PURE__ */ H("span", { children: [
|
|
1968
|
+
new Date(d).toLocaleTimeString(),
|
|
1969
|
+
" · ",
|
|
1970
|
+
n(l)
|
|
1971
|
+
] }), /* @__PURE__ */ H("span", { children: [
|
|
1972
|
+
new Date(c.time).toLocaleTimeString(),
|
|
1973
|
+
" · 峰值 ",
|
|
1974
|
+
n(u)
|
|
1975
|
+
] })]
|
|
1976
|
+
})] }) : /* @__PURE__ */ V("p", {
|
|
1977
|
+
className: $.hint,
|
|
1978
|
+
"data-assistant-part": "hint",
|
|
1979
|
+
children: c ? "正在积累连续采样,持续增长风险至少需要观察 60 秒。" : "当前没有可用的连续内存数据。浏览器不支持 performance.memory、采集暂停或旧快照均可能导致此状态。"
|
|
1980
|
+
}),
|
|
1981
|
+
/* @__PURE__ */ V("p", {
|
|
1982
|
+
className: $.hint,
|
|
1983
|
+
"data-assistant-part": "hint",
|
|
1984
|
+
children: "前台每 5 秒采样,最多保留 15 分钟。JS 堆统计是近似值,不含全部页面内存;增长告警仅提供线索,需通过 DevTools 堆快照确认泄漏。"
|
|
1985
|
+
})
|
|
1986
|
+
]
|
|
1987
|
+
}),
|
|
1988
|
+
/* @__PURE__ */ H("h3", {
|
|
1989
|
+
className: $.subheading,
|
|
1990
|
+
"data-assistant-part": "subheading",
|
|
1991
|
+
children: [/* @__PURE__ */ V(ce, {}), " 页面指标"]
|
|
1992
|
+
}),
|
|
1993
|
+
/* @__PURE__ */ V("div", {
|
|
1994
|
+
className: $.metrics,
|
|
1995
|
+
"data-assistant-part": "metrics",
|
|
1996
|
+
children: [
|
|
1997
|
+
["TTFB", "首字节"],
|
|
1998
|
+
["FCP", "首次内容绘制"],
|
|
1999
|
+
["LCP", "最大内容绘制"],
|
|
2000
|
+
["CLS", "布局偏移"],
|
|
2001
|
+
["DOMContentLoaded", "DOM 就绪"],
|
|
2002
|
+
["load", "页面加载"],
|
|
2003
|
+
["longTasks", "长任务次数"],
|
|
2004
|
+
["longTaskDuration", "长任务总耗时"]
|
|
2005
|
+
].map(([t, n]) => /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ H("span", { children: [
|
|
2006
|
+
n,
|
|
2007
|
+
" · ",
|
|
2008
|
+
t
|
|
2009
|
+
] }), /* @__PURE__ */ V("strong", { children: e[t] == null ? "不可用" : t === "CLS" ? e[t].toFixed(4) : `${Math.round(e[t])}${t === "longTasks" ? " 次" : " ms"}` })] }, t))
|
|
2010
|
+
}),
|
|
2011
|
+
/* @__PURE__ */ V("p", {
|
|
2012
|
+
className: $.hint,
|
|
2013
|
+
"data-assistant-part": "hint",
|
|
2014
|
+
children: "LCP / CLS 是当前文档生命周期内的观测,不随业务路由切换重置;浏览器不支持的指标显示“不可用”,尚未采集完整 INP。"
|
|
2015
|
+
})
|
|
2016
|
+
]
|
|
2017
|
+
});
|
|
2018
|
+
}
|
|
2019
|
+
//#endregion
|
|
2020
|
+
//#region src/pages/assistant/index.tsx
|
|
2021
|
+
function ft({ value: e }) {
|
|
2022
|
+
return /* @__PURE__ */ V("pre", {
|
|
2023
|
+
className: G.json,
|
|
2024
|
+
"data-assistant-part": "json",
|
|
2025
|
+
children: JSON.stringify(e, null, 2)
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2028
|
+
var pt = (e) => new Date(e).toLocaleTimeString("zh-CN", { hour12: !1 });
|
|
2029
|
+
function mt({ developer: n = !0, bridgeUrl: i = "/__laya-pilot" } = {}) {
|
|
2030
|
+
let a = v(r.subscribe, r.getState), c = v(d.subscribe, d.getState), [m, h] = _(!1), [S, C] = _("feedback"), [ee, D] = _("timeline"), O = g(null), te = () => {
|
|
2031
|
+
h(!1), requestAnimationFrame(() => O.current?.focus({ preventScroll: !0 }));
|
|
2032
|
+
}, [re, N] = _(""), [ae, P] = _(""), [se, he] = _(null), [F, I] = _("live"), [_e, ve] = _(s);
|
|
2033
|
+
p(() => {
|
|
2034
|
+
if (!m) return;
|
|
2035
|
+
let e = setInterval(() => ve(s()), 2e3);
|
|
2036
|
+
return () => clearInterval(e);
|
|
2037
|
+
}, [m]);
|
|
2038
|
+
let L = F === "imported" ? se : F === "frozen" ? a.frozen : null, xe = L?.events ?? a.events, R = L?.requests ?? a.requests, Te = L?.metrics ?? a.metrics, Oe = L?.environment ?? _e, z = a.frozen, ke = /* @__PURE__ */ H("div", {
|
|
2039
|
+
className: G.section,
|
|
2040
|
+
"data-assistant-part": "section",
|
|
2041
|
+
children: [
|
|
2042
|
+
/* @__PURE__ */ H("div", {
|
|
2043
|
+
className: G.intro,
|
|
2044
|
+
"data-assistant-part": "intro",
|
|
2045
|
+
children: [
|
|
2046
|
+
/* @__PURE__ */ H("div", {
|
|
2047
|
+
className: G.eyebrow,
|
|
2048
|
+
"data-assistant-part": "eyebrow",
|
|
2049
|
+
children: [/* @__PURE__ */ V(De, {}), "你的问题排查工作台"]
|
|
2050
|
+
}),
|
|
2051
|
+
/* @__PURE__ */ V("span", { children: "问题现场,一键留存" }),
|
|
2052
|
+
/* @__PURE__ */ V("p", { children: "操作轨迹、接口与异常,在这里串成线索。" })
|
|
2053
|
+
]
|
|
2054
|
+
}),
|
|
2055
|
+
/* @__PURE__ */ H("div", {
|
|
2056
|
+
className: G.stats,
|
|
2057
|
+
"data-assistant-part": "stats",
|
|
2058
|
+
children: [
|
|
2059
|
+
/* @__PURE__ */ H("div", { children: [/* @__PURE__ */ H("strong", { children: [xe.length, /* @__PURE__ */ V("small", { children: "条" })] }), /* @__PURE__ */ H("span", {
|
|
2060
|
+
className: G.statLabel,
|
|
2061
|
+
"data-assistant-part": "stat-label",
|
|
2062
|
+
children: [/* @__PURE__ */ V(ye, {}), "操作与事件"]
|
|
2063
|
+
})] }),
|
|
2064
|
+
/* @__PURE__ */ H("div", { children: [/* @__PURE__ */ H("strong", { children: [R.length, /* @__PURE__ */ V("small", { children: "条" })] }), /* @__PURE__ */ H("span", {
|
|
2065
|
+
className: G.statLabel,
|
|
2066
|
+
"data-assistant-part": "stat-label",
|
|
2067
|
+
children: [/* @__PURE__ */ V(ne, {}), "接口记录"]
|
|
2068
|
+
})] }),
|
|
2069
|
+
/* @__PURE__ */ H("div", {
|
|
2070
|
+
className: R.some((e) => e.failed) ? G.hasErrors : "",
|
|
2071
|
+
children: [/* @__PURE__ */ H("strong", { children: [R.filter((e) => e.failed).length, /* @__PURE__ */ V("small", { children: "条" })] }), /* @__PURE__ */ H("span", {
|
|
2072
|
+
className: G.statLabel,
|
|
2073
|
+
"data-assistant-part": "stat-label",
|
|
2074
|
+
children: [/* @__PURE__ */ V(Ne, {}), "失败接口"]
|
|
2075
|
+
})]
|
|
2076
|
+
})
|
|
2077
|
+
]
|
|
2078
|
+
}),
|
|
2079
|
+
/* @__PURE__ */ H("div", {
|
|
2080
|
+
className: [G.buttonRow, G.actions].join(" "),
|
|
2081
|
+
"data-assistant-part": "button-row actions",
|
|
2082
|
+
children: [/* @__PURE__ */ V(x, {
|
|
2083
|
+
type: "primary",
|
|
2084
|
+
icon: /* @__PURE__ */ V(ie, {}),
|
|
2085
|
+
onClick: () => {
|
|
2086
|
+
u("用户手动截取现场"), I("frozen"), P("已冻结现场。后续操作不会改变这份快照。");
|
|
2087
|
+
},
|
|
2088
|
+
children: "截取当前现场"
|
|
2089
|
+
}), /* @__PURE__ */ V(x, {
|
|
2090
|
+
icon: /* @__PURE__ */ V(de, {}),
|
|
2091
|
+
onClick: () => {
|
|
2092
|
+
let t = L ?? a.frozen ?? e();
|
|
2093
|
+
o(t, re), P(`已导出 ${pt(t.capturedAt)} 的快照,请将 JSON 文件发送给研发人员。`);
|
|
2094
|
+
},
|
|
2095
|
+
children: "导出快照 JSON"
|
|
2096
|
+
})]
|
|
2097
|
+
}),
|
|
2098
|
+
/* @__PURE__ */ V(y, {
|
|
2099
|
+
type: z ? "warning" : "info",
|
|
2100
|
+
showIcon: !0,
|
|
2101
|
+
title: z ? `已保留现场 · ${pt(z.capturedAt)} · ${z.reason}` : "异常时自动保留现场,刷新或关闭前请导出。"
|
|
2102
|
+
}),
|
|
2103
|
+
/* @__PURE__ */ H("div", {
|
|
2104
|
+
className: G.field,
|
|
2105
|
+
"data-assistant-part": "field",
|
|
2106
|
+
children: [/* @__PURE__ */ H("label", {
|
|
2107
|
+
htmlFor: "research-feedback",
|
|
2108
|
+
children: [/* @__PURE__ */ V(fe, {}), "问题描述"]
|
|
2109
|
+
}), /* @__PURE__ */ V(E.TextArea, {
|
|
2110
|
+
id: "research-feedback",
|
|
2111
|
+
value: re,
|
|
2112
|
+
onChange: (e) => N(e.target.value),
|
|
2113
|
+
maxLength: 1e3,
|
|
2114
|
+
showCount: !0,
|
|
2115
|
+
rows: 3,
|
|
2116
|
+
placeholder: "例如:修改表单后点击保存,出现错误提示。"
|
|
2117
|
+
})]
|
|
2118
|
+
}),
|
|
2119
|
+
/* @__PURE__ */ V("p", {
|
|
2120
|
+
className: G.hint,
|
|
2121
|
+
"data-assistant-part": "hint",
|
|
2122
|
+
children: L ? `当前查看:${L.reason} · ${pt(L.capturedAt)}` : z ? "直接导出会使用最近保留的现场。需要最新状态时,请先手动截取。" : "当前没有冻结现场,直接导出会截取此刻状态。"
|
|
2123
|
+
}),
|
|
2124
|
+
/* @__PURE__ */ V(w, {
|
|
2125
|
+
ghost: !0,
|
|
2126
|
+
size: "small",
|
|
2127
|
+
styles: {
|
|
2128
|
+
header: {
|
|
2129
|
+
padding: 0,
|
|
2130
|
+
fontSize: 12,
|
|
2131
|
+
lineHeight: "inherit"
|
|
2132
|
+
},
|
|
2133
|
+
body: { padding: "8px 0 0" }
|
|
2134
|
+
},
|
|
2135
|
+
items: [{
|
|
2136
|
+
key: "details",
|
|
2137
|
+
label: /* @__PURE__ */ V(B, { children: "快照包含哪些内容" }),
|
|
2138
|
+
children: /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("p", { children: "最近 15 分钟内最多 300 条事件、60 条接口记录,页面地址与布局信息、浏览器环境、性能指标及已脱敏的 JSON 正文。页面状态快照不包含屏幕截图或输入框值。" }), /* @__PURE__ */ V("p", { children: "数据只在当前页面内存中保存,不自动上传。字段脱敏无法识别所有业务敏感内容,分享前可先查看导出的 JSON。" })] })
|
|
2139
|
+
}]
|
|
2140
|
+
})
|
|
2141
|
+
]
|
|
2142
|
+
}), Ae = /* @__PURE__ */ V(at, {
|
|
2143
|
+
events: xe,
|
|
2144
|
+
onDraft: () => C("automation")
|
|
2145
|
+
}, 0 + F + (L?.capturedAt ?? "live")), Me = /* @__PURE__ */ H("div", {
|
|
2146
|
+
className: G.section,
|
|
2147
|
+
"data-assistant-part": "section",
|
|
2148
|
+
children: [
|
|
2149
|
+
/* @__PURE__ */ H("div", {
|
|
2150
|
+
className: G.sectionHeading,
|
|
2151
|
+
"data-assistant-part": "section-heading",
|
|
2152
|
+
children: [
|
|
2153
|
+
/* @__PURE__ */ V("span", {
|
|
2154
|
+
className: G.headingIcon,
|
|
2155
|
+
"data-assistant-part": "heading-icon",
|
|
2156
|
+
children: /* @__PURE__ */ V(ne, {})
|
|
2157
|
+
}),
|
|
2158
|
+
/* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("h3", { children: "接口记录" }), /* @__PURE__ */ V("p", { children: "查看请求状态、耗时与响应详情。" })] }),
|
|
2159
|
+
/* @__PURE__ */ H(A, { children: [R.length, " 条"] })
|
|
2160
|
+
]
|
|
2161
|
+
}),
|
|
2162
|
+
/* @__PURE__ */ V("p", {
|
|
2163
|
+
className: G.hint,
|
|
2164
|
+
"data-assistant-part": "hint",
|
|
2165
|
+
children: "Fetch / XHR · 正文最多读取 16 KB · 认证接口不采集正文 · 耗时为响应头到达(Fetch)或请求结束(XHR)"
|
|
2166
|
+
}),
|
|
2167
|
+
!R.length && /* @__PURE__ */ V(T, { description: "暂无接口记录" }),
|
|
2168
|
+
R.slice().sort((e, t) => e.time - t.time).map((e) => /* @__PURE__ */ V(w, {
|
|
2169
|
+
className: G.request,
|
|
2170
|
+
"data-assistant-part": "request",
|
|
2171
|
+
ghost: !0,
|
|
2172
|
+
size: "small",
|
|
2173
|
+
styles: {
|
|
2174
|
+
header: {
|
|
2175
|
+
padding: 0,
|
|
2176
|
+
fontSize: 12,
|
|
2177
|
+
lineHeight: "inherit"
|
|
2178
|
+
},
|
|
2179
|
+
body: { padding: "8px 0 0" }
|
|
2180
|
+
},
|
|
2181
|
+
items: [{
|
|
2182
|
+
key: "details",
|
|
2183
|
+
label: /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ H("span", {
|
|
2184
|
+
className: G.requestMeta,
|
|
2185
|
+
"data-assistant-part": "request-meta",
|
|
2186
|
+
children: [
|
|
2187
|
+
/* @__PURE__ */ V(A, {
|
|
2188
|
+
color: e.failed ? "red" : "green",
|
|
2189
|
+
children: e.status || "失败"
|
|
2190
|
+
}),
|
|
2191
|
+
/* @__PURE__ */ V("b", { children: e.method }),
|
|
2192
|
+
" ",
|
|
2193
|
+
/* @__PURE__ */ H("span", { children: [
|
|
2194
|
+
/* @__PURE__ */ V(me, {}),
|
|
2195
|
+
Math.round(e.duration),
|
|
2196
|
+
" ms"
|
|
2197
|
+
] })
|
|
2198
|
+
]
|
|
2199
|
+
}), /* @__PURE__ */ V("span", {
|
|
2200
|
+
className: G.requestUrl,
|
|
2201
|
+
"data-assistant-part": "request-url",
|
|
2202
|
+
children: e.url
|
|
2203
|
+
})] }),
|
|
2204
|
+
children: /* @__PURE__ */ V(B, { children: /* @__PURE__ */ V(ft, { value: e }) })
|
|
2205
|
+
}]
|
|
2206
|
+
}, e.id))
|
|
2207
|
+
]
|
|
2208
|
+
}), Pe = L ? L.performance ?? t() : a.performance, U = L ? Date.parse(L.capturedAt) : a.performanceUpdatedAt, Fe = f(Te, Pe, U), W = f(a.metrics, a.performance, a.performanceUpdatedAt).length, Ie = /* @__PURE__ */ V(dt, {
|
|
2209
|
+
metrics: Te,
|
|
2210
|
+
data: Pe,
|
|
2211
|
+
now: U,
|
|
2212
|
+
paused: a.paused,
|
|
2213
|
+
offline: !!L
|
|
2214
|
+
}), Le = /* @__PURE__ */ H("div", {
|
|
2215
|
+
className: G.section,
|
|
2216
|
+
"data-assistant-part": "section",
|
|
2217
|
+
children: [
|
|
2218
|
+
/* @__PURE__ */ H("div", {
|
|
2219
|
+
className: G.sectionHeading,
|
|
2220
|
+
"data-assistant-part": "section-heading",
|
|
2221
|
+
children: [/* @__PURE__ */ V("span", {
|
|
2222
|
+
className: G.headingIcon,
|
|
2223
|
+
"data-assistant-part": "heading-icon",
|
|
2224
|
+
children: /* @__PURE__ */ V(ue, {})
|
|
2225
|
+
}), /* @__PURE__ */ H("div", { children: [/* @__PURE__ */ V("h3", { children: "环境与数据" }), /* @__PURE__ */ V("p", { children: "浏览器环境和现场信息,集中查看。" })] })]
|
|
2226
|
+
}),
|
|
2227
|
+
/* @__PURE__ */ V(y, {
|
|
2228
|
+
showIcon: !0,
|
|
2229
|
+
type: "info",
|
|
2230
|
+
title: "只读浏览器信息;不采集 Cookie、localStorage、sessionStorage 的值。"
|
|
2231
|
+
}),
|
|
2232
|
+
/* @__PURE__ */ V(ft, { value: Oe }),
|
|
2233
|
+
L && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("h3", { children: "现场页面状态" }), /* @__PURE__ */ V(ft, { value: L.page })] })
|
|
2234
|
+
]
|
|
2235
|
+
}), Re = /* @__PURE__ */ H("div", {
|
|
2236
|
+
className: G.section,
|
|
2237
|
+
"data-assistant-part": "section",
|
|
2238
|
+
children: [/* @__PURE__ */ V(T, { description: "知识库问答待接入" }), /* @__PURE__ */ V("p", {
|
|
2239
|
+
className: G.hint,
|
|
2240
|
+
"data-assistant-part": "hint",
|
|
2241
|
+
children: "已预留问答适配接口。后续可接入使用手册、常见问题和研发文档;当前不会发送问题或快照到任何服务。"
|
|
2242
|
+
})]
|
|
2243
|
+
});
|
|
2244
|
+
return /* @__PURE__ */ H("div", {
|
|
2245
|
+
"data-research-assistant": !0,
|
|
2246
|
+
children: [/* @__PURE__ */ H("div", {
|
|
2247
|
+
className: G.dock,
|
|
2248
|
+
"data-assistant-part": "dock",
|
|
2249
|
+
"data-recording": c.recording,
|
|
2250
|
+
hidden: m,
|
|
2251
|
+
children: [/* @__PURE__ */ V(j, {
|
|
2252
|
+
title: c.recording ? `研发小蜜 · 录制中 ${c.draft.steps.length} 步` : W ? `研发小蜜 · ${W} 项性能告警` : a.frozen ? "研发小蜜 · 已保留异常现场" : "研发小蜜",
|
|
2253
|
+
children: /* @__PURE__ */ V(b, {
|
|
2254
|
+
dot: c.recording || !!a.frozen || W > 0,
|
|
2255
|
+
color: c.recording ? "red" : "orange",
|
|
2256
|
+
offset: [-5, 5],
|
|
2257
|
+
children: /* @__PURE__ */ V(x, {
|
|
2258
|
+
ref: O,
|
|
2259
|
+
className: G.launcher,
|
|
2260
|
+
"data-assistant-part": "launcher",
|
|
2261
|
+
"aria-label": "打开研发小蜜",
|
|
2262
|
+
"aria-expanded": m,
|
|
2263
|
+
"aria-controls": "research-assistant-window",
|
|
2264
|
+
onClick: () => {
|
|
2265
|
+
h(!0), ve(s());
|
|
2266
|
+
},
|
|
2267
|
+
icon: /* @__PURE__ */ V(st, { className: G.launcherAvatar })
|
|
2268
|
+
})
|
|
2269
|
+
})
|
|
2270
|
+
}), /* @__PURE__ */ V("span", {
|
|
2271
|
+
className: G.srOnly,
|
|
2272
|
+
"data-assistant-part": "sr-only",
|
|
2273
|
+
role: "status",
|
|
2274
|
+
children: c.recording ? `录制中 ${c.draft.steps.length} 步` : W ? `${W} 项性能告警` : a.frozen ? "已保留异常现场" : ""
|
|
2275
|
+
})]
|
|
2276
|
+
}), /* @__PURE__ */ V(ut, {
|
|
2277
|
+
open: m,
|
|
2278
|
+
onMinimize: te,
|
|
2279
|
+
developer: n,
|
|
2280
|
+
children: /* @__PURE__ */ H("div", {
|
|
2281
|
+
"data-research-assistant": !0,
|
|
2282
|
+
className: G.body,
|
|
2283
|
+
"data-assistant-part": "body",
|
|
2284
|
+
children: [
|
|
2285
|
+
/* @__PURE__ */ H("div", {
|
|
2286
|
+
className: G.toolbar,
|
|
2287
|
+
"data-assistant-part": "toolbar",
|
|
2288
|
+
children: [/* @__PURE__ */ H("span", { children: [/* @__PURE__ */ V("i", { className: a.paused ? G.paused : "" }), L ? "查看离线现场" : a.paused ? "采集已暂停" : "正在采集 · 仅内存"] }), /* @__PURE__ */ H("div", {
|
|
2289
|
+
className: [G.buttonRow, G.toolbarActions].join(" "),
|
|
2290
|
+
"data-assistant-part": "button-row toolbar-actions",
|
|
2291
|
+
children: [/* @__PURE__ */ V(x, {
|
|
2292
|
+
type: "text",
|
|
2293
|
+
size: "small",
|
|
2294
|
+
icon: a.paused ? /* @__PURE__ */ V(we, {}) : /* @__PURE__ */ V(Ce, {}),
|
|
2295
|
+
onClick: () => r.pause(!a.paused),
|
|
2296
|
+
children: a.paused ? "继续采集" : "暂停采集"
|
|
2297
|
+
}), /* @__PURE__ */ V(x, {
|
|
2298
|
+
size: "small",
|
|
2299
|
+
type: "text",
|
|
2300
|
+
icon: /* @__PURE__ */ V(le, {}),
|
|
2301
|
+
onClick: () => {
|
|
2302
|
+
r.clear(), I("live"), he(null), P("内存记录已清空");
|
|
2303
|
+
},
|
|
2304
|
+
children: "清空记录"
|
|
2305
|
+
})]
|
|
2306
|
+
})]
|
|
2307
|
+
}),
|
|
2308
|
+
ae && /* @__PURE__ */ V(y, {
|
|
2309
|
+
closable: !0,
|
|
2310
|
+
title: ae,
|
|
2311
|
+
type: "info",
|
|
2312
|
+
onClose: () => P("")
|
|
2313
|
+
}),
|
|
2314
|
+
L?.feedback && /* @__PURE__ */ V(y, {
|
|
2315
|
+
title: "快照中的问题描述",
|
|
2316
|
+
description: L.feedback,
|
|
2317
|
+
type: "info"
|
|
2318
|
+
}),
|
|
2319
|
+
n && /* @__PURE__ */ H("div", {
|
|
2320
|
+
className: G.sources,
|
|
2321
|
+
"data-assistant-part": "sources",
|
|
2322
|
+
children: [
|
|
2323
|
+
/* @__PURE__ */ V(x, {
|
|
2324
|
+
size: "small",
|
|
2325
|
+
icon: /* @__PURE__ */ V(ye, {}),
|
|
2326
|
+
type: F === "live" ? "primary" : "default",
|
|
2327
|
+
onClick: () => I("live"),
|
|
2328
|
+
children: "实时记录"
|
|
2329
|
+
}),
|
|
2330
|
+
/* @__PURE__ */ V(x, {
|
|
2331
|
+
size: "small",
|
|
2332
|
+
icon: /* @__PURE__ */ V(ie, {}),
|
|
2333
|
+
disabled: !a.frozen,
|
|
2334
|
+
type: F === "frozen" ? "primary" : "default",
|
|
2335
|
+
onClick: () => I("frozen"),
|
|
2336
|
+
children: "已冻结现场"
|
|
2337
|
+
}),
|
|
2338
|
+
/* @__PURE__ */ V(M, {
|
|
2339
|
+
accept: ".json,application/json",
|
|
2340
|
+
showUploadList: !1,
|
|
2341
|
+
beforeUpload: async (e) => {
|
|
2342
|
+
try {
|
|
2343
|
+
if (e.size > 2 * 1024 * 1024) throw Error("快照不能超过 2 MB");
|
|
2344
|
+
he(l(await e.text())), I("imported"), C("diagnostics"), D("timeline"), P("已载入本地快照,未上传文件");
|
|
2345
|
+
} catch (e) {
|
|
2346
|
+
P(e instanceof Error ? e.message : "快照读取失败");
|
|
2347
|
+
}
|
|
2348
|
+
return M.LIST_IGNORE;
|
|
2349
|
+
},
|
|
2350
|
+
children: /* @__PURE__ */ V(x, {
|
|
2351
|
+
size: "small",
|
|
2352
|
+
icon: /* @__PURE__ */ V(je, {}),
|
|
2353
|
+
children: "导入 JSON"
|
|
2354
|
+
})
|
|
2355
|
+
}),
|
|
2356
|
+
se && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V(x, {
|
|
2357
|
+
size: "small",
|
|
2358
|
+
icon: /* @__PURE__ */ V(ge, {}),
|
|
2359
|
+
type: F === "imported" ? "primary" : "default",
|
|
2360
|
+
onClick: () => I("imported"),
|
|
2361
|
+
children: "导入的现场"
|
|
2362
|
+
}), /* @__PURE__ */ V(x, {
|
|
2363
|
+
"aria-label": "关闭导入现场",
|
|
2364
|
+
size: "small",
|
|
2365
|
+
icon: /* @__PURE__ */ V(oe, {}),
|
|
2366
|
+
onClick: () => {
|
|
2367
|
+
he(null), I("live");
|
|
2368
|
+
}
|
|
2369
|
+
})] })
|
|
2370
|
+
]
|
|
2371
|
+
}),
|
|
2372
|
+
n && !L && W > 0 && !(S === "diagnostics" && ee === "performance") && /* @__PURE__ */ V(y, {
|
|
2373
|
+
showIcon: !0,
|
|
2374
|
+
type: "warning",
|
|
2375
|
+
title: `${W} 项性能告警`,
|
|
2376
|
+
action: /* @__PURE__ */ V(x, {
|
|
2377
|
+
size: "small",
|
|
2378
|
+
onClick: () => {
|
|
2379
|
+
C("diagnostics"), D("performance");
|
|
2380
|
+
},
|
|
2381
|
+
children: "查看诊断"
|
|
2382
|
+
})
|
|
2383
|
+
}),
|
|
2384
|
+
/* @__PURE__ */ V(k, {
|
|
2385
|
+
className: G.mainTabs,
|
|
2386
|
+
"data-assistant-part": "main-tabs",
|
|
2387
|
+
activeKey: S,
|
|
2388
|
+
onChange: C,
|
|
2389
|
+
items: [
|
|
2390
|
+
{
|
|
2391
|
+
key: "feedback",
|
|
2392
|
+
label: "问题反馈",
|
|
2393
|
+
icon: /* @__PURE__ */ V(Se, { "aria-hidden": !0 }),
|
|
2394
|
+
children: ke
|
|
2395
|
+
},
|
|
2396
|
+
...n ? [{
|
|
2397
|
+
key: "automation",
|
|
2398
|
+
label: "自动化测试",
|
|
2399
|
+
icon: /* @__PURE__ */ V(pe, { "aria-hidden": !0 }),
|
|
2400
|
+
children: /* @__PURE__ */ V(et, {
|
|
2401
|
+
close: te,
|
|
2402
|
+
bridgeUrl: i
|
|
2403
|
+
})
|
|
2404
|
+
}, {
|
|
2405
|
+
key: "diagnostics",
|
|
2406
|
+
label: "诊断",
|
|
2407
|
+
icon: /* @__PURE__ */ V(be, { "aria-hidden": !0 }),
|
|
2408
|
+
children: /* @__PURE__ */ V(k, {
|
|
2409
|
+
className: G.diagnosticTabs,
|
|
2410
|
+
"data-assistant-part": "diagnostic-tabs",
|
|
2411
|
+
activeKey: ee,
|
|
2412
|
+
onChange: D,
|
|
2413
|
+
items: [
|
|
2414
|
+
{
|
|
2415
|
+
key: "timeline",
|
|
2416
|
+
label: "时间线",
|
|
2417
|
+
icon: /* @__PURE__ */ V(ye, { "aria-hidden": !0 }),
|
|
2418
|
+
children: Ae
|
|
2419
|
+
},
|
|
2420
|
+
{
|
|
2421
|
+
key: "network",
|
|
2422
|
+
label: "接口",
|
|
2423
|
+
icon: /* @__PURE__ */ V(ne, { "aria-hidden": !0 }),
|
|
2424
|
+
children: Me
|
|
2425
|
+
},
|
|
2426
|
+
{
|
|
2427
|
+
key: "performance",
|
|
2428
|
+
label: Fe.length ? `性能 (${Fe.length})` : "性能",
|
|
2429
|
+
icon: /* @__PURE__ */ V(ce, { "aria-hidden": !0 }),
|
|
2430
|
+
children: Ie
|
|
2431
|
+
},
|
|
2432
|
+
{
|
|
2433
|
+
key: "data",
|
|
2434
|
+
label: "环境与数据",
|
|
2435
|
+
icon: /* @__PURE__ */ V(ue, { "aria-hidden": !0 }),
|
|
2436
|
+
children: Le
|
|
2437
|
+
}
|
|
2438
|
+
]
|
|
2439
|
+
})
|
|
2440
|
+
}] : [],
|
|
2441
|
+
{
|
|
2442
|
+
key: "knowledge",
|
|
2443
|
+
label: "知识问答",
|
|
2444
|
+
icon: /* @__PURE__ */ V(Ee, { "aria-hidden": !0 }),
|
|
2445
|
+
children: Re
|
|
2446
|
+
}
|
|
2447
|
+
]
|
|
2448
|
+
})
|
|
2449
|
+
]
|
|
2450
|
+
})
|
|
2451
|
+
})]
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2454
|
+
//#endregion
|
|
2455
|
+
//#region src/App.tsx
|
|
2456
|
+
function ht({ developer: e, bridgeUrl: t = "/__laya-pilot", runtimeOptions: n, themeMode: a = "gold-dark" }) {
|
|
2457
|
+
let { isBusinessFailure: o, ignoreRequest: s } = n ?? {};
|
|
2458
|
+
p(() => {
|
|
2459
|
+
if (r.isActive()) throw Error("每页只能启动一个研发小蜜;组件和 SDK 已管理采集,请勿额外调用 startAssistant");
|
|
2460
|
+
let e = new URL(t, location.href), n = e.pathname.replace(/\/$/, "");
|
|
2461
|
+
r.clear(), r.pause(!1), d.clear();
|
|
2462
|
+
let a = i({
|
|
2463
|
+
isBusinessFailure: o,
|
|
2464
|
+
ignoreRequest: (t) => t.origin === e.origin && (t.pathname === n || t.pathname.startsWith(`${n}/`)) || s?.(t) === !0
|
|
2465
|
+
});
|
|
2466
|
+
return () => {
|
|
2467
|
+
d.clear(), r.clear(), r.pause(!1), a();
|
|
2468
|
+
};
|
|
2469
|
+
}, [
|
|
2470
|
+
t,
|
|
2471
|
+
o,
|
|
2472
|
+
s
|
|
2473
|
+
]);
|
|
2474
|
+
let c = h(() => te({
|
|
2475
|
+
themeMode: a,
|
|
2476
|
+
includeCustom: !1
|
|
2477
|
+
}), [a]);
|
|
2478
|
+
return /* @__PURE__ */ V(ee, {
|
|
2479
|
+
themeMode: a,
|
|
2480
|
+
theme: { inherit: !1 },
|
|
2481
|
+
cssVarScope: "research-assistant",
|
|
2482
|
+
prefixCls: "ant",
|
|
2483
|
+
direction: "ltr",
|
|
2484
|
+
componentDisabled: !1,
|
|
2485
|
+
componentSize: "middle",
|
|
2486
|
+
button: {},
|
|
2487
|
+
tag: {},
|
|
2488
|
+
checkbox: {},
|
|
2489
|
+
input: {},
|
|
2490
|
+
textArea: {},
|
|
2491
|
+
inputNumber: {},
|
|
2492
|
+
select: {},
|
|
2493
|
+
form: {},
|
|
2494
|
+
card: {},
|
|
2495
|
+
collapse: {},
|
|
2496
|
+
tabs: {},
|
|
2497
|
+
timeline: {},
|
|
2498
|
+
descriptions: {},
|
|
2499
|
+
pagination: {},
|
|
2500
|
+
upload: {},
|
|
2501
|
+
alert: {},
|
|
2502
|
+
badge: {},
|
|
2503
|
+
tooltip: {},
|
|
2504
|
+
empty: {},
|
|
2505
|
+
flex: {},
|
|
2506
|
+
children: /* @__PURE__ */ V("div", {
|
|
2507
|
+
"data-research-assistant": !0,
|
|
2508
|
+
"data-assistant-part": "scope",
|
|
2509
|
+
className: Be.scope,
|
|
2510
|
+
style: c,
|
|
2511
|
+
children: /* @__PURE__ */ V(mt, {
|
|
2512
|
+
developer: e,
|
|
2513
|
+
bridgeUrl: t
|
|
2514
|
+
})
|
|
2515
|
+
})
|
|
2516
|
+
});
|
|
2517
|
+
}
|
|
2518
|
+
function gt(e = {}) {
|
|
2519
|
+
return /* @__PURE__ */ V(ht, { ...e }, e.sessionKey);
|
|
2520
|
+
}
|
|
2521
|
+
//#endregion
|
|
2522
|
+
export { gt as t };
|
|
2523
|
+
|
|
2524
|
+
//# sourceMappingURL=App-B12hd4tM.js.map
|