@glodon-aiot/dataset-annotation 3.24.0-alpha.4 → 3.24.0-alpha.5

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,25 +1,25 @@
1
- var C = (f, p, s) => new Promise((y, o) => {
2
- var w = (a) => {
1
+ var g = (f, p, l) => new Promise((w, o) => {
2
+ var M = (a) => {
3
3
  try {
4
- h(s.next(a));
5
- } catch (l) {
6
- o(l);
4
+ h(l.next(a));
5
+ } catch (s) {
6
+ o(s);
7
7
  }
8
- }, M = (a) => {
8
+ }, k = (a) => {
9
9
  try {
10
- h(s.throw(a));
11
- } catch (l) {
12
- o(l);
10
+ h(l.throw(a));
11
+ } catch (s) {
12
+ o(s);
13
13
  }
14
- }, h = (a) => a.done ? y(a.value) : Promise.resolve(a.value).then(w, M);
15
- h((s = s.apply(f, p)).next());
14
+ }, h = (a) => a.done ? w(a.value) : Promise.resolve(a.value).then(M, k);
15
+ h((l = l.apply(f, p)).next());
16
16
  });
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";
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";
20
20
  import "./style.less.mjs";
21
21
  import { useKeyPress as ie } from "ahooks";
22
- import { LoadingOutlined as be, MenuUnfoldOutlined as Ie, MenuFoldOutlined as qe } from "@ant-design/icons";
22
+ import { LoadingOutlined as xe, MenuUnfoldOutlined as Ie, MenuFoldOutlined as qe } from "@ant-design/icons";
23
23
  import Ve from "../../../DatasetContext/index.mjs";
24
24
  import Qe from "../../VLMAnnotation/index.mjs";
25
25
  import Ae from "../../VQAAnnotation/VQAAnnotationPanel.mjs";
@@ -29,37 +29,37 @@ const Xe = (f) => {
29
29
  var z, K, U, B, X, G, S, $;
30
30
  const {
31
31
  vlmMarkTmpl: p,
32
- isVlmModalVisible: s,
33
- setIsVlmModalVisible: y,
32
+ isVlmModalVisible: l,
33
+ setIsVlmModalVisible: w,
34
34
  record: o,
35
- onNextClick: w,
36
- onPrevClick: M,
35
+ onNextClick: M,
36
+ onPrevClick: k,
37
37
  listLoading: h = !1,
38
38
  datasetId: a,
39
- versionId: l,
39
+ versionId: s,
40
40
  handleMarkClick: ae,
41
41
  updateSampleList: te,
42
- filterMode: se = "",
43
- onFilterModeChange: le,
42
+ filterMode: le = "",
43
+ onFilterModeChange: se,
44
44
  samples: oe,
45
- onSave: V,
45
+ onSave: Q,
46
46
  selectSampleId: re,
47
- onClose: Q,
47
+ onClose: A,
48
48
  pagination: de,
49
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), {
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), {
51
51
  services: {
52
52
  cvforceDatahub: d
53
53
  },
54
54
  featuresConfig: {
55
- datasetManager: j
55
+ datasetManager: N
56
56
  } = {
57
57
  datasetManager: !1
58
58
  }
59
- } = we(Ve), N = !(ue || h), D = () => {
60
- N && M();
59
+ } = we(Ve), C = !(ue || h), D = () => {
60
+ C && k();
61
61
  }, F = () => {
62
- N && w();
62
+ C && M();
63
63
  };
64
64
  ie("rightarrow", (t) => {
65
65
  if (c === "annotation")
@@ -73,48 +73,48 @@ const Xe = (f) => {
73
73
  (n == null ? void 0 : n.tagName) === "INPUT" || (n == null ? void 0 : n.tagName) === "TEXTAREA" || n != null && n.isContentEditable || D();
74
74
  });
75
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))
76
+ V(() => {
77
+ l ? f.initialMode && x(f.initialMode) : x("preview");
78
+ }, [l, f.initialMode]), V(() => {
79
+ if (l && a && s && c === "preview") {
80
+ if (L(!0), !(o != null && o.id))
81
81
  return;
82
- d == null || d.getDatasetsIdVersionsVidSsamplesSid(a, l, o.id).then((t) => {
82
+ d == null || d.getDatasetsIdVersionsVidSsamplesSid(a, s, o.id).then((t) => {
83
83
  fe(t);
84
- }).finally(() => A(!1));
84
+ }).finally(() => L(!1));
85
85
  }
86
- }, [s, o, c]);
87
- const Ne = Me(() => C(void 0, null, function* () {
88
- if (!(!a || !l || !(i != null && i.id))) {
89
- E(!0);
86
+ }, [l, o, c]);
87
+ const Ne = Me(() => g(void 0, null, function* () {
88
+ if (!(!a || !s || !(i != null && i.id))) {
89
+ R(!0);
90
90
  try {
91
- const t = yield d == null ? void 0 : d.postGenerateVlmKieQa(a, l, {
91
+ const t = yield d == null ? void 0 : d.postGenerateVlmKieQa(a, s, {
92
92
  sampleIds: [i.id]
93
93
  });
94
- b(t || []), T(0);
94
+ I(t || []), E(0);
95
95
  } catch (t) {
96
- console.error("QA生成失败", t), b([]);
96
+ console.error("QA生成失败", t), I([]);
97
97
  } finally {
98
- E(!1);
98
+ R(!1);
99
99
  }
100
100
  }
101
- }), [a, l, i]);
102
- q(() => {
103
- if (!s || c !== "preview" || !(i != null && i.id))
101
+ }), [a, s, i]);
102
+ V(() => {
103
+ if (!l || c !== "preview" || !(i != null && i.id))
104
104
  return;
105
105
  if (((i == null ? void 0 : i.labels) || []).length)
106
- P(!1), Ne();
106
+ j(!1), Ne();
107
107
  else {
108
- b([]), I(!1), P(!0);
108
+ I([]), q(!1), j(!0);
109
109
  return;
110
110
  }
111
111
  }, [i]);
112
- const Ce = () => C(void 0, null, function* () {
113
- if (c === "annotation" && k.current) {
114
- yield k.current.handleModalCancel();
112
+ const Ce = () => g(void 0, null, function* () {
113
+ if (c === "annotation" && b.current) {
114
+ yield b.current.handleModalCancel();
115
115
  return;
116
116
  } else
117
- Q();
117
+ A();
118
118
  }), ge = () => {
119
119
  x("annotation"), ae((i == null ? void 0 : i.id) || (o == null ? void 0 : o.id));
120
120
  }, ye = () => {
@@ -122,8 +122,8 @@ const Xe = (f) => {
122
122
  title: "确认要删除此数据吗?",
123
123
  content: "删除后不可恢复,请慎重操作",
124
124
  onOk: () => {
125
- !a || !l || !(i != null && i.id) || d == null || d.delDatasetsIdVersionsVidSamplesId(a, l, i.id).then(() => {
126
- ee.success("删除成功"), y(!1), te();
125
+ !a || !s || !(i != null && i.id) || d == null || d.delDatasetsIdVersionsVidSamplesId(a, s, i.id).then(() => {
126
+ ee.success("删除成功"), w(!1), te();
127
127
  }).catch(() => ee.error("删除失败"));
128
128
  }
129
129
  });
@@ -138,13 +138,13 @@ const Xe = (f) => {
138
138
  width: "100%",
139
139
  wrapClassName: "vlm-modal-wrap",
140
140
  className: "vlm-modal",
141
- open: s,
141
+ open: l,
142
142
  destroyOnClose: !0,
143
143
  onCancel: () => Ce(),
144
144
  maskClosable: !1,
145
145
  centered: !0,
146
146
  footer: null,
147
- children: c === "preview" ? /* @__PURE__ */ r(g, {
147
+ children: c === "preview" ? /* @__PURE__ */ r(y, {
148
148
  children: [/* @__PURE__ */ e("div", {
149
149
  className: "vlm-detail",
150
150
  children: /* @__PURE__ */ r("div", {
@@ -155,7 +155,7 @@ const Xe = (f) => {
155
155
  type: "icon-zuojiantou"
156
156
  }),
157
157
  type: "text",
158
- disabled: !N,
158
+ disabled: !C,
159
159
  onClick: () => D()
160
160
  }), /* @__PURE__ */ e("div", {
161
161
  className: "select-main",
@@ -165,7 +165,7 @@ const Xe = (f) => {
165
165
  labelDefinitions: [],
166
166
  hideRightSide: !0,
167
167
  readOnly: !0,
168
- ocrRecognize: () => C(void 0, null, function* () {
168
+ ocrRecognize: () => g(void 0, null, function* () {
169
169
  return [];
170
170
  })
171
171
  })
@@ -176,8 +176,8 @@ const Xe = (f) => {
176
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 ? $ : "",
177
177
  readOnly: !0
178
178
  })
179
- }) : /* @__PURE__ */ r(g, {
180
- children: [R && /* @__PURE__ */ r(g, {
179
+ }) : /* @__PURE__ */ r(y, {
180
+ children: [O && /* @__PURE__ */ r(y, {
181
181
  children: [/* @__PURE__ */ r("div", {
182
182
  className: "qa-preview-container",
183
183
  children: [/* @__PURE__ */ r("div", {
@@ -187,7 +187,7 @@ const Xe = (f) => {
187
187
  children: "QA预览"
188
188
  }), /* @__PURE__ */ e(_, {
189
189
  children: he && /* @__PURE__ */ e(ke, {
190
- indicator: /* @__PURE__ */ e(be, {
190
+ indicator: /* @__PURE__ */ e(xe, {
191
191
  spin: !0,
192
192
  style: {
193
193
  fontSize: 16
@@ -203,10 +203,10 @@ const Xe = (f) => {
203
203
  return !(((J = i == null ? void 0 : i.labels) == null ? void 0 : J.length) > 0) || t.length === 0 ? /* @__PURE__ */ e("div", {
204
204
  className: "result-empty",
205
205
  children: "暂无结果"
206
- }) : /* @__PURE__ */ r(g, {
207
- children: [/* @__PURE__ */ e(xe, {
208
- activeKey: String(L),
209
- onChange: (u) => T(Number(u)),
206
+ }) : /* @__PURE__ */ r(y, {
207
+ children: [/* @__PURE__ */ e(be, {
208
+ activeKey: String(T),
209
+ onChange: (u) => E(Number(u)),
210
210
  items: t.map((u, W) => ({
211
211
  key: String(W),
212
212
  label: u.name || `模版${W + 1}`
@@ -214,7 +214,7 @@ const Xe = (f) => {
214
214
  }), /* @__PURE__ */ e("div", {
215
215
  className: "qa-preview-result",
216
216
  children: (() => {
217
- const u = t[L];
217
+ const u = t[T];
218
218
  return u ? /* @__PURE__ */ r("div", {
219
219
  className: "result-item-container",
220
220
  children: [/* @__PURE__ */ r("div", {
@@ -250,17 +250,17 @@ const Xe = (f) => {
250
250
  children: /* @__PURE__ */ e(v, {
251
251
  type: "link",
252
252
  icon: /* @__PURE__ */ e(Ie, {}),
253
- disabled: O,
254
- onClick: () => I(!1)
253
+ disabled: P,
254
+ onClick: () => q(!1)
255
255
  })
256
256
  })]
257
- }), !R && /* @__PURE__ */ e("div", {
257
+ }), !O && /* @__PURE__ */ e("div", {
258
258
  className: "qa-preview-collapsed",
259
259
  children: /* @__PURE__ */ e(v, {
260
260
  type: "link",
261
261
  icon: /* @__PURE__ */ e(qe, {}),
262
- disabled: O,
263
- onClick: () => I(!0)
262
+ disabled: P,
263
+ onClick: () => q(!0)
264
264
  })
265
265
  })]
266
266
  }), /* @__PURE__ */ e(v, {
@@ -269,18 +269,18 @@ const Xe = (f) => {
269
269
  type: "icon-youjiantou"
270
270
  }),
271
271
  type: "text",
272
- disabled: !N,
272
+ disabled: !C,
273
273
  onClick: () => F()
274
274
  })]
275
275
  })
276
276
  }), /* @__PURE__ */ e("div", {
277
277
  className: "vlm-mark-action",
278
278
  children: /* @__PURE__ */ r(_, {
279
- children: [/* @__PURE__ */ e(v, {
279
+ children: [N && N.label && /* @__PURE__ */ e(v, {
280
280
  type: "primary",
281
281
  onClick: ge,
282
282
  children: "标注"
283
- }), j && j.delete && /* @__PURE__ */ e(v, {
283
+ }), N && N.delete && /* @__PURE__ */ e(v, {
284
284
  danger: !0,
285
285
  type: "ghost",
286
286
  onClick: ye,
@@ -290,19 +290,19 @@ const Xe = (f) => {
290
290
  })]
291
291
  }) : (
292
292
  // 标注模式:使用VLMDetail组件
293
- V && /* @__PURE__ */ e(Le, {
294
- ref: k,
295
- visible: s,
293
+ Q && /* @__PURE__ */ e(Le, {
294
+ ref: b,
295
+ visible: l,
296
296
  selectSampleId: re,
297
297
  datasetId: a,
298
- versionId: l,
298
+ versionId: s,
299
299
  vlmMarkTmpl: p,
300
300
  onClose: () => {
301
- Q();
301
+ A();
302
302
  },
303
- onSave: V,
304
- externalFilterMode: se,
305
- onFilterModeChange: le,
303
+ onSave: Q,
304
+ externalFilterMode: le,
305
+ onFilterModeChange: se,
306
306
  externalSamples: oe,
307
307
  externalPagination: de,
308
308
  externalCurrentIndex: ce