@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.
Files changed (24) hide show
  1. package/dist/es/components/ClassificationAnnotation/index.mjs +399 -343
  2. package/dist/es/components/DetectionAnnotation/components/ImageDetail/index.mjs +82 -78
  3. package/dist/es/components/DetectionAnnotation/components/ImageModal/index.mjs +28 -26
  4. package/dist/es/components/DetectionAnnotation/components/LabelMaker/index.mjs +173 -166
  5. package/dist/es/components/DetectionAnnotation/index.mjs +607 -590
  6. package/dist/es/components/OcrAnnotation/OCRBoxDetail/index.mjs +249 -230
  7. package/dist/es/components/OcrAnnotation/OcrModal/index.mjs +103 -98
  8. package/dist/es/components/OcrAnnotation/index.mjs +281 -243
  9. package/dist/es/components/VLMAnnotationDetail/VLMDetail/index.mjs +304 -298
  10. package/dist/es/components/VLMAnnotationDetail/VlmModal/index.mjs +86 -83
  11. package/dist/es/components/VLMAnnotationDetail/index.mjs +386 -300
  12. package/dist/es/index.mjs +1 -1
  13. package/dist/es/utils/checkVlmSampleLabeled.mjs +7 -0
  14. package/dist/es/utils/scrollSampleIntoView.mjs +16 -0
  15. package/dist/lib/index.js +4 -4
  16. package/dist/src/components/DetectionAnnotation/components/ImageDetail/index.d.ts +2 -0
  17. package/dist/src/components/DetectionAnnotation/components/ImageModal/index.d.ts +2 -0
  18. package/dist/src/components/OcrAnnotation/OCRBoxDetail/index.d.ts +2 -0
  19. package/dist/src/components/OcrAnnotation/OcrModal/index.d.ts +1 -0
  20. package/dist/src/components/VLMAnnotationDetail/VLMDetail/index.d.ts +7 -0
  21. package/dist/src/components/VLMAnnotationDetail/VlmModal/index.d.ts +6 -1
  22. package/dist/src/utils/checkVlmSampleLabeled.d.ts +8 -0
  23. package/dist/src/utils/scrollSampleIntoView.d.ts +9 -0
  24. 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 Y, useState as m, useContext as we, useEffect as V, useCallback as Me } from "react";
19
- import { Modal as Z, Button as v, Space as _, Spin as ke, Tabs as be, message as ee } from "antd";
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 ie } from "ahooks";
22
- import { LoadingOutlined as xe, 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
- import Le from "../VLMDetail/index.mjs";
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 z, K, U, B, X, G, S, $;
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: ae,
41
- updateSampleList: te,
40
+ handleMarkClick: te,
41
+ updateSampleList: Q,
42
42
  filterMode: le = "",
43
43
  onFilterModeChange: se,
44
- samples: oe,
45
- onSave: Q,
46
- selectSampleId: re,
47
- onClose: A,
48
- pagination: de,
49
- currentIndex: ce
50
- } = f, me = Y({}), b = Y(null), [i, fe] = m(), [ue, L] = m(!1), [c, x] = m(f.initialMode || "preview"), [ve, I] = m([]), [T, E] = m(0), [he, R] = m(!1), [O, q] = m(!0), [P, j] = m(!1), {
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
- } = we(Ve), C = !(ue || h), D = () => {
60
+ } = Me(Qe), C = !(ve || h), F = () => {
60
61
  C && k();
61
- }, F = () => {
62
+ }, z = () => {
62
63
  C && M();
63
64
  };
64
- ie("rightarrow", (t) => {
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 || F();
69
- }), ie("leftarrow", (t) => {
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 || D();
74
+ (n == null ? void 0 : n.tagName) === "INPUT" || (n == null ? void 0 : n.tagName) === "TEXTAREA" || n != null && n.isContentEditable || F();
74
75
  });
75
- const pe = p === "VQA";
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 (L(!0), !(o != null && o.id))
81
+ if (T(!0), !(o != null && o.id))
81
82
  return;
82
83
  d == null || d.getDatasetsIdVersionsVidSsamplesSid(a, s, o.id).then((t) => {
83
- fe(t);
84
- }).finally(() => L(!1));
84
+ ue(t);
85
+ }).finally(() => T(!1));
85
86
  }
86
87
  }, [l, o, c]);
