@glodon-aiot/dataset-annotation 3.25.0-alpha.9 → 3.25.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/DetectionAnnotation/index.mjs +410 -398
- package/dist/es/components/VLMAnnotationDetail/VLMDetail/index.mjs +235 -234
- package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +52 -51
- package/dist/es/components/VLMAnnotationDetail/index.mjs +318 -285
- package/dist/es/index.mjs +1 -1
- package/dist/lib/index.js +3 -3
- package/dist/src/components/VLMAnnotationDetail/VLMDetail/index.d.ts +1 -0
- package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +1 -1
- package/package.json +2 -2
- package/dist/dataset-annotation.js +0 -123598
- package/dist/dataset-annotation.umd.cjs +0 -1017
- package/dist/example/DatasetAnnotationDemo.d.ts +0 -3
- package/dist/example/DemoTabs.d.ts +0 -3
- package/dist/example/DetectionDatasetDemo.d.ts +0 -5
- package/dist/example/DetectionImageDemo.d.ts +0 -5
- package/dist/example/OcrDatasetDemo.d.ts +0 -5
- package/dist/example/OcrImageDemo.d.ts +0 -5
- package/dist/example/OcrkvcDatasetDemo.d.ts +0 -5
- package/dist/example/constant.local.d.ts +0 -6
- package/dist/example/index.d.ts +0 -1
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/ImageDetail/index.d.ts +0 -16
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorInput.d.ts +0 -12
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LabelEditorItem.d.ts +0 -21
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/LableEditor.d.ts +0 -16
- package/dist/src/components/VLMAnnotationDetail/MarkVLMBoxModal/OCRBoxMaker/index.d.ts +0 -19
- package/dist/src/utils/reactCompatibility.d.ts +0 -5
|
@@ -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
|
|
21
|
+
import { useKeyPress as ne } from "ahooks";
|
|
22
22
|
import { LoadingOutlined as Ie, MenuUnfoldOutlined as qe, MenuFoldOutlined as Ve } from "@ant-design/icons";
|
|
23
23
|
import Qe from "../../../DatasetContext/index.mjs";
|
|
24
24
|
import Ae from "../../VLMAnnotation/index.mjs";
|
|
25
25
|
import Le from "../../VQAAnnotation/VQAAnnotationPanel.mjs";
|
|
26
|
-
import
|
|
26
|
+
import ae from "../../Iconfont/index.mjs";
|
|
27
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,18 +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
44
|
onCurrentSampleChange: oe,
|
|
45
45
|
samples: re,
|
|
46
|
-
onSave:
|
|
46
|
+
onSave: A,
|
|
47
47
|
selectSampleId: de,
|
|
48
|
-
onClose:
|
|
48
|
+
onClose: L,
|
|
49
49
|
pagination: ce,
|
|
50
50
|
currentIndex: me
|
|
51
|
-
} = f, fe =
|
|
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), {
|
|
52
52
|
services: {
|
|
53
53
|
cvforceDatahub: d
|
|
54
54
|
},
|
|
@@ -57,46 +57,46 @@ const Xe = (f) => {
|
|
|
57
57
|
} = {
|
|
58
58
|
datasetManager: !1
|
|
59
59
|
}
|
|
60
|
-
} = Me(Qe), C = !(ve || h),
|
|
60
|
+
} = Me(Qe), C = !(ve || h), F = () => {
|
|
61
61
|
C && k();
|
|
62
|
-
},
|
|
62
|
+
}, z = () => {
|
|
63
63
|
C && M();
|
|
64
64
|
};
|
|
65
|
-
|
|
65
|
+
ne("rightarrow", (t) => {
|
|
66
66
|
if (c === "annotation")
|
|
67
67
|
return;
|
|
68
68
|
const n = t.target;
|
|
69
|
-
(n == null ? void 0 : n.tagName) === "INPUT" || (n == null ? void 0 : n.tagName) === "TEXTAREA" || n != null && n.isContentEditable ||
|
|
70
|
-
}),
|
|
69
|
+
(n == null ? void 0 : n.tagName) === "INPUT" || (n == null ? void 0 : n.tagName) === "TEXTAREA" || n != null && n.isContentEditable || z();
|
|
70
|
+
}), ne("leftarrow", (t) => {
|
|
71
71
|
if (c === "annotation")
|
|
72
72
|
return;
|
|
73
73
|
const n = t.target;
|
|
74
|
-
(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();
|
|
75
75
|
});
|
|
76
76
|
const Ne = p === "VQA";
|
|
77
77
|
V(() => {
|
|
78
78
|
l ? f.initialMode && x(f.initialMode) : x("preview");
|
|
79
79
|
}, [l, f.initialMode]), V(() => {
|
|
80
80
|
if (l && a && s && c === "preview") {
|
|
81
|
-
if (
|
|
81
|
+
if (T(!0), !(o != null && o.id))
|
|
82
82
|
return;
|
|
83
83
|
d == null || d.getDatasetsIdVersionsVidSsamplesSid(a, s, o.id).then((t) => {
|
|
84
84
|
ue(t);
|
|
85
|
-
}).finally(() =>
|
|
85
|
+
}).finally(() => T(!1));
|
|
86
86
|
}
|
|
87
87
|
}, [l, o, c]);
|
|
88
88
|
const Ce = ke(() => g(void 0, null, function* () {
|
|
89
89
|
if (!(!a || !s || !(i != null && i.id))) {
|
|
90
|
-
|
|
90
|
+
O(!0);
|
|
91
91
|
try {
|
|
92
92
|
const t = yield d == null ? void 0 : d.postGenerateVlmKieQa(a, s, {
|
|
93
93
|
sampleIds: [i.id]
|
|
94
94
|
});
|
|
95
|
-
I(t || []),
|
|
95
|
+
I(t || []), R(0);
|
|
96
96
|
} catch (t) {
|
|
97
97
|
console.error("QA生成失败", t), I([]);
|
|
98
98
|
} finally {
|
|
99
|
-
|
|
99
|
+
O(!1);
|
|
100
100
|
}
|
|
101
101
|
}
|
|
102
102
|
}), [a, s, i]);
|
|
@@ -115,21 +115,21 @@ const Xe = (f) => {
|
|
|
115
115
|
yield b.current.handleModalCancel();
|
|
116
116
|
return;
|
|
117
117
|
} else
|
|
118
|
-
|
|
118
|
+
L();
|
|
119
119
|
}), ye = () => {
|
|
120
|
-
x("annotation"),
|
|
120
|
+
x("annotation"), te((i == null ? void 0 : i.id) || (o == null ? void 0 : o.id));
|
|
121
121
|
}, we = () => {
|
|
122
|
-
|
|
122
|
+
_.confirm({
|
|
123
123
|
title: "确认要删除此数据吗?",
|
|
124
124
|
content: "删除后不可恢复,请慎重操作",
|
|
125
125
|
onOk: () => {
|
|
126
126
|
!a || !s || !(i != null && i.id) || d == null || d.delDatasetsIdVersionsVidSamplesId(a, s, i.id).then(() => {
|
|
127
|
-
|
|
128
|
-
}).catch(() =>
|
|
127
|
+
ie.success("删除成功"), Q(i.id), w(!1);
|
|
128
|
+
}).catch(() => ie.error("删除失败"));
|
|
129
129
|
}
|
|
130
130
|
});
|
|
131
131
|
};
|
|
132
|
-
return /* @__PURE__ */ e(
|
|
132
|
+
return /* @__PURE__ */ e(_, {
|
|
133
133
|
title: /* @__PURE__ */ e("div", {
|
|
134
134
|
className: "vlm-sample-detail-title",
|
|
135
135
|
children: /* @__PURE__ */ e("span", {
|
|
@@ -152,12 +152,12 @@ const Xe = (f) => {
|
|
|
152
152
|
className: "detail-content",
|
|
153
153
|
children: [/* @__PURE__ */ e(v, {
|
|
154
154
|
className: "select-prev",
|
|
155
|
-
icon: /* @__PURE__ */ e(
|
|
155
|
+
icon: /* @__PURE__ */ e(ae, {
|
|
156
156
|
type: "icon-zuojiantou"
|
|
157
157
|
}),
|
|
158
158
|
type: "text",
|
|
159
159
|
disabled: !C,
|
|
160
|
-
onClick: () =>
|
|
160
|
+
onClick: () => F()
|
|
161
161
|
}), /* @__PURE__ */ e("div", {
|
|
162
162
|
className: "select-main",
|
|
163
163
|
ref: fe,
|
|
@@ -173,12 +173,12 @@ const Xe = (f) => {
|
|
|
173
173
|
}), Ne ? /* @__PURE__ */ e("div", {
|
|
174
174
|
className: "vqa-preview-panel",
|
|
175
175
|
children: /* @__PURE__ */ e(Le, {
|
|
176
|
-
question: (B = (U = (
|
|
177
|
-
answer: (
|
|
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 : "",
|
|
178
178
|
readOnly: !0
|
|
179
179
|
})
|
|
180
180
|
}) : /* @__PURE__ */ r(y, {
|
|
181
|
-
children: [
|
|
181
|
+
children: [P && /* @__PURE__ */ r(y, {
|
|
182
182
|
children: [/* @__PURE__ */ r("div", {
|
|
183
183
|
className: "qa-preview-container",
|
|
184
184
|
children: [/* @__PURE__ */ r("div", {
|
|
@@ -186,7 +186,7 @@ const Xe = (f) => {
|
|
|
186
186
|
children: [/* @__PURE__ */ e("div", {
|
|
187
187
|
className: "qa-preview-title",
|
|
188
188
|
children: "QA预览"
|
|
189
|
-
}), /* @__PURE__ */ e(
|
|
189
|
+
}), /* @__PURE__ */ e(ee, {
|
|
190
190
|
children: pe && /* @__PURE__ */ e(be, {
|
|
191
191
|
indicator: /* @__PURE__ */ e(Ie, {
|
|
192
192
|
spin: !0,
|
|
@@ -199,23 +199,23 @@ const Xe = (f) => {
|
|
|
199
199
|
}), /* @__PURE__ */ e("div", {
|
|
200
200
|
className: "qa-preview-content",
|
|
201
201
|
children: (() => {
|
|
202
|
-
var
|
|
203
|
-
const t = ((
|
|
204
|
-
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", {
|
|
205
205
|
className: "result-empty",
|
|
206
206
|
children: "暂无结果"
|
|
207
207
|
}) : /* @__PURE__ */ r(y, {
|
|
208
208
|
children: [/* @__PURE__ */ e(xe, {
|
|
209
|
-
activeKey: String(
|
|
210
|
-
onChange: (u) =>
|
|
211
|
-
items: t.map((u,
|
|
212
|
-
key: String(
|
|
213
|
-
label: u.name || `模版${
|
|
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}`
|
|
214
214
|
}))
|
|
215
215
|
}), /* @__PURE__ */ e("div", {
|
|
216
216
|
className: "qa-preview-result",
|
|
217
217
|
children: (() => {
|
|
218
|
-
const u = t[
|
|
218
|
+
const u = t[E];
|
|
219
219
|
return u ? /* @__PURE__ */ r("div", {
|
|
220
220
|
className: "result-item-container",
|
|
221
221
|
children: [/* @__PURE__ */ r("div", {
|
|
@@ -251,32 +251,32 @@ const Xe = (f) => {
|
|
|
251
251
|
children: /* @__PURE__ */ e(v, {
|
|
252
252
|
type: "link",
|
|
253
253
|
icon: /* @__PURE__ */ e(qe, {}),
|
|
254
|
-
disabled:
|
|
254
|
+
disabled: D,
|
|
255
255
|
onClick: () => q(!1)
|
|
256
256
|
})
|
|
257
257
|
})]
|
|
258
|
-
}), !
|
|
258
|
+
}), !P && /* @__PURE__ */ e("div", {
|
|
259
259
|
className: "qa-preview-collapsed",
|
|
260
260
|
children: /* @__PURE__ */ e(v, {
|
|
261
261
|
type: "link",
|
|
262
262
|
icon: /* @__PURE__ */ e(Ve, {}),
|
|
263
|
-
disabled:
|
|
263
|
+
disabled: D,
|
|
264
264
|
onClick: () => q(!0)
|
|
265
265
|
})
|
|
266
266
|
})]
|
|
267
267
|
}), /* @__PURE__ */ e(v, {
|
|
268
268
|
className: "select-next",
|
|
269
|
-
icon: /* @__PURE__ */ e(
|
|
269
|
+
icon: /* @__PURE__ */ e(ae, {
|
|
270
270
|
type: "icon-youjiantou"
|
|
271
271
|
}),
|
|
272
272
|
type: "text",
|
|
273
273
|
disabled: !C,
|
|
274
|
-
onClick: () =>
|
|
274
|
+
onClick: () => z()
|
|
275
275
|
})]
|
|
276
276
|
})
|
|
277
277
|
}), /* @__PURE__ */ e("div", {
|
|
278
278
|
className: "vlm-mark-action",
|
|
279
|
-
children: /* @__PURE__ */ r(
|
|
279
|
+
children: /* @__PURE__ */ r(ee, {
|
|
280
280
|
children: [N && N.label && /* @__PURE__ */ e(v, {
|
|
281
281
|
type: "primary",
|
|
282
282
|
onClick: ye,
|
|
@@ -291,7 +291,7 @@ const Xe = (f) => {
|
|
|
291
291
|
})]
|
|
292
292
|
}) : (
|
|
293
293
|
// 标注模式:使用VLMDetail组件
|
|
294
|
-
|
|
294
|
+
A && /* @__PURE__ */ e(Te, {
|
|
295
295
|
ref: b,
|
|
296
296
|
visible: l,
|
|
297
297
|
selectSampleId: de,
|
|
@@ -299,9 +299,10 @@ const Xe = (f) => {
|
|
|
299
299
|
versionId: s,
|
|
300
300
|
vlmMarkTmpl: p,
|
|
301
301
|
onClose: () => {
|
|
302
|
-
|
|
302
|
+
L();
|
|
303
303
|
},
|
|
304
|
-
onSave:
|
|
304
|
+
onSave: A,
|
|
305
|
+
onDeleteSample: Q,
|
|
305
306
|
externalFilterMode: le,
|
|
306
307
|
onFilterModeChange: se,
|
|
307
308
|
onCurrentSampleChange: oe,
|