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