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