@glodon-aiot/dataset-annotation 3.24.0-alpha.6 → 3.25.0-alpha.10
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 +399 -343
- 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 +607 -590
- 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 -243
- package/dist/es/components/VLMAnnotationDetail/VLMDetail/index.mjs +304 -298
- package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +86 -83
- package/dist/es/components/VLMAnnotationDetail/index.mjs +386 -300
- 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 +7 -0
- package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +6 -1
- package/dist/src/utils/checkVlmSampleLabeled.d.ts +8 -0
- package/dist/src/utils/scrollSampleIntoView.d.ts +9 -0
- package/package.json +2 -2
|
@@ -15,18 +15,18 @@ var g = (f, p, l) => new Promise((w, o) => {
|
|
|
15
15
|
h((l = l.apply(f, p)).next());
|
|
16
16
|
});
|
|
17
17
|
import { jsx as e, jsxs as r, Fragment as y } from "react/jsx-runtime";
|
|
18
|
-
import { useRef as
|
|
19
|
-
import { Modal as
|
|
18
|
+
import { useRef as Z, useState as m, useContext as Me, useEffect as V, useCallback as ke } from "react";
|
|
19
|
+
import { Modal as _, Button as v, Space as ee, Spin as be, Tabs as xe, message as ie } from "antd";
|
|
20
20
|
import "./style.less.mjs";
|
|
21
|
-
import { useKeyPress as
|
|
22
|
-
import { LoadingOutlined as
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
21
|
+
import { useKeyPress as ne } from "ahooks";
|
|
22
|
+
import { LoadingOutlined as Ie, MenuUnfoldOutlined as qe, MenuFoldOutlined as Ve } from "@ant-design/icons";
|
|
23
|
+
import Qe from "../../../DatasetContext/index.mjs";
|
|
24
|
+
import Ae from "../../VLMAnnotation/index.mjs";
|
|
25
|
+
import Le from "../../VQAAnnotation/VQAAnnotationPanel.mjs";
|
|
26
|
+
import ae from "../../Iconfont/index.mjs";
|
|
27
|
+
import Te from "../VLMDetail/index.mjs";
|
|
28
28
|
const Xe = (f) => {
|
|
29
|
-
var
|
|
29
|
+
var K, S, U, B, X, G, $, H;
|
|
30
30
|
const {
|
|
31
31
|
vlmMarkTmpl: p,
|
|
32
32
|
isVlmModalVisible: l,
|
|
@@ -37,17 +37,18 @@ const Xe = (f) => {
|
|
|
37
37
|
listLoading: h = !1,
|
|
38
38
|
datasetId: a,
|
|
39
39
|
versionId: s,
|
|
40
|
-
handleMarkClick:
|
|
41
|
-
updateSampleList:
|
|
40
|
+
handleMarkClick: te,
|
|
41
|
+
updateSampleList: Q,
|
|
42
42
|
filterMode: le = "",
|
|
43
43
|
onFilterModeChange: se,
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
44
|
+
onCurrentSampleChange: oe,
|
|
45
|
+
samples: re,
|
|
46
|
+
onSave: A,
|
|
47
|
+
selectSampleId: de,
|
|
48
|
+
onClose: L,
|
|
49
|
+
pagination: ce,
|
|
50
|
+
currentIndex: me
|
|
51
|
+
} = f, fe = Z({}), b = Z(null), [i, ue] = m(), [ve, T] = m(!1), [c, x] = m(f.initialMode || "preview"), [he, I] = m([]), [E, R] = m(0), [pe, O] = m(!1), [P, q] = m(!0), [D, j] = m(!1), {
|
|
51
52
|
services: {
|
|
52
53
|
cvforceDatahub: d
|
|
53
54
|
},
|
|
@@ -56,46 +57,46 @@ const Xe = (f) => {
|
|
|
56
57
|
} = {
|
|
57
58
|
datasetManager: !1
|
|
58
59
|
}
|
|
59
|
-
} =
|
|
60
|
+
} = Me(Qe), C = !(ve || h), F = () => {
|
|
60
61
|
C && k();
|
|
61
|
-
},
|
|
62
|
+
}, z = () => {
|
|
62
63
|
C && M();
|
|
63
64
|
};
|
|
64
|
-
|
|
65
|
+
ne("rightarrow", (t) => {
|
|
65
66
|
if (c === "annotation")
|
|
66
67
|
return;
|
|
67
68
|
const n = t.target;
|
|
68
|
-
(n == null ? void 0 : n.tagName) === "INPUT" || (n == null ? void 0 : n.tagName) === "TEXTAREA" || n != null && n.isContentEditable ||
|
|
69
|
-
}),
|
|
69
|
+
(n == null ? void 0 : n.tagName) === "INPUT" || (n == null ? void 0 : n.tagName) === "TEXTAREA" || n != null && n.isContentEditable || z();
|
|
70
|
+
}), ne("leftarrow", (t) => {
|
|
70
71
|
if (c === "annotation")
|
|
71
72
|
return;
|
|
72
73
|
const n = t.target;
|
|
73
|
-
(n == null ? void 0 : n.tagName) === "INPUT" || (n == null ? void 0 : n.tagName) === "TEXTAREA" || n != null && n.isContentEditable ||
|
|
74
|
+
(n == null ? void 0 : n.tagName) === "INPUT" || (n == null ? void 0 : n.tagName) === "TEXTAREA" || n != null && n.isContentEditable || F();
|
|
74
75
|
});
|
|
75
|
-
const
|
|
76
|
+
const Ne = p === "VQA";
|
|
76
77
|
V(() => {
|
|
77
78
|
l ? f.initialMode && x(f.initialMode) : x("preview");
|
|
78
79
|
}, [l, f.initialMode]), V(() => {
|
|
79
80
|
if (l && a && s && c === "preview") {
|
|
80
|
-
if (
|
|
81
|
+
if (T(!0), !(o != null && o.id))
|
|
81
82
|
return;
|
|
82
83
|
d == null || d.getDatasetsIdVersionsVidSsamplesSid(a, s, o.id).then((t) => {
|
|
83
|
-
|
|
84
|
-
}).finally(() =>
|
|
84
|
+
ue(t);
|
|
85
|
+
}).finally(() => T(!1));
|
|
85
86
|
}
|
|
86
87
|
}, [l, o, c]);
|
|
87
|
-
const
|
|
88
|
+
const Ce = ke(() => g(void 0, null, function* () {
|
|
88
89
|
if (!(!a || !s || !(i != null && i.id))) {
|
|
89
|
-
|
|
90
|
+
O(!0);
|
|
90
91
|
try {
|
|
91
92
|
const t = yield d == null ? void 0 : d.postGenerateVlmKieQa(a, s, {
|
|
92
93
|
sampleIds: [i.id]
|
|
93
94
|
});
|
|
94
|
-
I(t || []),
|
|
95
|
+
I(t || []), R(0);
|
|
95
96
|
} catch (t) {
|
|
96
97
|
console.error("QA生成失败", t), I([]);
|
|
97
98
|
} finally {
|
|
98
|
-
|
|
99
|
+
O(!1);
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
}), [a, s, i]);
|
|
@@ -103,32 +104,32 @@ const Xe = (f) => {
|
|
|
103
104
|
if (!l || c !== "preview" || !(i != null && i.id))
|
|
104
105
|
return;
|
|
105
106
|
if (((i == null ? void 0 : i.labels) || []).length)
|
|
106
|
-
j(!1),
|
|
107
|
+
j(!1), Ce();
|
|
107
108
|
else {
|
|
108
109
|
I([]), q(!1), j(!0);
|
|
109
110
|
return;
|
|
110
111
|
}
|
|
111
112
|
}, [i]);
|
|
112
|
-
const
|
|
113
|
+
const ge = () => g(void 0, null, function* () {
|
|
113
114
|
if (c === "annotation" && b.current) {
|
|
114
115
|
yield b.current.handleModalCancel();
|
|
115
116
|
return;
|
|
116
117
|
} else
|
|
117
|
-
|
|
118
|
-
}),
|
|
119
|
-
x("annotation"),
|
|
120
|
-
},
|
|
121
|
-
|
|
118
|
+
L();
|
|
119
|
+
}), ye = () => {
|
|
120
|
+
x("annotation"), te((i == null ? void 0 : i.id) || (o == null ? void 0 : o.id));
|
|
121
|
+
}, we = () => {
|
|
122
|
+
_.confirm({
|
|
122
123
|
title: "确认要删除此数据吗?",
|
|
123
124
|
content: "删除后不可恢复,请慎重操作",
|
|
124
125
|
onOk: () => {
|
|
125
126
|
!a || !s || !(i != null && i.id) || d == null || d.delDatasetsIdVersionsVidSamplesId(a, s, i.id).then(() => {
|
|
126
|
-
|
|
127
|
-
}).catch(() =>
|
|
127
|
+
ie.success("删除成功"), Q(i.id), w(!1);
|
|
128
|
+
}).catch(() => ie.error("删除失败"));
|
|
128
129
|
}
|
|
129
130
|
});
|
|
130
131
|
};
|
|
131
|
-
return /* @__PURE__ */ e(
|
|
132
|
+
return /* @__PURE__ */ e(_, {
|
|
132
133
|
title: /* @__PURE__ */ e("div", {
|
|
133
134
|
className: "vlm-sample-detail-title",
|
|
134
135
|
children: /* @__PURE__ */ e("span", {
|
|
@@ -140,7 +141,7 @@ const Xe = (f) => {
|
|
|
140
141
|
className: "vlm-modal",
|
|
141
142
|
open: l,
|
|
142
143
|
destroyOnClose: !0,
|
|
143
|
-
onCancel: () =>
|
|
144
|
+
onCancel: () => ge(),
|
|
144
145
|
maskClosable: !1,
|
|
145
146
|
centered: !0,
|
|
146
147
|
footer: null,
|
|
@@ -151,16 +152,16 @@ const Xe = (f) => {
|
|
|
151
152
|
className: "detail-content",
|
|
152
153
|
children: [/* @__PURE__ */ e(v, {
|
|
153
154
|
className: "select-prev",
|
|
154
|
-
icon: /* @__PURE__ */ e(
|
|
155
|
+
icon: /* @__PURE__ */ e(ae, {
|
|
155
156
|
type: "icon-zuojiantou"
|
|
156
157
|
}),
|
|
157
158
|
type: "text",
|
|
158
159
|
disabled: !C,
|
|
159
|
-
onClick: () =>
|
|
160
|
+
onClick: () => F()
|
|
160
161
|
}), /* @__PURE__ */ e("div", {
|
|
161
162
|
className: "select-main",
|
|
162
|
-
ref:
|
|
163
|
-
children: i && /* @__PURE__ */ e(
|
|
163
|
+
ref: fe,
|
|
164
|
+
children: i && /* @__PURE__ */ e(Ae, {
|
|
164
165
|
sample: i,
|
|
165
166
|
labelDefinitions: [],
|
|
166
167
|
hideRightSide: !0,
|
|
@@ -169,15 +170,15 @@ const Xe = (f) => {
|
|
|
169
170
|
return [];
|
|
170
171
|
})
|
|
171
172
|
})
|
|
172
|
-
}),
|
|
173
|
+
}), Ne ? /* @__PURE__ */ e("div", {
|
|
173
174
|
className: "vqa-preview-panel",
|
|
174
|
-
children: /* @__PURE__ */ e(
|
|
175
|
-
question: (B = (U = (
|
|
176
|
-
answer: (
|
|
175
|
+
children: /* @__PURE__ */ e(Le, {
|
|
176
|
+
question: (B = (U = (S = (K = i == null ? void 0 : i.content) == null ? void 0 : K.conversations) == null ? void 0 : S[0]) == null ? void 0 : U.value) != null ? B : "",
|
|
177
|
+
answer: (H = ($ = (G = (X = i == null ? void 0 : i.content) == null ? void 0 : X.conversations) == null ? void 0 : G[1]) == null ? void 0 : $.value) != null ? H : "",
|
|
177
178
|
readOnly: !0
|
|
178
179
|
})
|
|
179
180
|
}) : /* @__PURE__ */ r(y, {
|
|
180
|
-
children: [
|
|
181
|
+
children: [P && /* @__PURE__ */ r(y, {
|
|
181
182
|
children: [/* @__PURE__ */ r("div", {
|
|
182
183
|
className: "qa-preview-container",
|
|
183
184
|
children: [/* @__PURE__ */ r("div", {
|
|
@@ -185,9 +186,9 @@ const Xe = (f) => {
|
|
|
185
186
|
children: [/* @__PURE__ */ e("div", {
|
|
186
187
|
className: "qa-preview-title",
|
|
187
188
|
children: "QA预览"
|
|
188
|
-
}), /* @__PURE__ */ e(
|
|
189
|
-
children:
|
|
190
|
-
indicator: /* @__PURE__ */ e(
|
|
189
|
+
}), /* @__PURE__ */ e(ee, {
|
|
190
|
+
children: pe && /* @__PURE__ */ e(be, {
|
|
191
|
+
indicator: /* @__PURE__ */ e(Ie, {
|
|
191
192
|
spin: !0,
|
|
192
193
|
style: {
|
|
193
194
|
fontSize: 16
|
|
@@ -198,23 +199,23 @@ const Xe = (f) => {
|
|
|
198
199
|
}), /* @__PURE__ */ e("div", {
|
|
199
200
|
className: "qa-preview-content",
|
|
200
201
|
children: (() => {
|
|
201
|
-
var
|
|
202
|
-
const t = ((
|
|
203
|
-
return !(((
|
|
202
|
+
var J, W;
|
|
203
|
+
const t = ((J = he[0]) == null ? void 0 : J.qas) || [];
|
|
204
|
+
return !(((W = i == null ? void 0 : i.labels) == null ? void 0 : W.length) > 0) || t.length === 0 ? /* @__PURE__ */ e("div", {
|
|
204
205
|
className: "result-empty",
|
|
205
206
|
children: "暂无结果"
|
|
206
207
|
}) : /* @__PURE__ */ r(y, {
|
|
207
|
-
children: [/* @__PURE__ */ e(
|
|
208
|
-
activeKey: String(
|
|
209
|
-
onChange: (u) =>
|
|
210
|
-
items: t.map((u,
|
|
211
|
-
key: String(
|
|
212
|
-
label: u.name || `模版${
|
|
208
|
+
children: [/* @__PURE__ */ e(xe, {
|
|
209
|
+
activeKey: String(E),
|
|
210
|
+
onChange: (u) => R(Number(u)),
|
|
211
|
+
items: t.map((u, Y) => ({
|
|
212
|
+
key: String(Y),
|
|
213
|
+
label: u.name || `模版${Y + 1}`
|
|
213
214
|
}))
|
|
214
215
|
}), /* @__PURE__ */ e("div", {
|
|
215
216
|
className: "qa-preview-result",
|
|
216
217
|
children: (() => {
|
|
217
|
-
const u = t[
|
|
218
|
+
const u = t[E];
|
|
218
219
|
return u ? /* @__PURE__ */ r("div", {
|
|
219
220
|
className: "result-item-container",
|
|
220
221
|
children: [/* @__PURE__ */ r("div", {
|
|
@@ -249,63 +250,65 @@ const Xe = (f) => {
|
|
|
249
250
|
className: "qa-preview-collapsed",
|
|
250
251
|
children: /* @__PURE__ */ e(v, {
|
|
251
252
|
type: "link",
|
|
252
|
-
icon: /* @__PURE__ */ e(
|
|
253
|
-
disabled:
|
|
253
|
+
icon: /* @__PURE__ */ e(qe, {}),
|
|
254
|
+
disabled: D,
|
|
254
255
|
onClick: () => q(!1)
|
|
255
256
|
})
|
|
256
257
|
})]
|
|
257
|
-
}), !
|
|
258
|
+
}), !P && /* @__PURE__ */ e("div", {
|
|
258
259
|
className: "qa-preview-collapsed",
|
|
259
260
|
children: /* @__PURE__ */ e(v, {
|
|
260
261
|
type: "link",
|
|
261
|
-
icon: /* @__PURE__ */ e(
|
|
262
|
-
disabled:
|
|
262
|
+
icon: /* @__PURE__ */ e(Ve, {}),
|
|
263
|
+
disabled: D,
|
|
263
264
|
onClick: () => q(!0)
|
|
264
265
|
})
|
|
265
266
|
})]
|
|
266
267
|
}), /* @__PURE__ */ e(v, {
|
|
267
268
|
className: "select-next",
|
|
268
|
-
icon: /* @__PURE__ */ e(
|
|
269
|
+
icon: /* @__PURE__ */ e(ae, {
|
|
269
270
|
type: "icon-youjiantou"
|
|
270
271
|
}),
|
|
271
272
|
type: "text",
|
|
272
273
|
disabled: !C,
|
|
273
|
-
onClick: () =>
|
|
274
|
+
onClick: () => z()
|
|
274
275
|
})]
|
|
275
276
|
})
|
|
276
277
|
}), /* @__PURE__ */ e("div", {
|
|
277
278
|
className: "vlm-mark-action",
|
|
278
|
-
children: /* @__PURE__ */ r(
|
|
279
|
+
children: /* @__PURE__ */ r(ee, {
|
|
279
280
|
children: [N && N.label && /* @__PURE__ */ e(v, {
|
|
280
281
|
type: "primary",
|
|
281
|
-
onClick:
|
|
282
|
+
onClick: ye,
|
|
282
283
|
children: "标注"
|
|
283
284
|
}), N && N.delete && /* @__PURE__ */ e(v, {
|
|
284
285
|
danger: !0,
|
|
285
286
|
type: "ghost",
|
|
286
|
-
onClick:
|
|
287
|
+
onClick: we,
|
|
287
288
|
children: "删除数据"
|
|
288
289
|
})]
|
|
289
290
|
})
|
|
290
291
|
})]
|
|
291
292
|
}) : (
|
|
292
293
|
// 标注模式:使用VLMDetail组件
|
|
293
|
-
|
|
294
|
+
A && /* @__PURE__ */ e(Te, {
|
|
294
295
|
ref: b,
|
|
295
296
|
visible: l,
|
|
296
|
-
selectSampleId:
|
|
297
|
+
selectSampleId: de,
|
|
297
298
|
datasetId: a,
|
|
298
299
|
versionId: s,
|
|
299
300
|
vlmMarkTmpl: p,
|
|
300
301
|
onClose: () => {
|
|
301
|
-
|
|
302
|
+
L();
|
|
302
303
|
},
|
|
303
|
-
onSave:
|
|
304
|
+
onSave: A,
|
|
305
|
+
onDeleteSample: Q,
|
|
304
306
|
externalFilterMode: le,
|
|
305
307
|
onFilterModeChange: se,
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
308
|
+
onCurrentSampleChange: oe,
|
|
309
|
+
externalSamples: re,
|
|
310
|
+
externalPagination: ce,
|
|
311
|
+
externalCurrentIndex: me
|
|
309
312
|
})
|
|
310
313
|
)
|
|
311
314
|
});
|