@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 = (d, s, m) => new Promise((n, v) => {
2
- var y = (a) => {
1
+ var N = (c, r, f) => new Promise((n, p) => {
2
+ var C = (a) => {
3
3
  try {
4
- t(m.next(a));
5
- } catch (h) {
6
- v(h);
4
+ t(f.next(a));
5
+ } catch (v) {
6
+ p(v);
7
7
  }
8
- }, M = (a) => {
8
+ }, y = (a) => {
9
9
  try {
10
- t(m.throw(a));
11
- } catch (h) {
12
- v(h);
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(y, M);
15
- t((m = m.apply(d, s)).next());
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 l, Fragment as b } from "react/jsx-runtime";
18
- import { useRef as T, useState as c, useContext as oe, useEffect as q, useCallback as ce } from "react";
19
- import { Modal as B, Button as C, Space as D, Spin as me, Tabs as ue, message as G } from "antd";
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 U } from "ahooks";
22
- import { LoadingOutlined as fe, MenuUnfoldOutlined as he, MenuFoldOutlined as ve } from "@ant-design/icons";
23
- import pe from "../../../DatasetContext/index.mjs";
24
- import ge from "../../VLMAnnotation/index.mjs";
25
- import $ from "../../Iconfont/index.mjs";
26
- import Ne from "../VLMDetail/index.mjs";
27
- const Qe = (d) => {
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: s,
30
- setIsVlmModalVisible: m,
29
+ isVlmModalVisible: r,
30
+ setIsVlmModalVisible: f,
31
31
  record: n,
32
- onNextClick: v,
33
- onPrevClick: y,
34
- listLoading: M = !1,
32
+ onNextClick: p,
33
+ onPrevClick: C,
34
+ listLoading: y = !1,
35
35
  datasetId: t,
36
36
  versionId: a,
37
- handleMarkClick: h,
38
- updateSampleList: H,
39
- filterMode: J = "",
40
- onFilterModeChange: W,
41
- samples: X,
42
- onSave: V,
43
- selectSampleId: Y,
44
- onClose: L,
45
- pagination: Z,
46
- currentIndex: _
47
- } = d, ee = T({}), w = T(null), [i, ie] = c(), [ae, Q] = c(!1), [u, x] = c(d.initialMode || "preview"), [te, k] = c([]), [R, O] = c(0), [ne, I] = c(!1), [S, j] = c(!0), {
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: r
49
+ cvforceDatahub: d
50
50
  },
51
51
  featuresConfig: {
52
- datasetManager: A
52
+ datasetManager: D
53
53
  } = {
54
54
  datasetManager: !1
55
55
  }
56
- } = oe(pe), p = !(ae || M), F = () => {
57
- p && y();
56
+ } = ce(ge), g = !(te || y), F = () => {
57
+ g && C();
58
58
  }, P = () => {
59
- p && v();
59
+ g && p();
60
60
  };
61
- U("rightarrow", () => {
61
+ $("rightarrow", () => {
62
62
  P();
63
- }), U("leftarrow", () => {
63
+ }), $("leftarrow", () => {
64
64
  F();
65
- }), q(() => {
66
- s ? d.initialMode && x(d.initialMode) : x("preview");
67
- }, [s, d.initialMode]), q(() => {
68
- if (s && t && a && u === "preview") {
69
- if (Q(!0), !(n != null && n.id))
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
- r == null || r.getDatasetsIdVersionsVidSsamplesSid(t, a, n.id).then((f) => {
72
- ie(f);
73
- }).finally(() => Q(!1));
71
+ d == null || d.getDatasetsIdVersionsVidSsamplesSid(t, a, n.id).then((l) => {
72
+ ae(l);
73
+ }).finally(() => V(!1));
74
74
  }
75
- }, [s, n, u]);
76
- const le = ce(() => N(void 0, null, function* () {
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 (!((i == null ? void 0 : i.labels) || []).length) {
80
- k([]), I(!1);
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 se = () => N(void 0, null, function* () {
99
- if (u === "annotation" && w.current) {
100
- yield w.current.handleModalCancel();
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
- L();
104
- }), re = () => {
105
- x("annotation"), h((i == null ? void 0 : i.id) || (n == null ? void 0 : n.id));
106
- }, de = () => {
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) || r == null || r.delDatasetsIdVersionsVidSamplesId(t, a, i.id).then(() => {
112
- G.success("删除成功"), m(!1), H();
113
- }).catch(() => G.error("删除失败"));
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: s,
130
+ open: r,
128
131
  destroyOnClose: !0,
129
- onCancel: () => se(),
132
+ onCancel: () => re(),
130
133
  maskClosable: !1,
131
134
  centered: !0,
132
135
  footer: null,
133
- children: u === "preview" ? /* @__PURE__ */ l(b, {
136
+ children: u === "preview" ? /* @__PURE__ */ s(b, {
134
137
  children: [/* @__PURE__ */ e("div", {
135
138
  className: "vlm-detail",
136
- children: /* @__PURE__ */ l("div", {
139
+ children: /* @__PURE__ */ s("div", {
137
140
  className: "detail-content",
138
- children: [/* @__PURE__ */ e(C, {
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: !p,
147
+ disabled: !g,
145
148
  onClick: () => F()
146
149
  }), /* @__PURE__ */ e("div", {
147
150
  className: "select-main",
148
- ref: ee,
149
- children: i && /* @__PURE__ */ e(ge, {
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__ */ l(b, {
159
- children: [/* @__PURE__ */ l("div", {
161
+ }), S && /* @__PURE__ */ s(b, {
162
+ children: [/* @__PURE__ */ s("div", {
160
163
  className: "qa-preview-container",
161
- children: [/* @__PURE__ */ l("div", {
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(D, {
167
- children: ne && /* @__PURE__ */ e(me, {
168
- indicator: /* @__PURE__ */ e(fe, {
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 f = ((z = te[0]) == null ? void 0 : z.qas) || [];
181
- return !(((E = i == null ? void 0 : i.labels) == null ? void 0 : E.length) > 0) || f.length === 0 ? /* @__PURE__ */ e("div", {
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__ */ l(b, {
187
+ }) : /* @__PURE__ */ s(b, {
185
188
  children: [/* @__PURE__ */ e(ue, {
186
- activeKey: String(R),
187
- onChange: (o) => O(Number(o)),
188
- items: f.map((o, K) => ({
189
+ activeKey: String(L),
190
+ onChange: (m) => R(Number(m)),
191
+ items: l.map((m, K) => ({
189
192
  key: String(K),
190
- label: o.name || `模版${K + 1}`
193
+ label: m.name || `模版${K + 1}`
191
194
  }))
192
195
  }), /* @__PURE__ */ e("div", {
193
196
  className: "qa-preview-result",
194
197
  children: (() => {
195
- const o = f[R];
196
- return o ? /* @__PURE__ */ l("div", {
198
+ const m = l[L];
199
+ return m ? /* @__PURE__ */ s("div", {
197
200
  className: "result-item-container",
198
- children: [/* @__PURE__ */ l("div", {
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: o.q
208
+ children: m.q
206
209
  })]
207
- }), /* @__PURE__ */ l("div", {
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: o.a
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(he, {
229
- onClick: () => j(!1)
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(ve, {
235
- onClick: () => j(!0)
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(C, {
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: !p,
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__ */ l(D, {
250
- children: [/* @__PURE__ */ e(C, {
258
+ children: /* @__PURE__ */ s(G, {
259
+ children: [/* @__PURE__ */ e(h, {
251
260
  type: "primary",
252
- onClick: re,
261
+ onClick: de,
253
262
  children: "标注"
254
- }), A && A.delete && /* @__PURE__ */ e(C, {
263
+ }), D && D.delete && /* @__PURE__ */ e(h, {
255
264
  danger: !0,
256
265
  type: "ghost",
257
- onClick: de,
266
+ onClick: oe,
258
267
  children: "删除数据"
259
268
  })]
260
269
  })
261
270
  })]
262
271
  }) : (
263
272
  // 标注模式:使用VLMDetail组件
264
- V && /* @__PURE__ */ e(Ne, {
265
- ref: w,
266
- visible: s,
267
- selectSampleId: Y,
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
- L();
280
+ Q();
272
281
  },
273
- onSave: V,
274
- externalFilterMode: J,
275
- onFilterModeChange: W,
276
- externalSamples: X,
277
- externalPagination: Z,
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
- Qe as default
293
+ Oe as default
285
294
  };