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