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