@glodon-aiot/dataset-annotation 3.24.0-alpha.5 → 3.24.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/es/components/VLMAnnotationDetail/MarkVLMBoxModal/QADetail/QAGenerationConfig.mjs
CHANGED
|
@@ -1,69 +1,74 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
1
|
+
var re = Object.defineProperty, se = Object.defineProperties;
|
|
2
|
+
var le = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var _ = Object.getOwnPropertySymbols;
|
|
4
|
+
var oe = Object.prototype.hasOwnProperty, ce = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var H = (l, s, i) => s in l ? re(l, s, { enumerable: !0, configurable: !0, writable: !0, value: i }) : l[s] = i, C = (l, s) => {
|
|
6
|
+
for (var i in s || (s = {}))
|
|
7
|
+
oe.call(s, i) && H(l, i, s[i]);
|
|
8
|
+
if (_)
|
|
9
|
+
for (var i of _(s))
|
|
10
|
+
ce.call(s, i) && H(l, i, s[i]);
|
|
11
11
|
return l;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
12
|
+
}, S = (l, s) => se(l, le(s));
|
|
13
|
+
var x = (l, s, i) => new Promise((b, o) => {
|
|
14
|
+
var p = (a) => {
|
|
15
15
|
try {
|
|
16
|
-
g(
|
|
16
|
+
g(i.next(a));
|
|
17
17
|
} catch (m) {
|
|
18
18
|
o(m);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, d = (a) => {
|
|
21
21
|
try {
|
|
22
|
-
g(
|
|
22
|
+
g(i.throw(a));
|
|
23
23
|
} catch (m) {
|
|
24
24
|
o(m);
|
|
25
25
|
}
|
|
26
|
-
}, g = (a) => a.done ?
|
|
27
|
-
g((
|
|
26
|
+
}, g = (a) => a.done ? b(a.value) : Promise.resolve(a.value).then(p, d);
|
|
27
|
+
g((i = i.apply(l, s)).next());
|
|
28
28
|
});
|
|
29
|
-
import { jsxs as
|
|
30
|
-
import { Space as
|
|
31
|
-
import { forwardRef as
|
|
29
|
+
import { jsxs as T, jsx as r } from "react/jsx-runtime";
|
|
30
|
+
import { Space as V, Button as I, Tabs as de, Tooltip as me, Input as J, Modal as fe, message as k } from "antd";
|
|
31
|
+
import { forwardRef as ue, useState as A, useContext as pe, useRef as P, useImperativeHandle as he, useEffect as $ } from "react";
|
|
32
32
|
import R from "../../../Iconfont/index.mjs";
|
|
33
|
-
import
|
|
34
|
-
import { UndoOutlined as
|
|
35
|
-
const
|
|
33
|
+
import ge from "../../../../DatasetContext/index.mjs";
|
|
34
|
+
import { UndoOutlined as Te } from "@ant-design/icons";
|
|
35
|
+
const we = ue((l, s) => {
|
|
36
36
|
const {
|
|
37
|
-
visionId:
|
|
38
|
-
afterChangeTemplates:
|
|
37
|
+
visionId: i,
|
|
38
|
+
afterChangeTemplates: b,
|
|
39
39
|
datasetId: o,
|
|
40
|
-
onActiveIndexChange:
|
|
41
|
-
} = l, [
|
|
40
|
+
onActiveIndexChange: p
|
|
41
|
+
} = l, [d, g] = A(!1), [a, m] = A([]), [N, Q] = A(""), {
|
|
42
42
|
services: {
|
|
43
43
|
cvforceDatahub: u
|
|
44
|
+
},
|
|
45
|
+
featuresConfig: {
|
|
46
|
+
labelManager: w
|
|
47
|
+
} = {
|
|
48
|
+
labelManager: !1
|
|
44
49
|
}
|
|
45
|
-
} =
|
|
46
|
-
if (!o || !
|
|
50
|
+
} = pe(ge), E = !!(w && w.add), h = !!(w && w.edit), M = !!(w && w.delete), F = E || h || M, [j, z] = A(!1), L = P(""), v = P(null), B = () => x(void 0, null, function* () {
|
|
51
|
+
if (!o || !i)
|
|
47
52
|
return;
|
|
48
|
-
const e = yield u == null ? void 0 : u.getDatasetsIdVersionsVid(o,
|
|
49
|
-
var
|
|
50
|
-
return
|
|
51
|
-
id: (
|
|
53
|
+
const e = yield u == null ? void 0 : u.getDatasetsIdVersionsVid(o, i), n = ((e == null ? void 0 : e.qaTemplate) || []).map((c, y) => {
|
|
54
|
+
var f;
|
|
55
|
+
return S(C({}, c), {
|
|
56
|
+
id: (f = c.id) != null ? f : `template_${y}_${Date.now()}`
|
|
52
57
|
});
|
|
53
58
|
});
|
|
54
|
-
return m(n),
|
|
55
|
-
}),
|
|
56
|
-
const t = [...e].sort((n,
|
|
57
|
-
const
|
|
58
|
-
return
|
|
59
|
+
return m(n), L.current = U(n), n.length > 0 && (Q(String(n[0].id)), p == null || p(0)), n;
|
|
60
|
+
}), U = (e) => {
|
|
61
|
+
const t = [...e].sort((n, c) => {
|
|
62
|
+
const y = String(n.id), f = String(c.id);
|
|
63
|
+
return y.localeCompare(f);
|
|
59
64
|
});
|
|
60
65
|
return JSON.stringify(t);
|
|
61
|
-
},
|
|
62
|
-
if (!
|
|
66
|
+
}, K = () => U(a) !== L.current, W = () => new Promise((e) => {
|
|
67
|
+
if (!K()) {
|
|
63
68
|
e(!0);
|
|
64
69
|
return;
|
|
65
70
|
}
|
|
66
|
-
|
|
71
|
+
fe.confirm({
|
|
67
72
|
title: "提示",
|
|
68
73
|
content: "QA生成配置有未保存的更改,确定要离开吗?",
|
|
69
74
|
okText: "确定",
|
|
@@ -72,208 +77,212 @@ const de = ie((l, s) => {
|
|
|
72
77
|
onCancel: () => e(!1)
|
|
73
78
|
});
|
|
74
79
|
});
|
|
75
|
-
|
|
76
|
-
hasUnsavedChanges:
|
|
77
|
-
checkDirtyAndConfirm:
|
|
78
|
-
})),
|
|
79
|
-
!o || !
|
|
80
|
-
}, [o,
|
|
80
|
+
he(s, () => ({
|
|
81
|
+
hasUnsavedChanges: K,
|
|
82
|
+
checkDirtyAndConfirm: W
|
|
83
|
+
})), $(() => {
|
|
84
|
+
!o || !i || (B(), v.current = null);
|
|
85
|
+
}, [o, i]), $(() => {
|
|
86
|
+
h || g(!1);
|
|
87
|
+
}, [h]), $(() => {
|
|
81
88
|
const e = (t) => {
|
|
82
|
-
if (
|
|
89
|
+
if (U(a) !== L.current)
|
|
83
90
|
return t.preventDefault(), t.returnValue = "", "";
|
|
84
91
|
};
|
|
85
92
|
return window.addEventListener("beforeunload", e), () => window.removeEventListener("beforeunload", e);
|
|
86
93
|
}, [a]);
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
return
|
|
90
|
-
if (!o || !
|
|
94
|
+
const D = (e) => `模版${e + 1}`, O = () => x(void 0, null, function* () {
|
|
95
|
+
if (v.current)
|
|
96
|
+
return v.current;
|
|
97
|
+
if (!o || !i)
|
|
91
98
|
return {
|
|
92
99
|
q: "",
|
|
93
100
|
a: ""
|
|
94
101
|
};
|
|
95
102
|
try {
|
|
96
|
-
const e = yield u == null ? void 0 : u.getDefaultQaTemplates(o,
|
|
103
|
+
const e = yield u == null ? void 0 : u.getDefaultQaTemplates(o, i), t = (e == null ? void 0 : e[0]) || {
|
|
97
104
|
q: "",
|
|
98
105
|
a: ""
|
|
99
106
|
};
|
|
100
|
-
return
|
|
107
|
+
return v.current = t, t;
|
|
101
108
|
} catch (e) {
|
|
102
|
-
|
|
109
|
+
k.error("获取默认模板失败");
|
|
103
110
|
const t = {
|
|
104
111
|
q: "",
|
|
105
112
|
a: ""
|
|
106
113
|
};
|
|
107
|
-
return
|
|
114
|
+
return v.current = t, t;
|
|
108
115
|
}
|
|
109
|
-
}),
|
|
110
|
-
const e = yield
|
|
116
|
+
}), X = () => x(void 0, null, function* () {
|
|
117
|
+
const e = yield O(), t = Date.now(), n = [...a, {
|
|
111
118
|
id: t,
|
|
112
|
-
name:
|
|
119
|
+
name: D(a.length),
|
|
113
120
|
q: e.q,
|
|
114
121
|
a: e.a
|
|
115
122
|
}];
|
|
116
|
-
m(n),
|
|
117
|
-
}),
|
|
118
|
-
var
|
|
123
|
+
m(n), Q(String(t)), h && g(!0);
|
|
124
|
+
}), Y = () => {
|
|
125
|
+
var y;
|
|
119
126
|
if (a.length <= 1) {
|
|
120
|
-
|
|
127
|
+
k.warning("至少保留一个模版");
|
|
121
128
|
return;
|
|
122
129
|
}
|
|
123
|
-
const e = a.findIndex((
|
|
124
|
-
name:
|
|
130
|
+
const e = a.findIndex((f) => String(f.id) === N), n = a.filter((f) => String(f.id) !== N).map((f, ie) => S(C({}, f), {
|
|
131
|
+
name: D(ie)
|
|
125
132
|
}));
|
|
126
133
|
m(n);
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
},
|
|
130
|
-
const e =
|
|
134
|
+
const c = Math.min(e, n.length - 1);
|
|
135
|
+
Q(String((y = n[c]) == null ? void 0 : y.id));
|
|
136
|
+
}, Z = () => {
|
|
137
|
+
const e = v.current || {
|
|
131
138
|
q: "",
|
|
132
139
|
a: ""
|
|
133
140
|
};
|
|
134
|
-
m(a.map((t) => String(t.id) ===
|
|
141
|
+
m(a.map((t) => String(t.id) === N ? S(C({}, t), {
|
|
135
142
|
q: e.q,
|
|
136
143
|
a: e.a
|
|
137
144
|
}) : t));
|
|
138
|
-
},
|
|
139
|
-
m(a.map((n) => n.id === e ?
|
|
145
|
+
}, ee = (e, t) => {
|
|
146
|
+
m(a.map((n) => n.id === e ? S(C({}, n), {
|
|
140
147
|
q: t
|
|
141
148
|
}) : n));
|
|
142
|
-
},
|
|
143
|
-
m(a.map((n) => n.id === e ?
|
|
149
|
+
}, te = (e, t) => {
|
|
150
|
+
m(a.map((n) => n.id === e ? S(C({}, n), {
|
|
144
151
|
a: t
|
|
145
152
|
}) : n));
|
|
146
|
-
},
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
153
|
+
}, G = () => x(void 0, null, function* () {
|
|
154
|
+
if (a.filter((t) => {
|
|
155
|
+
var n, c;
|
|
156
|
+
return !((n = t.q) != null && n.trim()) || !((c = t.a) != null && c.trim());
|
|
157
|
+
}).length > 0)
|
|
158
|
+
return k.error("问题模版、回答模版均不能为空"), !1;
|
|
159
|
+
if (!o || !i)
|
|
160
|
+
return !1;
|
|
161
|
+
z(!0);
|
|
162
|
+
try {
|
|
163
|
+
const t = a.map((n, c) => ({
|
|
164
|
+
id: n.id,
|
|
165
|
+
name: D(c),
|
|
166
|
+
q: n.q,
|
|
167
|
+
a: n.a
|
|
168
|
+
}));
|
|
169
|
+
return yield u == null ? void 0 : u.patchDatasetsIdVersionsVid(o, i, {
|
|
170
|
+
qaTemplate: t
|
|
171
|
+
}), yield B(), b == null || b(), !0;
|
|
172
|
+
} catch (t) {
|
|
173
|
+
return k.error("保存失败"), !1;
|
|
174
|
+
} finally {
|
|
175
|
+
z(!1);
|
|
176
|
+
}
|
|
177
|
+
}), ne = () => x(void 0, null, function* () {
|
|
178
|
+
if (d) {
|
|
179
|
+
if (!(yield G()))
|
|
169
180
|
return;
|
|
170
|
-
}
|
|
171
|
-
x == null || x();
|
|
172
181
|
} else
|
|
173
|
-
yield
|
|
174
|
-
g(!
|
|
175
|
-
}),
|
|
182
|
+
yield O();
|
|
183
|
+
g(!d);
|
|
184
|
+
}), q = a.find((e) => String(e.id) === N), ae = a.map((e, t) => ({
|
|
176
185
|
key: String(e.id),
|
|
177
|
-
label:
|
|
186
|
+
label: D(t)
|
|
178
187
|
}));
|
|
179
|
-
return /* @__PURE__ */
|
|
188
|
+
return /* @__PURE__ */ T("div", {
|
|
180
189
|
className: "info-item",
|
|
181
|
-
children: [/* @__PURE__ */
|
|
190
|
+
children: [/* @__PURE__ */ T("div", {
|
|
182
191
|
className: "info-item-header",
|
|
183
|
-
children: [/* @__PURE__ */
|
|
192
|
+
children: [/* @__PURE__ */ r("div", {
|
|
184
193
|
className: "info-item-title",
|
|
185
194
|
children: "QA生成配置"
|
|
186
|
-
}), /* @__PURE__ */
|
|
195
|
+
}), (h || E) && /* @__PURE__ */ T(V, {
|
|
187
196
|
style: {
|
|
188
197
|
height: 32
|
|
189
198
|
},
|
|
190
|
-
children: [/* @__PURE__ */
|
|
199
|
+
children: [h && /* @__PURE__ */ r(I, {
|
|
191
200
|
type: "text",
|
|
192
|
-
icon:
|
|
201
|
+
icon: d ? /* @__PURE__ */ r(R, {
|
|
193
202
|
type: "icon-queding",
|
|
194
203
|
className: "self-icon"
|
|
195
|
-
}) : /* @__PURE__ */
|
|
204
|
+
}) : /* @__PURE__ */ r(R, {
|
|
196
205
|
type: "icon-editing",
|
|
197
206
|
className: "self-icon"
|
|
198
207
|
}),
|
|
199
|
-
onClick:
|
|
200
|
-
}), /* @__PURE__ */
|
|
208
|
+
onClick: ne
|
|
209
|
+
}), E && /* @__PURE__ */ r(I, {
|
|
201
210
|
type: "text",
|
|
202
211
|
disabled: a.length >= 2,
|
|
203
|
-
icon: /* @__PURE__ */
|
|
212
|
+
icon: /* @__PURE__ */ r(R, {
|
|
204
213
|
type: "icon-tianjia",
|
|
205
214
|
className: `self-icon ${a.length >= 2 ? "disabled" : ""}`
|
|
206
215
|
}),
|
|
207
|
-
onClick:
|
|
216
|
+
onClick: X
|
|
208
217
|
})]
|
|
209
218
|
})]
|
|
210
|
-
}), /* @__PURE__ */
|
|
219
|
+
}), /* @__PURE__ */ r("div", {
|
|
211
220
|
className: "template-tabs-wrapper",
|
|
212
|
-
children: /* @__PURE__ */
|
|
213
|
-
activeKey:
|
|
221
|
+
children: /* @__PURE__ */ r(de, {
|
|
222
|
+
activeKey: N,
|
|
214
223
|
onChange: (e) => {
|
|
215
|
-
|
|
224
|
+
Q(e);
|
|
216
225
|
const t = a.findIndex((n) => String(n.id) === e);
|
|
217
|
-
|
|
226
|
+
p == null || p(t);
|
|
218
227
|
},
|
|
219
|
-
items:
|
|
220
|
-
tabBarExtraContent:
|
|
228
|
+
items: ae,
|
|
229
|
+
tabBarExtraContent: (h && d || M) && /* @__PURE__ */ r("div", {
|
|
221
230
|
className: "template-actions",
|
|
222
|
-
children: /* @__PURE__ */
|
|
231
|
+
children: /* @__PURE__ */ T(V, {
|
|
223
232
|
size: 0,
|
|
224
|
-
children: [/* @__PURE__ */
|
|
233
|
+
children: [h && d && /* @__PURE__ */ r(me, {
|
|
225
234
|
title: "点击重置,您的设置会清空",
|
|
226
235
|
placement: "bottom",
|
|
227
|
-
children: /* @__PURE__ */
|
|
236
|
+
children: /* @__PURE__ */ r(I, {
|
|
228
237
|
type: "text",
|
|
229
|
-
icon: /* @__PURE__ */
|
|
230
|
-
onClick:
|
|
238
|
+
icon: /* @__PURE__ */ r(Te, {}),
|
|
239
|
+
onClick: Z
|
|
231
240
|
})
|
|
232
|
-
}), /* @__PURE__ */
|
|
241
|
+
}), M && /* @__PURE__ */ r(I, {
|
|
233
242
|
type: "text",
|
|
234
|
-
icon: /* @__PURE__ */
|
|
243
|
+
icon: /* @__PURE__ */ r(R, {
|
|
235
244
|
type: "icon-shanchu",
|
|
236
|
-
className: `delete-btn ${
|
|
245
|
+
className: `delete-btn ${a.length <= 1 ? "disabled" : ""}`
|
|
237
246
|
}),
|
|
238
|
-
disabled:
|
|
239
|
-
onClick:
|
|
247
|
+
disabled: a.length <= 1,
|
|
248
|
+
onClick: Y
|
|
240
249
|
})]
|
|
241
250
|
})
|
|
242
251
|
})
|
|
243
252
|
})
|
|
244
|
-
}),
|
|
253
|
+
}), q && /* @__PURE__ */ r("div", {
|
|
245
254
|
className: "template-content",
|
|
246
|
-
children: /* @__PURE__ */
|
|
247
|
-
className: "form-item-container " + (
|
|
248
|
-
children: [/* @__PURE__ */
|
|
255
|
+
children: /* @__PURE__ */ T("div", {
|
|
256
|
+
className: "form-item-container " + (d ? "active" : ""),
|
|
257
|
+
children: [/* @__PURE__ */ T("div", {
|
|
249
258
|
className: "form-item",
|
|
250
|
-
children: [/* @__PURE__ */
|
|
259
|
+
children: [/* @__PURE__ */ r("div", {
|
|
251
260
|
className: "form-label",
|
|
252
261
|
children: "问题模版"
|
|
253
|
-
}), /* @__PURE__ */
|
|
262
|
+
}), /* @__PURE__ */ r(J.TextArea, {
|
|
254
263
|
showCount: !0,
|
|
255
264
|
maxLength: 2e3,
|
|
256
|
-
value:
|
|
257
|
-
onChange: (e) =>
|
|
265
|
+
value: q.q,
|
|
266
|
+
onChange: (e) => ee(q.id, e.target.value),
|
|
258
267
|
placeholder: "请输入问题模版",
|
|
259
|
-
disabled: !
|
|
268
|
+
disabled: !d,
|
|
260
269
|
autoSize: {
|
|
261
270
|
minRows: 2,
|
|
262
271
|
maxRows: 20
|
|
263
272
|
}
|
|
264
273
|
})]
|
|
265
|
-
}), /* @__PURE__ */
|
|
274
|
+
}), /* @__PURE__ */ T("div", {
|
|
266
275
|
className: "form-item",
|
|
267
|
-
children: [/* @__PURE__ */
|
|
276
|
+
children: [/* @__PURE__ */ r("div", {
|
|
268
277
|
className: "form-label",
|
|
269
278
|
children: "回答模版"
|
|
270
|
-
}), /* @__PURE__ */
|
|
279
|
+
}), /* @__PURE__ */ r(J.TextArea, {
|
|
271
280
|
showCount: !0,
|
|
272
281
|
maxLength: 2e3,
|
|
273
|
-
value:
|
|
274
|
-
onChange: (e) =>
|
|
282
|
+
value: q.a,
|
|
283
|
+
onChange: (e) => te(q.id, e.target.value),
|
|
275
284
|
placeholder: "请输入回答模版",
|
|
276
|
-
disabled: !
|
|
285
|
+
disabled: !d,
|
|
277
286
|
autoSize: {
|
|
278
287
|
minRows: 2,
|
|
279
288
|
maxRows: 20
|
|
@@ -281,10 +290,21 @@ const de = ie((l, s) => {
|
|
|
281
290
|
})]
|
|
282
291
|
})]
|
|
283
292
|
})
|
|
293
|
+
}), F && /* @__PURE__ */ r("div", {
|
|
294
|
+
className: "qa-config-footer",
|
|
295
|
+
children: /* @__PURE__ */ r(V, {
|
|
296
|
+
children: /* @__PURE__ */ r(I, {
|
|
297
|
+
type: "primary",
|
|
298
|
+
loading: j,
|
|
299
|
+
disabled: j,
|
|
300
|
+
onClick: G,
|
|
301
|
+
children: "保存"
|
|
302
|
+
})
|
|
303
|
+
})
|
|
284
304
|
})]
|
|
285
305
|
});
|
|
286
306
|
});
|
|
287
|
-
|
|
307
|
+
we.displayName = "QAGenerationConfig";
|
|
288
308
|
export {
|
|
289
|
-
|
|
309
|
+
we as default
|
|
290
310
|
};
|