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