@glodon-aiot/dataset-annotation 3.25.0-alpha.8 → 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.
@@ -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 Me, useEffect as V, useCallback as ke } from "react";
19
- import { Modal as Z, Button as v, Space as _, Spin as be, Tabs as xe, 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";
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 ne from "../../Iconfont/index.mjs";
26
+ import ae from "../../Iconfont/index.mjs";
27
27
  import Te from "../VLMDetail/index.mjs";
28
28
  const Xe = (f) => {
29
- var z, K, U, B, S, X, G, $;
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: ae,
41
- updateSampleList: te,
40
+ handleMarkClick: te,
41
+ updateSampleList: Q,
42
42
  filterMode: le = "",
43
43
  onFilterModeChange: se,
44
44
  onCurrentSampleChange: oe,
45
45
  samples: re,
46
- onSave: Q,
46
+ onSave: A,
47
47
  selectSampleId: de,
48
- onClose: A,
48
+ onClose: L,
49
49
  pagination: ce,
50
50
  currentIndex: me
51
- } = f, fe = Y({}), b = Y(null), [i, ue] = m(), [ve, L] = m(!1), [c, x] = m(f.initialMode || "preview"), [he, I] = m([]), [T, E] = m(0), [pe, R] = m(!1), [O, q] = m(!0), [P, j] = m(!1), {
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), D = () => {
60
+ } = Me(Qe), C = !(ve || h), F = () => {
61
61
  C && k();
62
- }, F = () => {
62
+ }, z = () => {
63
63
  C && M();
64
64
  };
65
- ie("rightarrow", (t) => {
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 || F();
70
- }), 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) => {
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 || D();
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 (L(!0), !(o != null && o.id))
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(() => L(!1));
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
- R(!0);
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 || []), E(0);
95
+ I(t || []), R(0);
96
96
  } catch (t) {
97
97
  console.error("QA生成失败", t), I([]);
98
98
  } finally {
99
- R(!1);
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
- A();
118
+ L();
119
119
  }), ye = () => {
120
- x("annotation"), ae((i == null ? void 0 : i.id) || (o == null ? void 0 : o.id));
120
+ x("annotation"), te((i == null ? void 0 : i.id) || (o == null ? void 0 : o.id));
121
121
  }, we = () => {
122
- Z.confirm({
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
- ee.success("删除成功"), w(!1), te();
128
- }).catch(() => ee.error("删除失败"));
127
+ ie.success("删除成功"), Q(i.id), w(!1);
128
+ }).catch(() => ie.error("删除失败"));
129
129
  }
130
130
  });
131
131
  };
132
- return /* @__PURE__ */ e(Z, {
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(ne, {
155
+ icon: /* @__PURE__ */ e(ae, {
156
156
  type: "icon-zuojiantou"
157
157
  }),
158
158
  type: "text",
159
159
  disabled: !C,
160
- onClick: () => D()
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 = (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 : "",
177
- answer: ($ = (G = (X = (S = i == null ? void 0 : i.content) == null ? void 0 : S.conversations) == null ? void 0 : X[1]) == null ? void 0 : G.value) != null ? $ : "",
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: [O && /* @__PURE__ */ r(y, {
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 H, J;
203
- const t = ((H = he[0]) == null ? void 0 : H.qas) || [];
204
- 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", {
205
205
  className: "result-empty",
206
206
  children: "暂无结果"
207
207
  }) : /* @__PURE__ */ r(y, {
208
208
  children: [/* @__PURE__ */ e(xe, {
209
- activeKey: String(T),
210
- onChange: (u) => E(Number(u)),
211
- items: t.map((u, W) => ({
212
- key: String(W),
213
- label: u.name || `模版${W + 1}`
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[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: P,
254
+ disabled: D,
255
255
  onClick: () => q(!1)
256
256
  })
257
257
  })]
258
- }), !O && /* @__PURE__ */ e("div", {
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: P,
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(ne, {
269
+ icon: /* @__PURE__ */ e(ae, {
270
270
  type: "icon-youjiantou"
271
271
  }),
272
272
  type: "text",
273
273
  disabled: !C,
274
- onClick: () => F()
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
- Q && /* @__PURE__ */ e(Te, {
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
- A();
302
+ L();
303
303
  },
304
- onSave: Q,
304
+ onSave: A,
305
+ onDeleteSample: Q,
305
306
  externalFilterMode: le,
306
307
  onFilterModeChange: se,
307
308
  onCurrentSampleChange: oe,