@glodon-aiot/dataset-annotation 3.19.1 → 3.19.2-alpha.0
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/PicZipImportModal/config.mjs +17 -7
- package/dist/es/components/PicZipImportModal/index.mjs +142 -142
- package/dist/es/components/VLMAnnotation/VLMLabelMaker/index.mjs +93 -91
- package/dist/es/components/VLMAnnotation/components/Toolbar.mjs +17 -16
- package/dist/es/components/VLMAnnotationDetail/VLMDetail/index.mjs +341 -318
- package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +199 -184
- package/dist/es/components/VLMAnnotationDetail/index.mjs +67 -66
- package/dist/es/components/VQAAnnotation/VQAAnnotationPanel.mjs +69 -0
- package/dist/es/components/VQAAnnotation/index.mjs +80 -0
- package/dist/es/components/VQAAnnotation/style.less.mjs +4 -0
- package/dist/es/index.mjs +9 -7
- package/dist/lib/index.js +4 -4
- package/dist/src/components/PicZipImportModal/config.d.ts +2 -1
- package/dist/src/components/VLMAnnotation/types.d.ts +2 -0
- package/dist/src/components/VLMAnnotationDetail/VLMDetail/index.d.ts +1 -0
- package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +1 -0
- package/dist/src/components/VQAAnnotation/VQAAnnotationPanel.d.ts +12 -0
- package/dist/src/components/VQAAnnotation/index.d.ts +38 -0
- package/dist/src/index.d.ts +2 -0
- package/package.json +2 -2
|
@@ -1,257 +1,267 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
for (var
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var
|
|
10
|
-
|
|
1
|
+
var ft = Object.defineProperty, ut = Object.defineProperties;
|
|
2
|
+
var gt = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var Ke = Object.getOwnPropertySymbols;
|
|
4
|
+
var ht = Object.prototype.hasOwnProperty, mt = Object.prototype.propertyIsEnumerable;
|
|
5
|
+
var Oe = (k, y, u) => y in k ? ft(k, y, { enumerable: !0, configurable: !0, writable: !0, value: u }) : k[y] = u, V = (k, y) => {
|
|
6
|
+
for (var u in y || (y = {}))
|
|
7
|
+
ht.call(y, u) && Oe(k, u, y[u]);
|
|
8
|
+
if (Ke)
|
|
9
|
+
for (var u of Ke(y))
|
|
10
|
+
mt.call(y, u) && Oe(k, u, y[u]);
|
|
11
11
|
return k;
|
|
12
|
-
},
|
|
13
|
-
var
|
|
14
|
-
var
|
|
12
|
+
}, Q = (k, y) => ut(k, gt(y));
|
|
13
|
+
var T = (k, y, u) => new Promise((L, m) => {
|
|
14
|
+
var v = (C) => {
|
|
15
15
|
try {
|
|
16
|
-
|
|
17
|
-
} catch (
|
|
18
|
-
|
|
16
|
+
Z(u.next(C));
|
|
17
|
+
} catch (A) {
|
|
18
|
+
m(A);
|
|
19
19
|
}
|
|
20
|
-
},
|
|
20
|
+
}, he = (C) => {
|
|
21
21
|
try {
|
|
22
|
-
|
|
23
|
-
} catch (
|
|
24
|
-
|
|
22
|
+
Z(u.throw(C));
|
|
23
|
+
} catch (A) {
|
|
24
|
+
m(A);
|
|
25
25
|
}
|
|
26
|
-
},
|
|
27
|
-
|
|
26
|
+
}, Z = (C) => C.done ? L(C.value) : Promise.resolve(C.value).then(v, he);
|
|
27
|
+
Z((u = u.apply(k, y)).next());
|
|
28
28
|
});
|
|
29
|
-
import { jsxs as K, jsx as l, Fragment as
|
|
30
|
-
import { Tabs as
|
|
31
|
-
import { forwardRef as
|
|
29
|
+
import { jsxs as K, jsx as l, Fragment as We } from "react/jsx-runtime";
|
|
30
|
+
import { Tabs as Te, message as P, Spin as pt, Space as Je, Button as ge, Modal as Xe } from "antd";
|
|
31
|
+
import { forwardRef as xt, useContext as vt, useMemo as St, useRef as U, useState as h, useEffect as oe, useImperativeHandle as yt } from "react";
|
|
32
32
|
import "./style.less.mjs";
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
38
|
-
import
|
|
39
|
-
import { createTokenResolver as
|
|
33
|
+
import Ct from "../../DataEmpty/index.mjs";
|
|
34
|
+
import wt from "../../../DatasetContext/index.mjs";
|
|
35
|
+
import It from "../../VLMAnnotation/index.mjs";
|
|
36
|
+
import kt from "axios";
|
|
37
|
+
import At from "../MarkVLMBoxModal/AttributeDetail/index.mjs";
|
|
38
|
+
import bt from "../MarkVLMBoxModal/QADetail/index.mjs";
|
|
39
|
+
import { createTokenResolver as Dt } from "../../../utils/index.mjs";
|
|
40
|
+
import Rt from "../../VQAAnnotation/index.mjs";
|
|
40
41
|
const {
|
|
41
42
|
TabPane: Y
|
|
42
|
-
} =
|
|
43
|
+
} = Te, Bt = xt((k, y) => {
|
|
43
44
|
const {
|
|
44
|
-
visible:
|
|
45
|
-
selectSampleId:
|
|
46
|
-
datasetId:
|
|
47
|
-
versionId:
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
visible: u,
|
|
46
|
+
selectSampleId: L,
|
|
47
|
+
datasetId: m,
|
|
48
|
+
versionId: v,
|
|
49
|
+
vlmMarkTmpl: he,
|
|
50
|
+
onClose: Z,
|
|
51
|
+
onSave: C,
|
|
52
|
+
externalSamples: A,
|
|
53
|
+
externalPagination: me,
|
|
54
|
+
externalCurrentIndex: pe,
|
|
55
|
+
externalFilterMode: Le,
|
|
56
|
+
onFilterModeChange: xe
|
|
57
|
+
} = k, B = he === "VQA", G = (e) => {
|
|
58
|
+
var t, n, a, i, f, s, r, S, j, ee;
|
|
59
|
+
return B ? !!((i = (a = (n = (t = e == null ? void 0 : e.content) == null ? void 0 : t.conversations) == null ? void 0 : n[0]) == null ? void 0 : a.value) != null && i.trim() && ((S = (r = (s = (f = e == null ? void 0 : e.content) == null ? void 0 : f.conversations) == null ? void 0 : s[1]) == null ? void 0 : r.value) != null && S.trim())) : ((ee = (j = e == null ? void 0 : e.labels) == null ? void 0 : j.length) != null ? ee : 0) > 0;
|
|
60
|
+
}, {
|
|
56
61
|
services: {
|
|
57
62
|
cvforceDatahub: d
|
|
58
63
|
},
|
|
59
|
-
token:
|
|
60
|
-
getToken:
|
|
61
|
-
apiUrl:
|
|
62
|
-
} =
|
|
64
|
+
token: ze,
|
|
65
|
+
getToken: Me,
|
|
66
|
+
apiUrl: qe
|
|
67
|
+
} = vt(wt), Ye = St(() => Dt(ze, Me), [ze, Me]), O = U(null), [o, w] = h(), I = U(void 0), [Vt, ve] = h(0), [g, $] = h(() => L && (A != null && A.length) ? A : []), [F, z] = h(() => L && pe !== void 0 ? pe : -1), [c, M] = h(() => L && me ? V({}, me) : {
|
|
63
68
|
current: 1,
|
|
64
69
|
pageSize: 100
|
|
65
|
-
}), [
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
70
|
+
}), [Ne, Pe] = h(0), [Ue, Ge] = h(0), [p, ae] = h(() => L && Le ? Le : L ? "" : "nocode"), [Se, W] = h(), _ = U({}), [ye, $e] = h([]), [x, ce] = h("textAnnotation"), [J, H] = h(), [se, q] = h(!1), le = U(0), Ce = U(0), [we, Ze] = h(!1), [de, fe] = h(!1), [Ie, ke] = h(!1), [Fe, Qe] = h(!1), [ue, Ae] = h(!1), E = U(null), R = U(null), Ee = U(null), be = U(!1), De = U(!1), [_e, et] = h(() => Date.now()), [tt, nt] = h(() => Date.now());
|
|
71
|
+
oe(() => {
|
|
72
|
+
u && (!m || !v || B || d == null || d.getDatasetsIdVersionsVidConfigs(m, v).then((e) => {
|
|
73
|
+
$e(e || []), (e == null ? void 0 : e.length) > 0 ? ce("textAnnotation") : ce("attributeDefinition");
|
|
69
74
|
}));
|
|
70
|
-
}, [
|
|
71
|
-
const e =
|
|
72
|
-
if (!
|
|
75
|
+
}, [u]), oe(() => {
|
|
76
|
+
const e = c.current || 1, t = c.pageSize || 100, n = c.type;
|
|
77
|
+
if (!m || !v)
|
|
73
78
|
return;
|
|
74
|
-
if (
|
|
75
|
-
|
|
79
|
+
if (De.current) {
|
|
80
|
+
De.current = !1;
|
|
76
81
|
return;
|
|
77
82
|
}
|
|
78
|
-
if (!be.current &&
|
|
79
|
-
const
|
|
80
|
-
if (
|
|
81
|
-
be.current = !0, w(
|
|
83
|
+
if (!be.current && L && (A != null && A.length) && me && pe !== void 0) {
|
|
84
|
+
const te = A.find((D) => D.id === L);
|
|
85
|
+
if (te) {
|
|
86
|
+
be.current = !0, w(te), ve(A.length), b();
|
|
82
87
|
return;
|
|
83
88
|
}
|
|
84
89
|
}
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
const
|
|
88
|
-
d == null || d.getDatasetsIdVersionsVidSamples(
|
|
90
|
+
const a = ++le.current;
|
|
91
|
+
ke(!0);
|
|
92
|
+
const i = g || [], f = be.current ? Se : L || Se, s = _.current[p], r = s == null ? void 0 : s.index, S = s == null ? void 0 : s.page, j = !n && !f && !!S && S > 1, ee = j ? 1 : e, lt = j ? S * t : t;
|
|
93
|
+
d == null || d.getDatasetsIdVersionsVidSamples(m, v, {
|
|
89
94
|
labels: p ? [p] : void 0,
|
|
90
|
-
pageNo:
|
|
91
|
-
pageSize:
|
|
92
|
-
}).then((
|
|
93
|
-
var
|
|
94
|
-
if (
|
|
95
|
+
pageNo: ee,
|
|
96
|
+
pageSize: lt
|
|
97
|
+
}).then((te) => {
|
|
98
|
+
var He;
|
|
99
|
+
if (a !== le.current)
|
|
95
100
|
return;
|
|
96
|
-
const D =
|
|
97
|
-
|
|
98
|
-
const
|
|
99
|
-
if (
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
index:
|
|
103
|
-
page:
|
|
101
|
+
const D = te.recordList || [], N = ee === 1 && !n ? D : n === "prev" ? [...D, ...i] : n === "next" ? [...i, ...D] : D;
|
|
102
|
+
$(N), j && (De.current = !0);
|
|
103
|
+
const Be = (He = te.totalResults) != null ? He : 0, Ve = Math.max(1, Math.ceil(Be / t) || 1), dt = Math.min(j ? S : e, Ve);
|
|
104
|
+
if (j && S != null && S > Ve) {
|
|
105
|
+
const ie = Math.min(r != null ? r : 0, Math.max(0, N.length - 1));
|
|
106
|
+
_.current[p] = {
|
|
107
|
+
index: ie,
|
|
108
|
+
page: Ve
|
|
104
109
|
};
|
|
105
110
|
}
|
|
106
|
-
|
|
107
|
-
current:
|
|
111
|
+
M(Q(V({}, c), {
|
|
112
|
+
current: dt,
|
|
108
113
|
pageSize: t,
|
|
109
|
-
total:
|
|
114
|
+
total: Be,
|
|
110
115
|
type: void 0
|
|
111
116
|
}));
|
|
112
|
-
let
|
|
113
|
-
if (
|
|
114
|
-
|
|
115
|
-
else if (
|
|
116
|
-
|
|
117
|
-
else if (
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
|
|
117
|
+
let ne = 0, X = N[0];
|
|
118
|
+
if (n === "next" && D.length)
|
|
119
|
+
ne = i.length, X = D[0];
|
|
120
|
+
else if (n === "prev" && D.length)
|
|
121
|
+
ne = D.length - 1, X = D[D.length - 1];
|
|
122
|
+
else if (f) {
|
|
123
|
+
const ie = N.findIndex((re) => re.id === f);
|
|
124
|
+
if (ie !== -1)
|
|
125
|
+
ne = ie, X = N[ie];
|
|
121
126
|
else {
|
|
122
|
-
d == null || d.getDatasetsIdVersionsVidSsamplesSid(
|
|
123
|
-
|
|
127
|
+
d == null || d.getDatasetsIdVersionsVidSsamplesSid(m, v, f).then((re) => {
|
|
128
|
+
a === le.current && re && ($([re, ...N]), w(re), z(0), ve(N.length + 1), W(void 0));
|
|
124
129
|
});
|
|
125
130
|
return;
|
|
126
131
|
}
|
|
127
132
|
} else
|
|
128
|
-
|
|
129
|
-
X && (w(X),
|
|
133
|
+
r !== void 0 && r >= 0 && r < N.length && (ne = r, X = N[r]);
|
|
134
|
+
X && (w(X), z(ne), ve(N.length), Se && W(void 0));
|
|
130
135
|
}).finally(() => {
|
|
131
|
-
|
|
132
|
-
}),
|
|
133
|
-
}, [
|
|
134
|
-
const
|
|
135
|
-
!
|
|
136
|
-
const t = e.find((
|
|
137
|
-
|
|
136
|
+
a === le.current && ke(!1);
|
|
137
|
+
}), b();
|
|
138
|
+
}, [c.current, p, m, v]);
|
|
139
|
+
const b = () => {
|
|
140
|
+
!m || !v || d == null || d.getDatasetsIdVersionsVidLabelcount(m, v).then((e) => {
|
|
141
|
+
const t = e.find((a) => a.id === "allcodeid"), n = e.find((a) => a.id === "nocodeid");
|
|
142
|
+
Pe(t ? t.count : 0), Ge(n ? n.count : 0);
|
|
138
143
|
});
|
|
139
|
-
},
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
let n;
|
|
144
|
+
}, Re = () => {
|
|
145
|
+
g && $((e) => {
|
|
146
|
+
const t = I.current || o, n = [...e];
|
|
147
|
+
let a;
|
|
144
148
|
if (t) {
|
|
145
|
-
const
|
|
146
|
-
|
|
149
|
+
const s = n.findIndex((r) => r.id === t.id);
|
|
150
|
+
s > -1 && n.splice(s, 1, t);
|
|
147
151
|
}
|
|
148
|
-
const
|
|
149
|
-
if (t && ((
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
total:
|
|
152
|
+
const i = !t || G(t) && p === "hascode" || !G(t) && p === "nocode" || p === "" ? F + 1 : F;
|
|
153
|
+
if (t && (G(t) && p === "nocode" || !G(t) && p === "hascode")) {
|
|
154
|
+
const s = n.findIndex((r) => r.id === t.id);
|
|
155
|
+
s > -1 && (n.splice(s, 1), a = [...n], M((r) => Q(V({}, r), {
|
|
156
|
+
total: r.total ? r.total - 1 : r.total
|
|
153
157
|
})));
|
|
154
158
|
}
|
|
155
|
-
const
|
|
156
|
-
return
|
|
157
|
-
current:
|
|
158
|
-
pageSize:
|
|
159
|
+
const f = a || n;
|
|
160
|
+
return i >= f.length ? ((c.current - 1) * c.pageSize + i, c.total && i >= c.total ? P.error("已经是最后一个了") : M({
|
|
161
|
+
current: c.current + 1,
|
|
162
|
+
pageSize: c.pageSize,
|
|
159
163
|
type: "next"
|
|
160
164
|
})) : setTimeout(() => {
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
w(
|
|
164
|
-
}, 0),
|
|
165
|
+
z(i);
|
|
166
|
+
const s = f[i];
|
|
167
|
+
w(s);
|
|
168
|
+
}, 0), f;
|
|
165
169
|
});
|
|
166
|
-
},
|
|
167
|
-
|
|
168
|
-
if (!y)
|
|
170
|
+
}, je = () => {
|
|
171
|
+
if (!g)
|
|
169
172
|
return;
|
|
170
|
-
const e =
|
|
171
|
-
let
|
|
172
|
-
if (e &&
|
|
173
|
-
const
|
|
174
|
-
if (
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
total:
|
|
173
|
+
const e = I.current || o, t = [...g];
|
|
174
|
+
let n;
|
|
175
|
+
if (e && g) {
|
|
176
|
+
const f = t.findIndex((s) => s.id === e.id);
|
|
177
|
+
if (f > -1 && t.splice(f, 1, e), G(e) && p === "nocode" || !G(e) && p === "hascode") {
|
|
178
|
+
const s = t.findIndex((r) => r.id === e.id);
|
|
179
|
+
s > -1 && (t.splice(s, 1), n = [...t], M((r) => Q(V({}, r), {
|
|
180
|
+
total: r.total ? r.total - 1 : r.total
|
|
178
181
|
})));
|
|
179
182
|
}
|
|
180
183
|
}
|
|
181
|
-
const
|
|
182
|
-
if (
|
|
183
|
-
(
|
|
184
|
-
current:
|
|
185
|
-
pageSize:
|
|
184
|
+
const a = n || t, i = F - 1;
|
|
185
|
+
if (i < 0)
|
|
186
|
+
(c.current - 1) * c.pageSize + i < 0 ? P.error("已经是第一个了") : M({
|
|
187
|
+
current: c.current - 1,
|
|
188
|
+
pageSize: c.pageSize,
|
|
186
189
|
type: "prev"
|
|
187
190
|
});
|
|
188
191
|
else {
|
|
189
|
-
|
|
190
|
-
const
|
|
191
|
-
w(
|
|
192
|
+
z(i);
|
|
193
|
+
const f = a[i];
|
|
194
|
+
w(f);
|
|
192
195
|
}
|
|
193
|
-
|
|
196
|
+
n && $(n);
|
|
194
197
|
};
|
|
195
|
-
|
|
196
|
-
if (!
|
|
198
|
+
oe(() => {
|
|
199
|
+
if (!u || !m || !v || !o)
|
|
197
200
|
return;
|
|
198
|
-
const e = ++
|
|
199
|
-
|
|
200
|
-
e ===
|
|
201
|
+
const e = ++Ce.current;
|
|
202
|
+
Qe(!0), d == null || d.getDatasetsIdVersionsVidSsamplesSid(m, v, o.id).then((t) => {
|
|
203
|
+
e === Ce.current && w(t);
|
|
201
204
|
}).finally(() => {
|
|
202
|
-
e ===
|
|
205
|
+
e === Ce.current && Qe(!1);
|
|
203
206
|
});
|
|
204
|
-
}, [
|
|
205
|
-
const
|
|
206
|
-
|
|
207
|
+
}, [u, o == null ? void 0 : o.id]);
|
|
208
|
+
const it = () => T(void 0, null, function* () {
|
|
209
|
+
B && J && !(yield new Promise((t) => {
|
|
210
|
+
Xe.confirm({
|
|
211
|
+
title: "有未保存的标注,确认关闭吗?",
|
|
212
|
+
content: "关闭后改动将丢失",
|
|
213
|
+
onOk: () => t(!0),
|
|
214
|
+
onCancel: () => t(!1)
|
|
215
|
+
});
|
|
216
|
+
})) || x === "attributeDefinition" && E.current && !(yield E.current.checkDirtyAndConfirm()) || x === "qaGeneration" && R.current && !(yield R.current.checkDirtyAndConfirm()) || Z();
|
|
207
217
|
});
|
|
208
|
-
|
|
209
|
-
handleModalCancel:
|
|
210
|
-
})),
|
|
218
|
+
yt(y, () => ({
|
|
219
|
+
handleModalCancel: it
|
|
220
|
+
})), oe(() => {
|
|
211
221
|
O.current && (O.current.width = O.current.offsetWidth, O.current.height = O.current.offsetHeight);
|
|
212
222
|
}, [O.current]);
|
|
213
|
-
const
|
|
214
|
-
if (
|
|
223
|
+
const rt = () => T(void 0, null, function* () {
|
|
224
|
+
if (se)
|
|
215
225
|
return;
|
|
216
|
-
if (
|
|
217
|
-
|
|
226
|
+
if (q(!0), x === "qaGeneration" && R.current && !(yield R.current.checkDirtyAndConfirm())) {
|
|
227
|
+
q(!1);
|
|
218
228
|
return;
|
|
219
229
|
}
|
|
220
|
-
const e =
|
|
230
|
+
const e = I.current || o;
|
|
221
231
|
if (!e) {
|
|
222
|
-
|
|
232
|
+
q(!1);
|
|
223
233
|
return;
|
|
224
234
|
}
|
|
225
|
-
console.log("onPrevClick sampleToUse", e),
|
|
226
|
-
t ? (
|
|
235
|
+
console.log("onPrevClick sampleToUse", e), x === "textAnnotation" && J ? (fe(!0), C(e).then((t) => {
|
|
236
|
+
t ? (H(void 0), je(), b()) : P.error("保存失败");
|
|
227
237
|
}).finally(() => {
|
|
228
|
-
|
|
229
|
-
})) : (
|
|
230
|
-
}),
|
|
231
|
-
if (
|
|
238
|
+
fe(!1), q(!1);
|
|
239
|
+
})) : (je(), q(!1));
|
|
240
|
+
}), ot = () => T(void 0, null, function* () {
|
|
241
|
+
if (se)
|
|
232
242
|
return;
|
|
233
|
-
if (
|
|
234
|
-
|
|
243
|
+
if (q(!0), x === "qaGeneration" && R.current && !(yield R.current.checkDirtyAndConfirm())) {
|
|
244
|
+
q(!1);
|
|
235
245
|
return;
|
|
236
246
|
}
|
|
237
|
-
const e =
|
|
247
|
+
const e = I.current || o;
|
|
238
248
|
if (!e) {
|
|
239
|
-
|
|
249
|
+
q(!1);
|
|
240
250
|
return;
|
|
241
251
|
}
|
|
242
|
-
console.log("onNextClick sampleToUse", e),
|
|
243
|
-
t ? (
|
|
252
|
+
console.log("onNextClick sampleToUse", e), x === "textAnnotation" && J ? (fe(!0), C(e).then((t) => {
|
|
253
|
+
t ? (H(void 0), Re(), b()) : P.error("保存失败");
|
|
244
254
|
}).finally(() => {
|
|
245
|
-
|
|
246
|
-
})) : (
|
|
255
|
+
fe(!1), q(!1);
|
|
256
|
+
})) : (Re(), q(!1));
|
|
247
257
|
});
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
}, [
|
|
251
|
-
const
|
|
252
|
-
console.log("ocrRecognize apiUrl",
|
|
253
|
-
const t = yield
|
|
254
|
-
return
|
|
258
|
+
oe(() => {
|
|
259
|
+
I.current = o;
|
|
260
|
+
}, [o]);
|
|
261
|
+
const at = (e) => T(void 0, null, function* () {
|
|
262
|
+
console.log("ocrRecognize apiUrl", qe);
|
|
263
|
+
const t = yield Ye();
|
|
264
|
+
return kt.post(`${qe}/aishop/v2/infer?serviceId=Actpkb4pi3vxg`, {
|
|
255
265
|
pages: [{
|
|
256
266
|
image: e,
|
|
257
267
|
no: 0
|
|
@@ -260,188 +270,198 @@ const {
|
|
|
260
270
|
headers: {
|
|
261
271
|
Authorization: t ? `Bearer ${t}` : ""
|
|
262
272
|
}
|
|
263
|
-
}).then((
|
|
264
|
-
console.error("ocrRecognize error",
|
|
273
|
+
}).then((n) => (console.log("ocrRecognize res", n.data.data), n.data.data.pages[0].layout.filter((i) => i.content))).catch((n) => {
|
|
274
|
+
console.error("ocrRecognize error", n);
|
|
265
275
|
});
|
|
266
|
-
}),
|
|
267
|
-
const e =
|
|
268
|
-
!e || !
|
|
276
|
+
}), ct = () => T(void 0, null, function* () {
|
|
277
|
+
const e = I.current || o;
|
|
278
|
+
!e || !m || !v || Xe.confirm({
|
|
269
279
|
title: "确认要删除此数据吗?",
|
|
270
280
|
content: "删除后不可恢复,请慎重操作",
|
|
271
|
-
onOk: () =>
|
|
281
|
+
onOk: () => T(void 0, null, function* () {
|
|
272
282
|
console.log("handleDeleteClick currentSample", e);
|
|
273
283
|
try {
|
|
274
|
-
yield d == null ? void 0 : d.delDatasetsIdVersionsVidSamplesId(
|
|
275
|
-
var
|
|
276
|
-
const
|
|
277
|
-
if (
|
|
284
|
+
yield d == null ? void 0 : d.delDatasetsIdVersionsVidSamplesId(m, v, e.id), P.success("删除成功"), $((t) => {
|
|
285
|
+
var r;
|
|
286
|
+
const n = t.findIndex((S) => S.id === e.id);
|
|
287
|
+
if (n === -1)
|
|
278
288
|
return t;
|
|
279
|
-
const
|
|
280
|
-
if (
|
|
281
|
-
total:
|
|
282
|
-
}),
|
|
283
|
-
current:
|
|
284
|
-
pageSize:
|
|
289
|
+
const a = [...t.slice(0, n), ...t.slice(n + 1)], i = c.pageSize || 1, f = Math.max(((r = c.total) != null ? r : t.length) - 1, 0), s = a.length === 0 && f > c.current * i;
|
|
290
|
+
if (M((S) => V(Q(V({}, S), {
|
|
291
|
+
total: f
|
|
292
|
+
}), s ? {
|
|
293
|
+
current: S.current + 1,
|
|
294
|
+
pageSize: i,
|
|
285
295
|
type: "next"
|
|
286
296
|
} : {
|
|
287
|
-
type:
|
|
288
|
-
})),
|
|
289
|
-
const
|
|
290
|
-
|
|
297
|
+
type: s ? "next" : void 0
|
|
298
|
+
})), a.length) {
|
|
299
|
+
const S = Math.min(n, a.length - 1);
|
|
300
|
+
z(S), w(a[S]);
|
|
291
301
|
} else
|
|
292
|
-
|
|
293
|
-
return
|
|
294
|
-
}),
|
|
302
|
+
z(-1), w(void 0);
|
|
303
|
+
return a;
|
|
304
|
+
}), b();
|
|
295
305
|
} catch (t) {
|
|
296
|
-
|
|
306
|
+
P.error("删除失败");
|
|
297
307
|
}
|
|
298
308
|
})
|
|
299
309
|
});
|
|
300
|
-
}),
|
|
301
|
-
if (!
|
|
310
|
+
}), st = () => T(void 0, null, function* () {
|
|
311
|
+
if (!m || !v || !(o != null && o.id))
|
|
302
312
|
return;
|
|
303
|
-
const e = yield d == null ? void 0 : d.getDatasetsIdVersionsVidSsamplesSid(
|
|
304
|
-
e && (w(e),
|
|
313
|
+
const e = yield d == null ? void 0 : d.getDatasetsIdVersionsVidSsamplesSid(m, v, o.id);
|
|
314
|
+
e && (w(e), I.current = e);
|
|
305
315
|
});
|
|
306
316
|
return /* @__PURE__ */ K("div", {
|
|
307
317
|
className: "vlm-records-content",
|
|
308
318
|
children: [/* @__PURE__ */ l("div", {
|
|
309
319
|
className: "records-content-tabs-container",
|
|
310
|
-
children: /* @__PURE__ */ K(
|
|
320
|
+
children: /* @__PURE__ */ K(Te, {
|
|
311
321
|
className: "records-content-tabs",
|
|
312
322
|
activeKey: p,
|
|
313
|
-
onChange: (e) =>
|
|
314
|
-
var
|
|
315
|
-
|
|
316
|
-
index:
|
|
317
|
-
page:
|
|
323
|
+
onChange: (e) => T(void 0, null, function* () {
|
|
324
|
+
var n, a;
|
|
325
|
+
F >= 0 && p !== void 0 && p !== null && (_.current[p] = {
|
|
326
|
+
index: F,
|
|
327
|
+
page: c.current || 1
|
|
318
328
|
});
|
|
319
329
|
let t = !1;
|
|
320
|
-
if (!(
|
|
321
|
-
if (
|
|
322
|
-
const
|
|
323
|
-
if (
|
|
324
|
-
if (!(yield
|
|
325
|
-
|
|
330
|
+
if (!(x === "attributeDefinition" && E.current && (t = !!((a = (n = E.current).hasUnsavedChanges) != null && a.call(n)), !(yield E.current.checkDirtyAndConfirm()))) && !(x === "qaGeneration" && R.current && !(yield R.current.checkDirtyAndConfirm()))) {
|
|
331
|
+
if (x === "textAnnotation" && J) {
|
|
332
|
+
const i = I.current || o;
|
|
333
|
+
if (i && C) {
|
|
334
|
+
if (!(yield C(i))) {
|
|
335
|
+
P.error("保存失败,已阻止切换筛选");
|
|
326
336
|
return;
|
|
327
337
|
}
|
|
328
|
-
w(
|
|
338
|
+
w(i), I.current = i, H(void 0), b == null || b(), p === "nocode" && G(i) && ($([]), w(i), z(-1), W(i.id), M(Q(V({}, c), {
|
|
329
339
|
current: 1,
|
|
330
340
|
total: void 0,
|
|
331
341
|
type: void 0
|
|
332
|
-
})),
|
|
342
|
+
})), ae("hascode"));
|
|
333
343
|
}
|
|
334
344
|
}
|
|
335
|
-
t &&
|
|
345
|
+
t && et(Date.now()), nt(Date.now()), x !== "attributeDefinition" && (ke(!0), $([]), w(void 0), z(-1), W(void 0)), M(Q(V({}, c), {
|
|
336
346
|
current: 1,
|
|
337
347
|
total: void 0,
|
|
338
348
|
type: void 0
|
|
339
|
-
})),
|
|
349
|
+
})), ae(e), xe == null || xe(e);
|
|
340
350
|
}
|
|
341
351
|
}),
|
|
342
352
|
children: [/* @__PURE__ */ l(Y, {
|
|
343
|
-
tab: `全部(${
|
|
353
|
+
tab: `全部(${Ne})`
|
|
344
354
|
}, ""), /* @__PURE__ */ l(Y, {
|
|
345
|
-
tab: `未标注(${
|
|
355
|
+
tab: `未标注(${Ue})`
|
|
346
356
|
}, "nocode"), /* @__PURE__ */ l(Y, {
|
|
347
|
-
tab: `已标注(${
|
|
357
|
+
tab: `已标注(${Ne - Ue})`
|
|
348
358
|
}, "hascode")]
|
|
349
359
|
})
|
|
350
|
-
}),
|
|
360
|
+
}), g != null && g.length ? /* @__PURE__ */ l("div", {
|
|
351
361
|
className: "sample-detail",
|
|
352
|
-
children:
|
|
353
|
-
className: "content-mode-buttons",
|
|
354
|
-
children: /* @__PURE__ */ K(Re, {
|
|
355
|
-
activeKey: m,
|
|
356
|
-
onChange: (e) => z(void 0, null, function* () {
|
|
357
|
-
var t, i;
|
|
358
|
-
if (!(m === "attributeDefinition" && B.current && !(yield B.current.checkDirtyAndConfirm())) && !(m === "qaGeneration" && V.current && !(yield V.current.checkDirtyAndConfirm()))) {
|
|
359
|
-
if (m === "textAnnotation" && R && _ && (b.current || r)) {
|
|
360
|
-
const n = b.current || r;
|
|
361
|
-
if (!(yield R(n))) {
|
|
362
|
-
$.error("保存失败,已阻止切换页签");
|
|
363
|
-
return;
|
|
364
|
-
}
|
|
365
|
-
w(n), b.current = n, J(void 0), A == null || A(), p === "nocode" && ((t = n == null ? void 0 : n.labels) != null && t.length) && (E >= 0 && (Z.current.nocode = {
|
|
366
|
-
index: E,
|
|
367
|
-
page: s.current || 1
|
|
368
|
-
}), F([]), w(n), T(-1), W(n.id), q(j(L({}, s), {
|
|
369
|
-
current: 1,
|
|
370
|
-
total: void 0,
|
|
371
|
-
type: void 0
|
|
372
|
-
})), oe("hascode")), p === "hascode" && !((i = n == null ? void 0 : n.labels) != null && i.length) && (E >= 0 && (Z.current.hascode = {
|
|
373
|
-
index: E,
|
|
374
|
-
page: s.current || 1
|
|
375
|
-
}), F([]), w(n), T(-1), W(n.id), q(j(L({}, s), {
|
|
376
|
-
current: 1,
|
|
377
|
-
total: void 0,
|
|
378
|
-
type: void 0
|
|
379
|
-
})), oe("nocode"));
|
|
380
|
-
}
|
|
381
|
-
e === "textAnnotation" && (r != null && r.id) && (yield it()), se(e);
|
|
382
|
-
}
|
|
383
|
-
}),
|
|
384
|
-
children: [/* @__PURE__ */ l(Y, {
|
|
385
|
-
tab: "属性定义",
|
|
386
|
-
disabled: Ce
|
|
387
|
-
}, "attributeDefinition"), /* @__PURE__ */ l(Y, {
|
|
388
|
-
tab: "文本标注",
|
|
389
|
-
disabled: Ce
|
|
390
|
-
}, "textAnnotation"), /* @__PURE__ */ l(Y, {
|
|
391
|
-
tab: "QA生成",
|
|
392
|
-
disabled: Ce
|
|
393
|
-
}, "qaGeneration")]
|
|
394
|
-
})
|
|
395
|
-
}), m === "textAnnotation" && r && /* @__PURE__ */ l("div", {
|
|
362
|
+
children: B ? o && /* @__PURE__ */ l("div", {
|
|
396
363
|
className: "container",
|
|
397
|
-
children: /* @__PURE__ */ l(
|
|
398
|
-
|
|
399
|
-
|
|
364
|
+
children: /* @__PURE__ */ l(Rt, {
|
|
365
|
+
ref: Ee,
|
|
366
|
+
sample: o,
|
|
400
367
|
onChange: (e) => {
|
|
401
|
-
|
|
402
|
-
}
|
|
403
|
-
ocrRecognize: tt
|
|
368
|
+
I.current = e, H(e);
|
|
369
|
+
}
|
|
404
370
|
})
|
|
405
|
-
})
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
371
|
+
}) : /* @__PURE__ */ K(We, {
|
|
372
|
+
children: [/* @__PURE__ */ l("div", {
|
|
373
|
+
className: "content-mode-buttons",
|
|
374
|
+
children: /* @__PURE__ */ K(Te, {
|
|
375
|
+
activeKey: x,
|
|
376
|
+
onChange: (e) => T(void 0, null, function* () {
|
|
377
|
+
if (!(x === "attributeDefinition" && E.current && !(yield E.current.checkDirtyAndConfirm())) && !(x === "qaGeneration" && R.current && !(yield R.current.checkDirtyAndConfirm()))) {
|
|
378
|
+
if (x === "textAnnotation" && C && J && (I.current || o)) {
|
|
379
|
+
const t = I.current || o;
|
|
380
|
+
if (!(yield C(t))) {
|
|
381
|
+
P.error("保存失败,已阻止切换页签");
|
|
382
|
+
return;
|
|
383
|
+
}
|
|
384
|
+
w(t), I.current = t, H(void 0), b == null || b(), p === "nocode" && G(t) && (F >= 0 && (_.current.nocode = {
|
|
385
|
+
index: F,
|
|
386
|
+
page: c.current || 1
|
|
387
|
+
}), $([]), w(t), z(-1), W(t.id), M(Q(V({}, c), {
|
|
388
|
+
current: 1,
|
|
389
|
+
total: void 0,
|
|
390
|
+
type: void 0
|
|
391
|
+
})), ae("hascode")), p === "hascode" && !G(t) && (F >= 0 && (_.current.hascode = {
|
|
392
|
+
index: F,
|
|
393
|
+
page: c.current || 1
|
|
394
|
+
}), $([]), w(t), z(-1), W(t.id), M(Q(V({}, c), {
|
|
395
|
+
current: 1,
|
|
396
|
+
total: void 0,
|
|
397
|
+
type: void 0
|
|
398
|
+
})), ae("nocode"));
|
|
399
|
+
}
|
|
400
|
+
e === "textAnnotation" && (o != null && o.id) && (yield st()), ce(e);
|
|
401
|
+
}
|
|
402
|
+
}),
|
|
403
|
+
children: [/* @__PURE__ */ l(Y, {
|
|
404
|
+
tab: "属性定义",
|
|
405
|
+
disabled: we
|
|
406
|
+
}, "attributeDefinition"), /* @__PURE__ */ l(Y, {
|
|
407
|
+
tab: "文本标注",
|
|
408
|
+
disabled: we
|
|
409
|
+
}, "textAnnotation"), /* @__PURE__ */ l(Y, {
|
|
410
|
+
tab: "QA生成",
|
|
411
|
+
disabled: we
|
|
412
|
+
}, "qaGeneration")]
|
|
413
|
+
})
|
|
414
|
+
}), x === "textAnnotation" && o && /* @__PURE__ */ l("div", {
|
|
415
|
+
className: "container",
|
|
416
|
+
children: /* @__PURE__ */ l(It, {
|
|
417
|
+
sample: o,
|
|
418
|
+
labelDefinitions: ye,
|
|
419
|
+
onChange: (e) => {
|
|
420
|
+
I.current = e, H(e);
|
|
421
|
+
},
|
|
422
|
+
ocrRecognize: at
|
|
423
|
+
})
|
|
424
|
+
}), x === "attributeDefinition" && /* @__PURE__ */ l(At, {
|
|
425
|
+
ref: E,
|
|
426
|
+
datasetId: m,
|
|
427
|
+
versionId: v,
|
|
428
|
+
onAttributesChange: (e) => {
|
|
429
|
+
$e(e), e.length > 0 && ye.length === 0 && ce("textAnnotation");
|
|
430
|
+
},
|
|
431
|
+
onLoadingChange: (e) => {
|
|
432
|
+
Ze(e);
|
|
433
|
+
}
|
|
434
|
+
}, `attribute-${_e}`), x === "qaGeneration" && /* @__PURE__ */ l(bt, {
|
|
435
|
+
ref: R,
|
|
436
|
+
sample: o,
|
|
437
|
+
labels: ye,
|
|
438
|
+
datasetId: m,
|
|
439
|
+
visionId: v
|
|
440
|
+
}, `qa-${tt}`)]
|
|
441
|
+
})
|
|
442
|
+
}) : Ie ? /* @__PURE__ */ l("div", {
|
|
423
443
|
style: {
|
|
424
444
|
padding: "48px 0",
|
|
425
445
|
textAlign: "center"
|
|
426
446
|
},
|
|
427
|
-
children: /* @__PURE__ */ l(
|
|
428
|
-
}) : /* @__PURE__ */ l(
|
|
447
|
+
children: /* @__PURE__ */ l(pt, {})
|
|
448
|
+
}) : /* @__PURE__ */ l(Ct, {}), B || x !== "attributeDefinition" ? /* @__PURE__ */ K("div", {
|
|
429
449
|
className: "vlm-detail-footer",
|
|
430
450
|
children: [/* @__PURE__ */ l("div", {
|
|
431
451
|
style: {
|
|
432
452
|
flex: 1
|
|
433
453
|
}
|
|
434
|
-
}), /* @__PURE__ */ K(
|
|
454
|
+
}), /* @__PURE__ */ K(Je, {
|
|
435
455
|
size: 24,
|
|
436
|
-
children: [(
|
|
456
|
+
children: [(g == null ? void 0 : g.length) > 0 && /* @__PURE__ */ l(ge, {
|
|
437
457
|
type: "default",
|
|
438
|
-
disabled:
|
|
439
|
-
onClick:
|
|
458
|
+
disabled: Fe || Ie || de || se || ue,
|
|
459
|
+
onClick: rt,
|
|
440
460
|
children: "上一张"
|
|
441
|
-
}, "prev"), (
|
|
461
|
+
}, "prev"), (g == null ? void 0 : g.length) > 0 && /* @__PURE__ */ l(ge, {
|
|
442
462
|
type: "default",
|
|
443
|
-
disabled:
|
|
444
|
-
onClick:
|
|
463
|
+
disabled: Fe || Ie || de || se || ue,
|
|
464
|
+
onClick: ot,
|
|
445
465
|
children: "下一张"
|
|
446
466
|
}, "next")]
|
|
447
467
|
}), /* @__PURE__ */ l("div", {
|
|
@@ -450,23 +470,26 @@ const {
|
|
|
450
470
|
display: "flex",
|
|
451
471
|
justifyContent: "flex-end"
|
|
452
472
|
},
|
|
453
|
-
children: /* @__PURE__ */ l(
|
|
454
|
-
children:
|
|
455
|
-
children: [/* @__PURE__ */ l(
|
|
456
|
-
disabled: !
|
|
473
|
+
children: /* @__PURE__ */ l(Je, {
|
|
474
|
+
children: (B || x === "textAnnotation") && (g == null ? void 0 : g.length) > 0 ? /* @__PURE__ */ K(We, {
|
|
475
|
+
children: [/* @__PURE__ */ l(ge, {
|
|
476
|
+
disabled: !o || !J || de,
|
|
457
477
|
type: "primary",
|
|
458
478
|
onClick: () => {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
479
|
+
var t, n;
|
|
480
|
+
if (B && !((n = (t = Ee.current) == null ? void 0 : t.validate()) != null ? n : !0))
|
|
481
|
+
return;
|
|
482
|
+
const e = I.current || o;
|
|
483
|
+
e && (Ae(!0), C(e).then((a) => T(void 0, null, function* () {
|
|
484
|
+
a ? (P.success("保存成功"), H(void 0), Re(), b(), Ae(!1)) : (P.error("保存失败"), Ae(!1));
|
|
462
485
|
})));
|
|
463
486
|
},
|
|
464
|
-
loading:
|
|
487
|
+
loading: ue,
|
|
465
488
|
children: "保存标注"
|
|
466
|
-
}, "save"), /* @__PURE__ */ l(
|
|
489
|
+
}, "save"), /* @__PURE__ */ l(ge, {
|
|
467
490
|
type: "default",
|
|
468
|
-
disabled:
|
|
469
|
-
onClick:
|
|
491
|
+
disabled: ue || de,
|
|
492
|
+
onClick: ct,
|
|
470
493
|
children: "删除数据"
|
|
471
494
|
})]
|
|
472
495
|
}) : null
|
|
@@ -476,5 +499,5 @@ const {
|
|
|
476
499
|
});
|
|
477
500
|
});
|
|
478
501
|
export {
|
|
479
|
-
|
|
502
|
+
Bt as default
|
|
480
503
|
};
|