@glodon-aiot/dataset-annotation 3.10.0-alpha.18 → 3.10.0-alpha.19
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.
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
var Le = Object.defineProperty, Me = Object.defineProperties;
|
|
2
|
+
var Ne = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var me = Object.getOwnPropertySymbols;
|
|
4
|
+
var Te = Object.prototype.hasOwnProperty, Re = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var xe = (v, d, o) => d in v ? Le(v, d, { enumerable: !0, configurable: !0, writable: !0, value: o }) : v[d] = o, U = (v, d) => {
|
|
6
6
|
for (var o in d || (d = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var o of
|
|
10
|
-
|
|
11
|
-
return
|
|
12
|
-
}, $ = (
|
|
13
|
-
var z = (
|
|
7
|
+
Te.call(d, o) && xe(v, o, d[o]);
|
|
8
|
+
if (me)
|
|
9
|
+
for (var o of me(d))
|
|
10
|
+
Re.call(d, o) && xe(v, o, d[o]);
|
|
11
|
+
return v;
|
|
12
|
+
}, $ = (v, d) => Me(v, Ne(d));
|
|
13
|
+
var z = (v, d, o) => new Promise((x, h) => {
|
|
14
14
|
var H = (N) => {
|
|
15
15
|
try {
|
|
16
16
|
r(o.next(N));
|
|
@@ -24,21 +24,21 @@ var z = (b, d, o) => new Promise((x, h) => {
|
|
|
24
24
|
h(j);
|
|
25
25
|
}
|
|
26
26
|
}, r = (N) => N.done ? x(N.value) : Promise.resolve(N.value).then(H, M);
|
|
27
|
-
r((o = o.apply(
|
|
27
|
+
r((o = o.apply(v, d)).next());
|
|
28
28
|
});
|
|
29
|
-
import { jsx as c, jsxs as P, Fragment as
|
|
30
|
-
import { Modal as
|
|
31
|
-
import { useContext as
|
|
29
|
+
import { jsx as c, jsxs as P, Fragment as Ue } from "react/jsx-runtime";
|
|
30
|
+
import { Modal as ye, Space as Se, Button as X, message as L, Tabs as oe, Spin as qe } from "antd";
|
|
31
|
+
import { useContext as Ge, useRef as F, useState as S, useEffect as O } from "react";
|
|
32
32
|
import "./style.less.mjs";
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
33
|
+
import $e from "../../DataEmpty/index.mjs";
|
|
34
|
+
import Pe from "../../../DatasetContext/index.mjs";
|
|
35
|
+
import je from "./AttributeDetail/index.mjs";
|
|
36
|
+
import Be from "./QADetail/index.mjs";
|
|
37
|
+
import Ee from "../../VLMAnnotation/index.mjs";
|
|
38
|
+
import Fe from "axios";
|
|
39
39
|
const {
|
|
40
40
|
TabPane: Q
|
|
41
|
-
} =
|
|
41
|
+
} = oe, nt = (v) => {
|
|
42
42
|
const {
|
|
43
43
|
visible: d,
|
|
44
44
|
selectSampleId: o,
|
|
@@ -47,29 +47,29 @@ const {
|
|
|
47
47
|
// vmlMarkTmpl,
|
|
48
48
|
onClose: H,
|
|
49
49
|
onSave: M
|
|
50
|
-
} =
|
|
50
|
+
} = v, {
|
|
51
51
|
services: {
|
|
52
52
|
cvforceDatahub: r
|
|
53
53
|
},
|
|
54
54
|
token: N,
|
|
55
55
|
apiUrl: j
|
|
56
|
-
} =
|
|
56
|
+
} = Ge(Pe), B = F(null);
|
|
57
57
|
F(null), F({});
|
|
58
|
-
const [i, I] = S(), w = F(void 0), [
|
|
58
|
+
const [i, I] = S(), w = F(void 0), [Qe, re] = S(0), [y, q] = S([]), [Y, T] = S(-1), [l, R] = S({
|
|
59
59
|
current: 1,
|
|
60
60
|
pageSize: 100
|
|
61
61
|
// 与主列表保持一致
|
|
62
|
-
}), [
|
|
62
|
+
}), [se, ae] = S(0), [ce, le] = S(0), [k, Z] = S(() => o ? "" : "nocode"), [de, K] = S(), [_, fe] = S([]), [g, W] = S("textAnnotation"), [J, E] = S(), [ee, Ce] = S(!1), [te, ne] = S(!1), [ue, he] = S(!1), G = F(null), D = F(null), [we, be] = S(() => Date.now()), [ve, Ie] = S(() => Date.now());
|
|
63
63
|
O(() => {
|
|
64
64
|
d && (!x || !h || r == null || r.getDatasetsIdVersionsVidConfigs(x, h).then((e) => {
|
|
65
|
-
|
|
65
|
+
fe(e || []), (e == null ? void 0 : e.length) > 0 ? W("textAnnotation") : W("attributeDefinition");
|
|
66
66
|
}));
|
|
67
67
|
}, [d]), O(() => {
|
|
68
68
|
const e = l.current || 1, t = l.pageSize || 100, n = l.type;
|
|
69
69
|
if (!x || !h)
|
|
70
70
|
return;
|
|
71
|
-
|
|
72
|
-
const s = y || [], p = o ||
|
|
71
|
+
ne(!0);
|
|
72
|
+
const s = y || [], p = o || de;
|
|
73
73
|
r == null || r.getDatasetsIdVersionsVidSamples(x, h, {
|
|
74
74
|
labels: k ? [k] : void 0,
|
|
75
75
|
pageNo: e,
|
|
@@ -88,40 +88,40 @@ const {
|
|
|
88
88
|
else if (n === "prev" && f.length)
|
|
89
89
|
u = f.length - 1, C = f[f.length - 1];
|
|
90
90
|
else if (p) {
|
|
91
|
-
const A = m.findIndex((
|
|
91
|
+
const A = m.findIndex((b) => b.id === p);
|
|
92
92
|
if (A !== -1)
|
|
93
93
|
u = A, C = m[A];
|
|
94
94
|
else {
|
|
95
|
-
r == null || r.getDatasetsIdVersionsVidSsamplesSid(x, h, p).then((
|
|
96
|
-
|
|
95
|
+
r == null || r.getDatasetsIdVersionsVidSsamplesSid(x, h, p).then((b) => {
|
|
96
|
+
b && (q([b, ...m]), I(b), T(0), re(m.length + 1), K(void 0));
|
|
97
97
|
});
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
C && (I(C), T(u),
|
|
101
|
+
C && (I(C), T(u), re(m.length), de && K(void 0));
|
|
102
102
|
}).finally(() => {
|
|
103
|
-
|
|
103
|
+
ne(!1);
|
|
104
104
|
}), V();
|
|
105
105
|
}, [l.current, k, x, h]);
|
|
106
106
|
const V = () => {
|
|
107
107
|
!x || !h || r == null || r.getDatasetsIdVersionsVidLabelcount(x, h).then((e) => {
|
|
108
108
|
const t = e.find((s) => s.id === "allcodeid"), n = e.find((s) => s.id === "nocodeid");
|
|
109
|
-
|
|
109
|
+
ae(t ? t.count : 0), le(n ? n.count : 0);
|
|
110
110
|
});
|
|
111
|
-
},
|
|
111
|
+
}, ie = () => {
|
|
112
112
|
y && q((e) => {
|
|
113
113
|
var f, m, u, C;
|
|
114
114
|
const t = w.current || i, n = [...e];
|
|
115
115
|
let s;
|
|
116
116
|
if (t) {
|
|
117
|
-
const A = n.findIndex((
|
|
117
|
+
const A = n.findIndex((b) => b.id === t.id);
|
|
118
118
|
A > -1 && n.splice(A, 1, t);
|
|
119
119
|
}
|
|
120
120
|
const p = !t || (f = t.labels) != null && f.length && k === "hascode" || !((m = t.labels) != null && m.length) && k === "nocode" || k === "" ? Y + 1 : Y;
|
|
121
121
|
if (t && ((u = t.labels) != null && u.length && k === "nocode" || !((C = t.labels) != null && C.length) && k === "hascode")) {
|
|
122
|
-
const A = n.findIndex((
|
|
123
|
-
A > -1 && (n.splice(A, 1), s = [...n], R((
|
|
124
|
-
total:
|
|
122
|
+
const A = n.findIndex((b) => b.id === t.id);
|
|
123
|
+
A > -1 && (n.splice(A, 1), s = [...n], R((b) => $(U({}, b), {
|
|
124
|
+
total: b.total ? b.total - 1 : b.total
|
|
125
125
|
})));
|
|
126
126
|
}
|
|
127
127
|
const a = s || n;
|
|
@@ -137,10 +137,10 @@ const {
|
|
|
137
137
|
T(p);
|
|
138
138
|
const A = a[p];
|
|
139
139
|
I(A);
|
|
140
|
-
},
|
|
140
|
+
}, 0);
|
|
141
141
|
return a;
|
|
142
142
|
});
|
|
143
|
-
},
|
|
143
|
+
}, ge = () => {
|
|
144
144
|
var a, f;
|
|
145
145
|
if (!y)
|
|
146
146
|
return;
|
|
@@ -170,35 +170,35 @@ const {
|
|
|
170
170
|
n && q(n);
|
|
171
171
|
};
|
|
172
172
|
O(() => {
|
|
173
|
-
d && x && h && i && (r == null || r.getDatasetsIdVersionsVidSsamplesSid(x, h, i.id).then((e) => {
|
|
173
|
+
d && x && h && i && (he(!0), r == null || r.getDatasetsIdVersionsVidSsamplesSid(x, h, i.id).then((e) => {
|
|
174
174
|
I(e);
|
|
175
|
-
}));
|
|
175
|
+
}).finally(() => he(!1)));
|
|
176
176
|
}, [d, i == null ? void 0 : i.id]);
|
|
177
|
-
const
|
|
177
|
+
const ke = () => z(void 0, null, function* () {
|
|
178
178
|
g === "attributeDefinition" && G.current && !(yield G.current.checkDirtyAndConfirm()) || g === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm()) || H();
|
|
179
179
|
});
|
|
180
180
|
O(() => {
|
|
181
181
|
B.current && (B.current.width = B.current.offsetWidth, B.current.height = B.current.offsetHeight);
|
|
182
182
|
}, [B.current]);
|
|
183
|
-
const
|
|
183
|
+
const Ae = () => z(void 0, null, function* () {
|
|
184
184
|
if (g === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm()))
|
|
185
185
|
return;
|
|
186
186
|
const e = w.current || i;
|
|
187
187
|
e && (console.log("onPrevClick sampleToUse", e), g === "textAnnotation" && J ? M(e).then((t) => {
|
|
188
|
-
t ? (E(void 0),
|
|
189
|
-
}) :
|
|
190
|
-
}),
|
|
188
|
+
t ? (E(void 0), ge(), V()) : L.error("保存失败");
|
|
189
|
+
}) : ge());
|
|
190
|
+
}), De = () => z(void 0, null, function* () {
|
|
191
191
|
if (g === "qaGeneration" && D.current && !(yield D.current.checkDirtyAndConfirm()))
|
|
192
192
|
return;
|
|
193
193
|
const e = w.current || i;
|
|
194
194
|
e && (console.log("onNextClick sampleToUse", e), g === "textAnnotation" && J ? M(e).then((t) => {
|
|
195
|
-
t ? (E(void 0),
|
|
196
|
-
}) :
|
|
195
|
+
t ? (E(void 0), ie(), V()) : L.error("保存失败");
|
|
196
|
+
}) : ie());
|
|
197
197
|
});
|
|
198
198
|
O(() => {
|
|
199
199
|
w.current = i;
|
|
200
200
|
}, [i]);
|
|
201
|
-
const
|
|
201
|
+
const Ve = (e) => (console.log("ocrRecognize apiUrl", j), Fe.post(`${j}/aishop/v2/infer?serviceId=Actpkb4pi3vxg`, {
|
|
202
202
|
pages: [{
|
|
203
203
|
image: e,
|
|
204
204
|
no: 0
|
|
@@ -209,9 +209,9 @@ const {
|
|
|
209
209
|
}
|
|
210
210
|
}).then((t) => (console.log("ocrRecognize res", t.data.data), t.data.data.pages[0].layout.filter((s) => s.content))).catch((t) => {
|
|
211
211
|
console.error("ocrRecognize error", t);
|
|
212
|
-
})),
|
|
212
|
+
})), ze = () => z(void 0, null, function* () {
|
|
213
213
|
const e = w.current || i;
|
|
214
|
-
!e || !x || !h ||
|
|
214
|
+
!e || !x || !h || ye.confirm({
|
|
215
215
|
title: "确认要删除此数据吗?",
|
|
216
216
|
content: "删除后不可恢复,请慎重操作",
|
|
217
217
|
onOk: () => z(void 0, null, function* () {
|
|
@@ -243,20 +243,20 @@ const {
|
|
|
243
243
|
}
|
|
244
244
|
})
|
|
245
245
|
});
|
|
246
|
-
}),
|
|
246
|
+
}), pe = () => z(void 0, null, function* () {
|
|
247
247
|
if (!x || !h || !(i != null && i.id))
|
|
248
248
|
return;
|
|
249
249
|
const e = yield r == null ? void 0 : r.getDatasetsIdVersionsVidSsamplesSid(x, h, i.id);
|
|
250
250
|
e && (I(e), w.current = e);
|
|
251
251
|
});
|
|
252
|
-
return /* @__PURE__ */ c(
|
|
252
|
+
return /* @__PURE__ */ c(ye, {
|
|
253
253
|
title: "标注",
|
|
254
254
|
width: "100%",
|
|
255
255
|
wrapClassName: "vlm-modal-wrap",
|
|
256
256
|
className: "vlm-modal",
|
|
257
257
|
open: d,
|
|
258
258
|
destroyOnClose: !0,
|
|
259
|
-
onCancel: () =>
|
|
259
|
+
onCancel: () => ke(),
|
|
260
260
|
maskClosable: !1,
|
|
261
261
|
keyboard: !1,
|
|
262
262
|
centered: !0,
|
|
@@ -270,15 +270,17 @@ const {
|
|
|
270
270
|
style: {
|
|
271
271
|
flex: 1
|
|
272
272
|
}
|
|
273
|
-
}), /* @__PURE__ */ P(
|
|
273
|
+
}), /* @__PURE__ */ P(Se, {
|
|
274
274
|
size: 24,
|
|
275
275
|
children: [!o && (y == null ? void 0 : y.length) > 0 && /* @__PURE__ */ c(X, {
|
|
276
276
|
type: "default",
|
|
277
|
-
|
|
277
|
+
disabled: ue || te,
|
|
278
|
+
onClick: Ae,
|
|
278
279
|
children: "上一张"
|
|
279
280
|
}, "prev"), !o && (y == null ? void 0 : y.length) > 0 && /* @__PURE__ */ c(X, {
|
|
280
281
|
type: "default",
|
|
281
|
-
|
|
282
|
+
disabled: ue || te,
|
|
283
|
+
onClick: De,
|
|
282
284
|
children: "下一张"
|
|
283
285
|
}, "next")]
|
|
284
286
|
}), /* @__PURE__ */ c("div", {
|
|
@@ -287,21 +289,21 @@ const {
|
|
|
287
289
|
display: "flex",
|
|
288
290
|
justifyContent: "flex-end"
|
|
289
291
|
},
|
|
290
|
-
children: /* @__PURE__ */ c(
|
|
291
|
-
children: g === "textAnnotation" && (y == null ? void 0 : y.length) > 0 ? /* @__PURE__ */ P(
|
|
292
|
+
children: /* @__PURE__ */ c(Se, {
|
|
293
|
+
children: g === "textAnnotation" && (y == null ? void 0 : y.length) > 0 ? /* @__PURE__ */ P(Ue, {
|
|
292
294
|
children: [/* @__PURE__ */ c(X, {
|
|
293
295
|
disabled: !i,
|
|
294
296
|
type: "primary",
|
|
295
297
|
onClick: () => {
|
|
296
298
|
const e = w.current || i;
|
|
297
299
|
e && (console.log("save currentSample", e), M(e).then((t) => z(void 0, null, function* () {
|
|
298
|
-
t ? (L.success("保存成功"), E(void 0), o ? yield
|
|
300
|
+
t ? (L.success("保存成功"), E(void 0), o ? yield pe() : ie(), V()) : L.error("保存失败");
|
|
299
301
|
})));
|
|
300
302
|
},
|
|
301
303
|
children: "保存标注"
|
|
302
304
|
}, "save"), /* @__PURE__ */ c(X, {
|
|
303
305
|
type: "default",
|
|
304
|
-
onClick:
|
|
306
|
+
onClick: ze,
|
|
305
307
|
children: "删除数据"
|
|
306
308
|
})]
|
|
307
309
|
}) : null
|
|
@@ -312,7 +314,7 @@ const {
|
|
|
312
314
|
className: "vlm-records-content",
|
|
313
315
|
children: [/* @__PURE__ */ c("div", {
|
|
314
316
|
className: "records-content-tabs-container",
|
|
315
|
-
children: !o && /* @__PURE__ */ P(
|
|
317
|
+
children: !o && /* @__PURE__ */ P(oe, {
|
|
316
318
|
className: "records-content-tabs",
|
|
317
319
|
activeKey: k,
|
|
318
320
|
onChange: (e) => z(void 0, null, function* () {
|
|
@@ -333,7 +335,7 @@ const {
|
|
|
333
335
|
})), Z("hascode"));
|
|
334
336
|
}
|
|
335
337
|
}
|
|
336
|
-
t &&
|
|
338
|
+
t && be(Date.now()), Ie(Date.now()), g !== "attributeDefinition" && (ne(!0), q([]), I(void 0), T(-1), K(void 0)), R($(U({}, l), {
|
|
337
339
|
current: 1,
|
|
338
340
|
total: void 0,
|
|
339
341
|
type: void 0
|
|
@@ -341,18 +343,18 @@ const {
|
|
|
341
343
|
}
|
|
342
344
|
}),
|
|
343
345
|
children: [/* @__PURE__ */ c(Q, {
|
|
344
|
-
tab: `全部(${
|
|
346
|
+
tab: `全部(${se})`
|
|
345
347
|
}, ""), /* @__PURE__ */ c(Q, {
|
|
346
|
-
tab: `未标注(${
|
|
348
|
+
tab: `未标注(${ce})`
|
|
347
349
|
}, "nocode"), /* @__PURE__ */ c(Q, {
|
|
348
|
-
tab: `已标注(${
|
|
350
|
+
tab: `已标注(${se - ce})`
|
|
349
351
|
}, "hascode")]
|
|
350
352
|
})
|
|
351
353
|
}), y != null && y.length ? /* @__PURE__ */ P("div", {
|
|
352
354
|
className: "sample-detail",
|
|
353
355
|
children: [/* @__PURE__ */ c("div", {
|
|
354
356
|
className: "content-mode-buttons",
|
|
355
|
-
children: /* @__PURE__ */ P(
|
|
357
|
+
children: /* @__PURE__ */ P(oe, {
|
|
356
358
|
activeKey: g,
|
|
357
359
|
onChange: (e) => z(void 0, null, function* () {
|
|
358
360
|
var t;
|
|
@@ -369,7 +371,7 @@ const {
|
|
|
369
371
|
type: void 0
|
|
370
372
|
})), Z("hascode"));
|
|
371
373
|
}
|
|
372
|
-
e === "textAnnotation" && (i != null && i.id) && (yield
|
|
374
|
+
e === "textAnnotation" && (i != null && i.id) && (yield pe()), W(e);
|
|
373
375
|
}
|
|
374
376
|
}),
|
|
375
377
|
children: [/* @__PURE__ */ c(Q, {
|
|
@@ -385,42 +387,42 @@ const {
|
|
|
385
387
|
})
|
|
386
388
|
}), g === "textAnnotation" && i && /* @__PURE__ */ c("div", {
|
|
387
389
|
className: "container",
|
|
388
|
-
children: /* @__PURE__ */ c(
|
|
390
|
+
children: /* @__PURE__ */ c(Ee, {
|
|
389
391
|
sample: i,
|
|
390
392
|
labelDefinitions: _,
|
|
391
393
|
onChange: (e) => {
|
|
392
394
|
console.log("VLMAnnotation onChange", e), w.current = e, E(e);
|
|
393
395
|
},
|
|
394
|
-
ocrRecognize:
|
|
396
|
+
ocrRecognize: Ve,
|
|
395
397
|
coordinateType: "center"
|
|
396
398
|
})
|
|
397
|
-
}), g === "attributeDefinition" && /* @__PURE__ */ c(
|
|
399
|
+
}), g === "attributeDefinition" && /* @__PURE__ */ c(je, {
|
|
398
400
|
ref: G,
|
|
399
401
|
datasetId: x,
|
|
400
402
|
versionId: h,
|
|
401
403
|
onAttributesChange: (e) => {
|
|
402
|
-
|
|
404
|
+
fe(e), e.length > 0 && _.length === 0 && W("textAnnotation");
|
|
403
405
|
},
|
|
404
406
|
onLoadingChange: (e) => {
|
|
405
|
-
|
|
407
|
+
Ce(e);
|
|
406
408
|
}
|
|
407
|
-
}, `attribute-${
|
|
409
|
+
}, `attribute-${we}`), g === "qaGeneration" && /* @__PURE__ */ c(Be, {
|
|
408
410
|
ref: D,
|
|
409
411
|
sample: i,
|
|
410
412
|
labels: _,
|
|
411
413
|
datasetId: x,
|
|
412
414
|
visionId: h
|
|
413
|
-
}, `qa-${
|
|
414
|
-
}) :
|
|
415
|
+
}, `qa-${ve}`)]
|
|
416
|
+
}) : te ? /* @__PURE__ */ c("div", {
|
|
415
417
|
style: {
|
|
416
418
|
padding: "48px 0",
|
|
417
419
|
textAlign: "center"
|
|
418
420
|
},
|
|
419
|
-
children: /* @__PURE__ */ c(
|
|
420
|
-
}) : /* @__PURE__ */ c(
|
|
421
|
+
children: /* @__PURE__ */ c(qe, {})
|
|
422
|
+
}) : /* @__PURE__ */ c($e, {})]
|
|
421
423
|
})
|
|
422
424
|
});
|
|
423
425
|
};
|
|
424
426
|
export {
|
|
425
|
-
|
|
427
|
+
nt as default
|
|
426
428
|
};
|