87
- const Ne = Me(() => g(void 0, null, function* () {
88
+ const Ce = ke(() => g(void 0, null, function* () {
88
89
  if (!(!a || !s || !(i != null && i.id))) {
89
- R(!0);
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 || []), E(0);
95
+ I(t || []), R(0);
95
96
  } catch (t) {
96
97
  console.error("QA生成失败", t), I([]);
97
98
  } finally {
98
- R(!1);
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), Ne();
107
+ j(!1), Ce();
107
108
  else {
108
109
  I([]), q(!1), j(!0);
109
110
  return;
110
111
  }
111
112
  }, [i]);
112
- const Ce = () => g(void 0, null, function* () {
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
- A();
118
- }), ge = () => {
119
- x("annotation"), ae((i == null ? void 0 : i.id) || (o == null ? void 0 : o.id));
120
- }, ye = () => {
121
- Z.confirm({
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
- ee.success("删除成功"), w(!1), te();
127
- }).catch(() => ee.error("删除失败"));
127
+ ie.success("删除成功"), Q(i.id), w(!1);
128
+ }).catch(() => ie.error("删除失败"));
128
129
  }
129
130
  });
130
131
  };
131
- return /* @__PURE__ */ e(Z, {
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: () => Ce(),
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(ne, {
155
+ icon: /* @__PURE__ */ e(ae, {
155
156
  type: "icon-zuojiantou"
156
157
  }),
157
158
  type: "text",
158
159
  disabled: !C,
159
- onClick: () => D()
160
+ onClick: () => F()
160
161
  }), /* @__PURE__ */ e("div", {
161
162
  className: "select-main",
162
- ref: me,
163
- children: i && /* @__PURE__ */ e(Qe, {
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
- }), pe ? /* @__PURE__ */ e("div", {
173
+ }), Ne ? /* @__PURE__ */ e("div", {
173
174
  className: "vqa-preview-panel",
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 ? $ : "",
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: [O && /* @__PURE__ */ r(y, {
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: he && /* @__PURE__ */ e(ke, {
190
- indicator: /* @__PURE__ */ e(xe, {
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 H, J;
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", {
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(be, {
208
- activeKey: String(T),
209
- onChange: (u) => E(Number(u)),
210
- items: t.map((u, W) => ({
211
- key: String(W),
212
- label: u.name || `模版${W + 1}`
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[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(Ie, {}),
253
- disabled: P,
253
+ icon: /* @__PURE__ */ e(qe, {}),
254
+ disabled: D,
254
255
  onClick: () => q(!1)
255
256
  })
256
257
  })]
257
- }), !O && /* @__PURE__ */ e("div", {
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(qe, {}),
262
- disabled: P,
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(ne, {
269
+ icon: /* @__PURE__ */ e(ae, {
269
270
  type: "icon-youjiantou"
270
271
  }),
271
272
  type: "text",
272
273
  disabled: !C,
273
- onClick: () => F()
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: ge,
282
+ onClick: ye,
282
283
  children: "标注"
283
284
  }), N && N.delete && /* @__PURE__ */ e(v, {
284
285
  danger: !0,
285
286
  type: "ghost",
286
- onClick: ye,
287
+ onClick: we,
287
288
  children: "删除数据"
288
289
  })]
289
290
  })
290
291
  })]
291
292
  }) : (
292
293
  // 标注模式:使用VLMDetail组件
293
- Q && /* @__PURE__ */ e(Le, {
294
+ A && /* @__PURE__ */ e(Te, {
294
295
  ref: b,
295
296
  visible: l,
296
- selectSampleId: re,
297
+ selectSampleId: de,
297
298
  datasetId: a,
298
299
  versionId: s,
299
300
  vlmMarkTmpl: p,
300
301
  onClose: () => {
301
- A();
302
+ L();
302
303
  },
303
- onSave: Q,
304
+ onSave: A,
305
+ onDeleteSample: Q,
304
306
  externalFilterMode: le,
305
307
  onFilterModeChange: se,
306
- externalSamples: oe,
307
- externalPagination: de,
308
- externalCurrentIndex: ce
308
+ onCurrentSampleChange: oe,
309
+ externalSamples: re,
310
+ externalPagination: ce,
311
+ externalCurrentIndex: me
309
312
  })
310
313
  )
311
314
  });